Merge lp:~canonical-platform-qa/snappy-ecosystem-tests/setting-proxy-to-containers into lp:snappy-ecosystem-tests

Proposed by Heber Parrucci
Status: Merged
Approved by: Santiago Baldassin
Approved revision: 43
Merged at revision: 43
Proposed branch: lp:~canonical-platform-qa/snappy-ecosystem-tests/setting-proxy-to-containers
Merge into: lp:snappy-ecosystem-tests
Diff against target: 34 lines (+17/-0)
1 file modified
snappy_ecosystem_tests/environment/containers/lxd.py (+17/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/snappy-ecosystem-tests/setting-proxy-to-containers
Reviewer Review Type Date Requested Status
platform-qa-bot continuous-integration Approve
Santiago Baldassin (community) Approve
Review via email: mp+319927@code.launchpad.net

Commit message

Setting proxy environment variables to containers if they are set in the host

Description of the change

Setting proxy environment variables to containers if they are set in the host

To post a comment you must log in.
Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Looks good

review: Approve
Revision history for this message
platform-qa-bot (platform-qa-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snappy_ecosystem_tests/environment/containers/lxd.py'
--- snappy_ecosystem_tests/environment/containers/lxd.py 2017-03-15 12:37:04 +0000
+++ snappy_ecosystem_tests/environment/containers/lxd.py 2017-03-15 14:15:26 +0000
@@ -33,6 +33,7 @@
3333
34LOGGER = logging.getLogger(__name__)34LOGGER = logging.getLogger(__name__)
35DOMAIN_PING = 'ubuntu.com'35DOMAIN_PING = 'ubuntu.com'
36VARIABLES = ['https_proxy', 'http_proxy']
3637
3738
38class LXDDriver:39class LXDDriver:
@@ -146,6 +147,22 @@
146 self._execute_command(147 self._execute_command(
147 container,148 container,
148 'echo \'{}={}\' >> /etc/environment'.format(key, value))149 'echo \'{}={}\' >> /etc/environment'.format(key, value))
150 self.set_variables(VARIABLES, container)
151
152 def set_variables(self, variables, container):
153 """Read given environment variables in the host and set to
154 the container"""
155 for var in variables:
156 self._set_variable(var, container)
157
158 def _set_variable(self, variable, container):
159 """Read the given variable in the host and set to the container"""
160 value = os.environ.get(variable)
161 if value:
162 self._execute_command(
163 container,
164 'echo \'{}={}\' >> /etc/environment'.format(variable,
165 value))
149166
150 def wait_for_internet(self, container, attempts_count=10,167 def wait_for_internet(self, container, attempts_count=10,
151 attempt_interval=1, ping_domain=DOMAIN_PING):168 attempt_interval=1, ping_domain=DOMAIN_PING):

Subscribers

People subscribed via source and target branches