Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Support providing MLB templates via environment variables rather than… #492

Merged

Conversation

justinrlee
Copy link
Contributor

@nlsun
Copy link
Contributor

nlsun commented Sep 8, 2017

It's rather difficult to squeeze text into environment variables because of the kind of escaping is required to get it to fit into JSON (e.g. \\n), so not terribly comfortable with this change. But at the same time it isn't exactly detrimental, I suppose.

@justinrlee
Copy link
Contributor Author

Yeah so I think I handled it so that it will accept either \n or \\n (or even \\\n, not sure on that one). This is primarily to overwrite changes that only require a line or two. But I've tested it as far as overwriting the HAPROXY_HEAD thing with no issues.

config.py Outdated
if os.environ.get(name):
logger.info('overriding %s from environment variable', name)
env_template_val = os.environ.get(name)
# logger.info(env_template_val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a leftover debug line? Please remove if so

self.t[template].value = f.read()
except IOError:
logger.debug("setting default value for %s", name)
if os.environ.get(name):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add a test to tests/test_marathon_lb.py? You should be able to do something like

os.environ["key"] = "val"

…rathon-lb into jlee-support-env-templates

Catching up to changes on mesosphere/marathon-lb
@justinrlee justinrlee force-pushed the jlee-support-env-templates branch from 6ee7c92 to 4a5234d Compare September 20, 2017 23:29
@justinrlee justinrlee force-pushed the jlee-support-env-templates branch 4 times, most recently from 44c3afd to 1bb98eb Compare September 21, 2017 02:14
@justinrlee justinrlee force-pushed the jlee-support-env-templates branch from a07d152 to bbf89cd Compare September 21, 2017 12:37
@justinrlee
Copy link
Contributor Author

@drewkerrigan I've removed the debug line and added a basic unit test - can you validate?

Thanks!

@drewkerrigan drewkerrigan merged commit b8efe88 into d2iq-archive:master Sep 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants