summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Percoco <flaper87@gmail.com>2014-07-02 16:46:46 +0200
committerFlavio Percoco <flaper87@gmail.com>2014-07-02 17:43:49 +0200
commitd6b55fb202a3495aaa281ac522d8afedaeb89ec8 (patch)
treefe646e4586c69549e065bd88ccc297b73dc3ec89
parentcb5a804bd4692e647fb49727d8929db5c8d75aa2 (diff)
downloadoslo-incubator-d6b55fb202a3495aaa281ac522d8afedaeb89ec8.tar.gz
Remove `processutils` dependency on `log`
Currently, the processutils module depends on openstack.common.log. This patch proposes to remove this dependency and use the standard library logging module instead. The downside of this patch is that it removes the dependency on the log module but adds a new dependency on the strutils module because of the `mask_password` call. Change-Id: I245750f9f397a231891514f6ed1ea9626513cbbb
-rw-r--r--openstack/common/processutils.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/openstack/common/processutils.py b/openstack/common/processutils.py
index 22006562..8a2a53b2 100644
--- a/openstack/common/processutils.py
+++ b/openstack/common/processutils.py
@@ -18,7 +18,7 @@ System-level utilities and helper functions.
"""
import errno
-import logging as stdlib_logging
+import logging
import multiprocessing
import os
import random
@@ -30,7 +30,7 @@ from eventlet import greenthread
import six
from openstack.common.gettextutils import _
-from openstack.common import log as logging
+from openstack.common import strutils
LOG = logging.getLogger(__name__)
@@ -115,8 +115,7 @@ def execute(*cmd, **kwargs):
execute this command. Defaults to false.
:type shell: boolean
:param loglevel: log level for execute commands.
- :type loglevel: int. (Should be stdlib_logging.DEBUG or
- stdlib_logging.INFO)
+ :type loglevel: int. (Should be logging.DEBUG or logging.INFO)
:returns: (stdout, stderr) from process execution
:raises: :class:`UnknownArgumentError` on
receiving unknown arguments
@@ -132,7 +131,7 @@ def execute(*cmd, **kwargs):
run_as_root = kwargs.pop('run_as_root', False)
root_helper = kwargs.pop('root_helper', '')
shell = kwargs.pop('shell', False)
- loglevel = kwargs.pop('loglevel', stdlib_logging.DEBUG)
+ loglevel = kwargs.pop('loglevel', logging.DEBUG)
if isinstance(check_exit_code, bool):
ignore_exit_code = not check_exit_code
@@ -157,7 +156,7 @@ def execute(*cmd, **kwargs):
attempts -= 1
try:
LOG.log(loglevel, 'Running cmd (subprocess): %s',
- logging.mask_password(' '.join(cmd)))
+ strutils.mask_password(' '.join(cmd)))
_PIPE = subprocess.PIPE # pylint: disable=E1101
if os.name == 'nt':