← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/sudo-mipf into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/sudo-mipf into lp:maas.

Commit message:
Fix the call to maas-import-pxe-files, this script needs root access.

This fix goes hand in hand with the packaging fix in https://code.launchpad.net/~rvb/maas/packaging.sudo-mipf/+merge/132874.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/sudo-mipf/+merge/132873
-- 
https://code.launchpad.net/~rvb/maas/sudo-mipf/+merge/132873
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/sudo-mipf into lp:maas.
=== modified file 'src/provisioningserver/tasks.py'
--- src/provisioningserver/tasks.py	2012-10-30 11:19:02 +0000
+++ src/provisioningserver/tasks.py	2012-11-05 11:58:36 +0000
@@ -381,4 +381,4 @@
     if http_proxy is not None:
         env['http_proxy'] = http_proxy
         env['https_proxy'] = http_proxy
-    check_call(['maas-import-pxe-files'], env=env)
+    check_call(['sudo', '-n', 'maas-import-pxe-files'], env=env)

=== modified file 'src/provisioningserver/tests/test_tasks.py'
--- src/provisioningserver/tests/test_tasks.py	2012-10-30 11:19:02 +0000
+++ src/provisioningserver/tests/test_tasks.py	2012-11-05 11:58:36 +0000
@@ -543,14 +543,15 @@
     def test_import_pxe_files(self):
         recorder = self.patch(tasks, 'check_call', Mock())
         import_pxe_files()
-        recorder.assert_called_once_with(['maas-import-pxe-files'], env=ANY)
+        recorder.assert_called_once_with(
+            ['sudo', '-n', 'maas-import-pxe-files'], env=ANY)
         self.assertIsInstance(import_pxe_files, Task)
 
     def test_import_pxe_files_preserves_environment(self):
         recorder = self.patch(tasks, 'check_call', Mock())
         import_pxe_files()
         recorder.assert_called_once_with(
-            ['maas-import-pxe-files'], env=os.environ)
+            ['sudo', '-n', 'maas-import-pxe-files'], env=os.environ)
 
     def test_import_pxe_files_sets_proxy(self):
         recorder = self.patch(tasks, 'check_call', Mock())
@@ -558,4 +559,4 @@
         import_pxe_files(http_proxy=proxy)
         expected_env = dict(os.environ, http_proxy=proxy, https_proxy=proxy)
         recorder.assert_called_once_with(
-            ['maas-import-pxe-files'], env=expected_env)
+            ['sudo', '-n', 'maas-import-pxe-files'], env=expected_env)