-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy settings update #33
Conversation
844f5c1
to
70e470e
Compare
70e470e
to
eb8faab
Compare
src/charm.py
Outdated
if proxy_url: | ||
os.environ["HTTP_PROXY"] = proxy_url | ||
os.environ["HTTPS_PROXY"] = proxy_url | ||
http_proxy_env = os.environ.get("JUJU_CHARM_HTTP_PROXY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get
supports a default value if the key is missing so you could combine these lines with the ones on 263, 264 as:
http_proxy_str = os.environ.get("JUJU_CHARM_HTTP_PROXY", "")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good 👍
just a couple of changes as called out in comments
35f4b2c
to
0038b0e
Compare
0038b0e
to
b6a708c
Compare
src/container_runner.py
Outdated
@@ -18,6 +18,32 @@ | |||
DOCKER_DAEMON_CONFIG_PATH = Path("/etc/docker/daemon.json") | |||
|
|||
|
|||
def _try_set_proxy_settings(): | |||
"""If Juju proxy environment variables are present, set procy environment variables and write Docker proxy settings to /etc/docker/daemon.json.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "procy"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks! I'll fix that before I merge 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a typo in one of the doc comments but that's not really a blocker for merging
The Docker snap did not have an easy way to enable us to pass proxy settings to the docker daemon before starting. This prevented us from having a simple lifecycle to manage operating the charm from behind a proxy.
This PR aims to:
/etc/docker/daemon.json
)/etc/docker/daemon.json
before docker daemon is started