Skip to content
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

docker environment mangled #64

Closed
tyldum opened this issue Sep 9, 2019 · 6 comments
Closed

docker environment mangled #64

tyldum opened this issue Sep 9, 2019 · 6 comments

Comments

@tyldum
Copy link

tyldum commented Sep 9, 2019

This change causes my runs to miss the first and last quote.

02d6353#diff-aeddd16345c3d33656d19cf55fceff3d

@nickjj
Copy link
Owner

nickjj commented Sep 9, 2019

Can you show me an example of what the output looks like on your end and what you would expect to see instead?

@tyldum
Copy link
Author

tyldum commented Sep 9, 2019

Got:

# Ansible managed

[Service]
Environment=HTTP_PROXY=http://proxy.corp:3128" "HTTPS_PROXY=http://proxy.corp:3128" "NO_PROXY=127.0.0.1/8

Expected (and got this by reversing the change):

# Ansible managed

[Service]
Environment="HTTP_PROXY=http://proxy.corp:3128" "HTTPS_PROXY=http://proxy.corp:3128" "NO_PROXY=127.0.0.1/8"

@tyldum
Copy link
Author

tyldum commented Sep 9, 2019

variable:

docker__daemon_environment:
  - "HTTP_PROXY=http://proxy.corp:3128"
  - "HTTPS_PROXY=http://proxy.corp:3128"
  - "NO_PROXY=127.0.0.1/8"

@nickjj
Copy link
Owner

nickjj commented Sep 9, 2019

I'm able to confirm that here and funny enough systemd is ok with quote mismatches so it didn't prevent the Docker daemon from starting up.

I just re-worked the template to generate multiple environment variables to be more clear by outputting each one on their own line and to avoid any quote shenanigans.

Can you double confirm it works for you by changing templates/etc/systemd/docker.service.d/environment.conf.j2 to:

# {{ ansible_managed }}

[Service]
{% for env in docker__daemon_environment %}
Environment="{{ env }}"
{% endfor %}

It should produce this output:

# Ansible managed

[Service]
Environment="HTTP_PROXY=http://proxy.a.com:80"
Environment="HTTPS_PROXY=https://proxy.a.com:443"

With an input of:

docker__daemon_environment:
  - "HTTP_PROXY=http://proxy.a.com:80"
  - "HTTPS_PROXY=https://proxy.a.com:443"

@tyldum
Copy link
Author

tyldum commented Sep 9, 2019

It works!
Actually the single line appeared to work as well, but this is the correct way anyways.

@nickjj
Copy link
Owner

nickjj commented Sep 9, 2019

Cool.

Yeah if the quotes were lined up it should have worked on 1 line in the end.

I just pushed v1.9.1 to the Galaxy with this fix and here's the commit: beaaccb

@nickjj nickjj closed this as completed Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants