diff options
| author | Thierry Carrez <thierry@openstack.org> | 2011-09-12 14:30:56 +0200 |
|---|---|---|
| committer | Thierry Carrez <thierry@openstack.org> | 2011-09-12 14:30:56 +0200 |
| commit | cd5084f8a69b0e2a14f01aa9a4f3d8588a83c923 (patch) | |
| tree | e7a35d0013be644c98ef48fd5046b3eab7d03a3c | |
| parent | 67a2445265c8bce704802935b83c6e1ece805332 (diff) | |
Fix rogue usage of 'sudo' bypassing the run_as_root=True method
| -rw-r--r-- | nova/tests/test_libvirt.py | 4 | ||||
| -rw-r--r-- | nova/virt/disk.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 8c6775b29..fea2b7cd3 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -743,7 +743,7 @@ class LibvirtConnTestCase(test.TestCase): # qemu-img should be mockd since test environment might not have # large disk space. self.mox.StubOutWithMock(utils, "execute") - utils.execute('sudo', 'qemu-img', 'create', '-f', 'raw', + utils.execute('qemu-img', 'create', '-f', 'raw', '%s/%s/disk' % (tmpdir, instance_ref.name), '10G') self.mox.ReplayAll() @@ -795,7 +795,7 @@ class LibvirtConnTestCase(test.TestCase): os.path.getsize("/test/disk").AndReturn(10 * 1024 * 1024 * 1024) # another is qcow image, so qemu-img should be mocked. self.mox.StubOutWithMock(utils, "execute") - utils.execute('sudo', 'qemu-img', 'info', '/test/disk.local').\ + utils.execute('qemu-img', 'info', '/test/disk.local').\ AndReturn((ret, '')) self.mox.ReplayAll() diff --git a/nova/virt/disk.py b/nova/virt/disk.py index 52b2881e8..e6cf5f5c4 100644 --- a/nova/virt/disk.py +++ b/nova/virt/disk.py @@ -228,8 +228,8 @@ def _inject_metadata_into_fs(metadata, fs, execute=None): metadata_path = os.path.join(fs, "meta.js") metadata = dict([(m.key, m.value) for m in metadata]) - utils.execute('sudo', 'tee', metadata_path, - process_input=json.dumps(metadata)) + utils.execute('tee', metadata_path, + process_input=json.dumps(metadata), run_as_root=True) def _inject_key_into_fs(key, fs, execute=None): |
