Skip to content

Commit

Permalink
Merge "Prefix utils.get_root_helper with underscore"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Oct 3, 2013
2 parents f4ea7fa + 8d94d65 commit 26f6b9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions nova/tests/virt/test_virt_disk_vfs_localfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_makepath(self):
self.assertEqual(dirs,
["/scratch/dir/some/dir", "/scratch/dir/other/dir"]),

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/dir'),
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_append_file(self):
self.assertEquals(files["/scratch/dir/some/file"]["content"],
"Hello World Goodbye")

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/file'),
Expand All @@ -226,7 +226,7 @@ def test_replace_file(self):
self.assertEquals(files["/scratch/dir/some/file"]["content"],
"Goodbye")

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/file'),
Expand All @@ -247,7 +247,7 @@ def test_read_file(self):
vfs.imgdir = "/scratch/dir"
self.assertEqual(vfs.read_file("/some/file"), "Hello World")

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/file'),
Expand All @@ -270,7 +270,7 @@ def test_has_file(self):
self.assertTrue(vfs.has_file("/some/file"))
self.assertFalse(vfs.has_file("/other/file"))

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/file'),
Expand Down Expand Up @@ -310,7 +310,7 @@ def test_set_permissions(self):
vfs.set_permissions("/some/file", 0o777)
self.assertEquals(files["/scratch/dir/some/file"]["mode"], 0o777)

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/file'),
Expand Down Expand Up @@ -353,7 +353,7 @@ def test_set_ownership(self):
self.assertEquals(files["/scratch/dir/some/file"]["uid"], 110)
self.assertEquals(files["/scratch/dir/some/file"]["gid"], 600)

root_helper = nova.utils.get_root_helper()
root_helper = nova.utils._get_root_helper()
self.assertEqual(commands,
[{'args': ('readlink', '-nm',
'/scratch/dir/some/file'),
Expand Down
6 changes: 3 additions & 3 deletions nova/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ def vpn_ping(address, port, timeout=0.05, session_id=None):
return server_sess


def get_root_helper():
def _get_root_helper():
return 'sudo nova-rootwrap %s' % CONF.rootwrap_config


def execute(*cmd, **kwargs):
"""Convenience wrapper around oslo's execute() method."""
if 'run_as_root' in kwargs and not 'root_helper' in kwargs:
kwargs['root_helper'] = get_root_helper()
kwargs['root_helper'] = _get_root_helper()
return processutils.execute(*cmd, **kwargs)


def trycmd(*args, **kwargs):
"""Convenience wrapper around oslo's trycmd() method."""
if 'run_as_root' in kwargs and not 'root_helper' in kwargs:
kwargs['root_helper'] = get_root_helper()
kwargs['root_helper'] = _get_root_helper()
return processutils.trycmd(*args, **kwargs)


Expand Down

0 comments on commit 26f6b9d

Please sign in to comment.