nova.utils._get_root_helper() should be public

The nova.utils._get_root_helper() method is used outside of the
nova.utils module, so we should make it public.
Change the method to nova.utils.get_root_helper()

Change-Id: I63273aa3115502d2cd049c99b2176a7eca0d2f4c
Closes-Bug: #1479345
This commit is contained in:
Shuquan Huang
2015-07-30 09:35:44 +00:00
parent c19afe335d
commit 2ba59055f1

View File

@@ -239,7 +239,7 @@ def vpn_ping(address, port, timeout=0.05, session_id=None):
return (identifier == 0x40 and client_sess == session_id)
def _get_root_helper():
def get_root_helper():
if CONF.workarounds.disable_rootwrap:
cmd = 'sudo'
else:
@@ -250,7 +250,7 @@ def _get_root_helper():
def execute(*cmd, **kwargs):
"""Convenience wrapper around oslo's execute() method."""
if 'run_as_root' in kwargs and 'root_helper' not in kwargs:
kwargs['root_helper'] = _get_root_helper()
kwargs['root_helper'] = get_root_helper()
return processutils.execute(*cmd, **kwargs)
@@ -265,7 +265,7 @@ def ssh_execute(dest, *cmd, **kwargs):
def trycmd(*args, **kwargs):
"""Convenience wrapper around oslo's trycmd() method."""
if 'run_as_root' in kwargs and 'root_helper' not in kwargs:
kwargs['root_helper'] = _get_root_helper()
kwargs['root_helper'] = get_root_helper()
return processutils.trycmd(*args, **kwargs)