diff options
| author | Dan Prince <dprince@redhat.com> | 2012-08-04 15:19:19 -0400 |
|---|---|---|
| committer | Dan Prince <dprince@redhat.com> | 2012-08-06 09:47:59 -0400 |
| commit | 57d680ff5295f8f2bc223627eee2f7f75e368d74 (patch) | |
| tree | c751a263e8f71bec1962b7f8df65cb2f25428a46 /nova | |
| parent | 51002f0d0f85f077bbbfed1d151df59240775ff8 (diff) | |
| download | nova-57d680ff5295f8f2bc223627eee2f7f75e368d74.tar.gz nova-57d680ff5295f8f2bc223627eee2f7f75e368d74.tar.xz nova-57d680ff5295f8f2bc223627eee2f7f75e368d74.zip | |
Move root_helper deprecation warning into execute.
By moving this warning into the execute function and out of the top
level utils module we eliminate warnings that could occur when
Nova code includes utils.py but doesn't setup a config file properly.
Fixes LP Bug #1032657.
Change-Id: Iae41ead251a64717de3bf7cba3fa206cda278a20
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/utils.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/nova/utils.py b/nova/utils.py index 19e5ef827..75085bf32 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -65,12 +65,6 @@ FLAGS.register_opt( cfg.BoolOpt('disable_process_locking', default=False, help='Whether to disable inter-process locks')) -if FLAGS.rootwrap_config is None or FLAGS.root_helper != 'sudo': - deprecated.warn(_('The root_helper option (which lets you specify a ' - 'root wrapper different from nova-rootwrap, and ' - 'defaults to using sudo) is now deprecated. You ' - 'should use the rootwrap_config option instead.')) - def vpn_ping(address, port, timeout=0.05, session_id=None): """Sends a vpn negotiation packet and returns the server session. @@ -146,7 +140,6 @@ def execute(*cmd, **kwargs): :returns: a tuple, (stdout, stderr) from the spawned process, or None if the command fails. """ - process_input = kwargs.pop('process_input', None) check_exit_code = kwargs.pop('check_exit_code', [0]) ignore_exit_code = False @@ -165,6 +158,14 @@ def execute(*cmd, **kwargs): 'to utils.execute: %r') % kwargs) if run_as_root: + + if FLAGS.rootwrap_config is None or FLAGS.root_helper != 'sudo': + deprecated.warn(_('The root_helper option (which lets you specify ' + 'a root wrapper different from nova-rootwrap, ' + 'and defaults to using sudo) is now deprecated. ' + 'You should use the rootwrap_config option ' + 'instead.')) + if (FLAGS.rootwrap_config is not None): cmd = ['sudo', 'nova-rootwrap', FLAGS.rootwrap_config] + list(cmd) else: |
