Merge lp:~rvb/maas/proxy-bug-1081229 into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1359
Proposed branch: lp:~rvb/maas/proxy-bug-1081229
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 52 lines (+5/-5)
3 files modified
src/maasserver/tests/test_api.py (+1/-1)
src/provisioningserver/tasks.py (+1/-1)
src/provisioningserver/tests/test_tasks.py (+3/-3)
To merge this branch: bzr merge lp:~rvb/maas/proxy-bug-1081229
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+135362@code.launchpad.net

Commit message

Add '-E' to the options when calling maas-import-pxe-files via sudo to preserve the environment.

Description of the change

This goes hand in hand with the packaging change in https://code.launchpad.net/~rvb/maas/packaging.proxy-bug-1081229/+merge/135361

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Looks good. As discussed on the call this morning, it's a bug that maas-import-pxe-files runs as root, but we can address that separately.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/tests/test_api.py'
2--- src/maasserver/tests/test_api.py 2012-11-13 18:01:08 +0000
3+++ src/maasserver/tests/test_api.py 2012-11-21 10:27:37 +0000
4@@ -4231,7 +4231,7 @@
5 httplib.OK, response.status_code,
6 explain_unexpected_response(httplib.OK, response))
7 recorder.assert_called_once_with(
8- ['sudo', '-n', 'maas-import-pxe-files'], env=ANY)
9+ ['sudo', '-n', '-E', 'maas-import-pxe-files'], env=ANY)
10
11 def test_nodegroup_import_boot_images_denied_if_not_admin(self):
12 nodegroup = factory.make_node_group()
13
14=== modified file 'src/provisioningserver/tasks.py'
15--- src/provisioningserver/tasks.py 2012-11-08 14:52:16 +0000
16+++ src/provisioningserver/tasks.py 2012-11-21 10:27:37 +0000
17@@ -388,4 +388,4 @@
18 env['PORTS_ARCHIVE'] = ports_archive
19 if cloud_images_archive is not None:
20 env['CLOUD_IMAGES_ARCHIVE'] = cloud_images_archive
21- check_call(['sudo', '-n', 'maas-import-pxe-files'], env=env)
22+ check_call(['sudo', '-n', '-E', 'maas-import-pxe-files'], env=env)
23
24=== modified file 'src/provisioningserver/tests/test_tasks.py'
25--- src/provisioningserver/tests/test_tasks.py 2012-11-08 14:54:02 +0000
26+++ src/provisioningserver/tests/test_tasks.py 2012-11-21 10:27:37 +0000
27@@ -549,14 +549,14 @@
28 recorder = self.patch(tasks, 'check_call', Mock())
29 import_boot_images()
30 recorder.assert_called_once_with(
31- ['sudo', '-n', 'maas-import-pxe-files'], env=ANY)
32+ ['sudo', '-n', '-E', 'maas-import-pxe-files'], env=ANY)
33 self.assertIsInstance(import_boot_images, Task)
34
35 def test_import_boot_images_preserves_environment(self):
36 recorder = self.patch(tasks, 'check_call', Mock())
37 import_boot_images()
38 recorder.assert_called_once_with(
39- ['sudo', '-n', 'maas-import-pxe-files'], env=os.environ)
40+ ['sudo', '-n', '-E', 'maas-import-pxe-files'], env=os.environ)
41
42 def test_import_boot_images_sets_proxy(self):
43 recorder = self.patch(tasks, 'check_call', Mock())
44@@ -564,7 +564,7 @@
45 import_boot_images(http_proxy=proxy)
46 expected_env = dict(os.environ, http_proxy=proxy, https_proxy=proxy)
47 recorder.assert_called_once_with(
48- ['sudo', '-n', 'maas-import-pxe-files'], env=expected_env)
49+ ['sudo', '-n', '-E', 'maas-import-pxe-files'], env=expected_env)
50
51 def test_import_boot_images_sets_archive_locations(self):
52 self.patch(tasks, 'check_call')