mirror of https://github.com/docker/docker-py.git
Merge pull request #1004 from klj613/allow-equals-character-in-env-file
makes it possible to have '=' in the env file
This commit is contained in:
commit
3c02fc4cc7
|
@ -845,7 +845,7 @@ def parse_env_file(env_file):
|
|||
if line[0] == '#':
|
||||
continue
|
||||
|
||||
parse_line = line.strip().split('=')
|
||||
parse_line = line.strip().split('=', 1)
|
||||
if len(parse_line) == 2:
|
||||
k, v = parse_line
|
||||
environment[k] = v
|
||||
|
|
|
@ -371,6 +371,14 @@ class ParseEnvFileTest(base.BaseTestCase):
|
|||
{'USER': 'jdoe', 'PASS': 'secret'})
|
||||
os.unlink(env_file)
|
||||
|
||||
def test_parse_env_file_with_equals_character(self):
|
||||
env_file = self.generate_tempfile(
|
||||
file_content='USER=jdoe\nPASS=sec==ret')
|
||||
get_parse_env_file = parse_env_file(env_file)
|
||||
self.assertEqual(get_parse_env_file,
|
||||
{'USER': 'jdoe', 'PASS': 'sec==ret'})
|
||||
os.unlink(env_file)
|
||||
|
||||
def test_parse_env_file_commented_line(self):
|
||||
env_file = self.generate_tempfile(
|
||||
file_content='USER=jdoe\n#PASS=secret')
|
||||
|
|
Loading…
Reference in New Issue