Fix for module level import not at top of file
Change-Id: I1994b58a027cdac3bf4084b77db61bc646aaaba6
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/ffdc/collect_ffdc.py b/ffdc/collect_ffdc.py
index c1c9495..ca232f1 100644
--- a/ffdc/collect_ffdc.py
+++ b/ffdc/collect_ffdc.py
@@ -4,6 +4,8 @@
CLI FFDC Collector.
"""
+from ffdc_collector import ffdc_collector
+
import os
import sys
import click
@@ -12,14 +14,13 @@
# Absolute path to openbmc-test-automation/ffdc
abs_path = os.path.abspath(os.path.dirname(sys.argv[0]))
full_path = abs_path.split('ffdc')[0]
+
sys.path.append(full_path)
# Walk path and append to sys.path
for root, dirs, files in os.walk(full_path):
for found_dir in dirs:
sys.path.append(os.path.join(root, found_dir))
-from ffdc_collector import ffdc_collector
-
@click.command(context_settings=dict(help_option_names=['-h', '--help']))
@click.option('-r', '--remote',
diff --git a/ffdc/ffdc_collector.py b/ffdc/ffdc_collector.py
index 27b088c..9afd0ad 100644
--- a/ffdc/ffdc_collector.py
+++ b/ffdc/ffdc_collector.py
@@ -4,6 +4,10 @@
See class prolog below for details.
"""
+from ssh_utility import SSHRemoteclient
+from telnet_utility import TelnetRemoteclient
+from errno import EACCES, EPERM
+
import os
import re
import sys
@@ -12,7 +16,6 @@
import time
import logging
import platform
-from errno import EACCES, EPERM
import subprocess
script_dir = os.path.dirname(os.path.abspath(__file__))
@@ -22,8 +25,6 @@
for dir in dirs:
sys.path.append(os.path.join(root, dir))
-from ssh_utility import SSHRemoteclient
-from telnet_utility import TelnetRemoteclient
r"""
User define plugins python functions.
diff --git a/ffdc/plugins/scp_execution.py b/ffdc/plugins/scp_execution.py
index 0aca54c..9754c02 100644
--- a/ffdc/plugins/scp_execution.py
+++ b/ffdc/plugins/scp_execution.py
@@ -1,23 +1,25 @@
#!/usr/bin/env python3
+# ssh_utility is in ../lib
+from ssh_utility import SSHRemoteclient
+
import os
import sys
# ---------Set sys.path for pluqin execution---------------------------------------
# Absolute path to this plugin
abs_path = os.path.abspath(os.path.dirname(sys.argv[0]))
+
# full_path to plugins parent directory
full_path = abs_path.split('plugins')[0]
sys.path.append(full_path)
+
# Walk path and append to sys.path
for root, dirs, files in os.walk(full_path):
for found_dir in dirs:
sys.path.append(os.path.join(root, found_dir))
-# ssh_utility is in ../lib
-from ssh_utility import SSHRemoteclient
-
def scp_remote_file(hostname,
username,
diff --git a/ffdc/plugins/ssh_execution.py b/ffdc/plugins/ssh_execution.py
index 087d887..db06596 100644
--- a/ffdc/plugins/ssh_execution.py
+++ b/ffdc/plugins/ssh_execution.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
+from ssh_utility import SSHRemoteclient
+
import os
import sys
@@ -16,7 +18,6 @@
sys.path.append(os.path.join(root, found_dir))
# ssh_utility is in ../lib
-from ssh_utility import SSHRemoteclient
def ssh_execute_cmd(hostname,
diff --git a/ffdc/plugins/telnet_execution.py b/ffdc/plugins/telnet_execution.py
index 7cfd78b..726d3a6 100644
--- a/ffdc/plugins/telnet_execution.py
+++ b/ffdc/plugins/telnet_execution.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
+from telnet_utility import TelnetRemoteclient
+
import os
import sys
@@ -15,8 +17,6 @@
for found_dir in dirs:
sys.path.append(os.path.join(root, found_dir))
-from telnet_utility import TelnetRemoteclient
-
def telnet_execute_cmd(hostname,
username,