summaryrefslogtreecommitdiff
path: root/ironic_python_agent/utils.py
diff options
context:
space:
mode:
authorRiccardo Pittau <elfosardo@gmail.com>2021-02-25 14:20:59 +0100
committerRiccardo Pittau <elfosardo@gmail.com>2021-02-25 14:46:17 +0100
commit0459c61c8d24c3b7fe950a4d533ed4192448c52e (patch)
tree371f50222f1e3906498e9ac1e8df403cf5894d66 /ironic_python_agent/utils.py
parent6ea3aff8d6170531510d4ab121b22272240e2a26 (diff)
downloadironic-python-agent-0459c61c8d24c3b7fe950a4d533ed4192448c52e.tar.gz
Use try_execute from ironic-lib
Also adapt unit tests Change-Id: I37d050877daabc9dc0a5821cf20a689652b26f34
Diffstat (limited to 'ironic_python_agent/utils.py')
-rw-r--r--ironic_python_agent/utils.py20
1 files changed, 0 insertions, 20 deletions
diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py
index a5da83d6..7ae827aa 100644
--- a/ironic_python_agent/utils.py
+++ b/ironic_python_agent/utils.py
@@ -88,26 +88,6 @@ def execute(*cmd, **kwargs):
return ironic_utils.execute(*cmd, **kwargs)
-def try_execute(*cmd, **kwargs):
- """The same as execute but returns None on error.
-
- Executes and logs results from a system command. See docs for
- oslo_concurrency.processutils.execute for usage.
-
- Instead of raising an exception on failure, this method simply
- returns None in case of failure.
-
- :param cmd: positional arguments to pass to processutils.execute()
- :param kwargs: keyword arguments to pass to processutils.execute()
- :raises: UnknownArgumentError on receiving unknown arguments
- :returns: tuple of (stdout, stderr) or None in some error cases
- """
- try:
- return execute(*cmd, **kwargs)
- except (processutils.ProcessExecutionError, OSError) as e:
- LOG.debug('Command failed: %s', e)
-
-
def _read_params_from_file(filepath):
"""Extract key=value pairs from a file.