Add plugin shell execution script
Change-Id: Ie2444c332e54956c547e74fa71da5a9465c0f8c8
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/ffdc/plugins/shell_execution.py b/ffdc/plugins/shell_execution.py
new file mode 100644
index 0000000..817dc1e
--- /dev/null
+++ b/ffdc/plugins/shell_execution.py
@@ -0,0 +1,23 @@
+import subprocess
+
+
+def execute_cmd(parms_string, quiet=False):
+ r"""
+ Run CLI standard tool or scripts.
+
+ Description of variable:
+ parms_string Command to execute from the current SHELL.
+ quiet do not print tool error message if True
+ """
+
+ result = subprocess.run([parms_string],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True,
+ universal_newlines=True)
+
+ if result.stderr and not quiet:
+ print('\n\t\tERROR with %s ' % parms_string)
+ print('\t\t' + result.stderr)
+
+ return result.stdout