diff options
author | Joffrey F <f.joffrey@gmail.com> | 2016-04-27 16:27:28 -0700 |
---|---|---|
committer | Joffrey F <f.joffrey@gmail.com> | 2016-04-27 16:27:28 -0700 |
commit | 3c02fc4cc71a31d51119ad69053d3be4248caa9f (patch) | |
tree | 606de899f10c034891b6169feaccc85439a7394b | |
parent | 237f5318f26b793b90995c932bae199863d899f3 (diff) | |
parent | 6eaf8ce721351420fa12ed4368b71bebabdf3ace (diff) | |
download | docker-py-3c02fc4cc71a31d51119ad69053d3be4248caa9f.tar.gz |
Merge pull request #1004 from klj613/allow-equals-character-in-env-file
makes it possible to have '=' in the env file
-rw-r--r-- | docker/utils/utils.py | 2 | ||||
-rw-r--r-- | tests/unit/utils_test.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py index cb724f9..3926e54 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -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 diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index aed51d4..1217934 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -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') |