ffdc: Add checking for scp get_transport error.
When there is an error on scp get_transport,
- Inform user of the error.
- Continue FFDC generation on remote host.
- Inform user to manually offload data.
Test:
- Run OK scenarios.
- Run SCPException and SocketException scenarios.
Signed-off-by: Peter D Phan <peterp@us.ibm.com>
Change-Id: I606bc9530fb1f4b1b1bbe75c5797337f0bd76f2a
diff --git a/ffdc/ffdc_collector.py b/ffdc/ffdc_collector.py
index 3e4f788..5b84106 100644
--- a/ffdc/ffdc_collector.py
+++ b/ffdc/ffdc_collector.py
@@ -120,6 +120,11 @@
self.remoteclient.ssh_remoteclient_login()
print("\n\t[Check] %s SSH connection established.\t [OK]" % self.hostname)
+
+ # Check scp connection.
+ # If scp connection fails,
+ # continue with FFDC generation but skip scp files to local host.
+ self.remoteclient.scp_connection()
return True
def generate_ffdc(self, working_protocol_list):
@@ -146,15 +151,18 @@
self.remoteclient.execute_command(command)
progress_counter += 1
self.print_progress(progress_counter)
- print("\n\t[Run] Commands execution completed \t\t [OK]")
+ print("\n\t[Run] Commands execution completed.\t\t [OK]")
- print("\n\n\tCopying FFDC files from remote system %s \n\n" % self.hostname)
- # Get default values for scp action.
- # self.location == local system for now
- self.set_ffdc_defaults()
- # Retrieving files from target system
- list_of_files = ffdc_actions[machine_type]['FILES']
- self.scp_ffdc(self.ffdc_dir_path, self.ffdc_prefix, list_of_files)
+ if self.remoteclient.scpclient:
+ print("\n\n\tCopying FFDC files from remote system %s.\n" % self.hostname)
+ # Get default values for scp action.
+ # self.location == local system for now
+ self.set_ffdc_defaults()
+ # Retrieving files from target system
+ list_of_files = ffdc_actions[machine_type]['FILES']
+ self.scp_ffdc(self.ffdc_dir_path, self.ffdc_prefix, list_of_files)
+ else:
+ print("\n\n\tSkip copying FFDC files from remote system %s.\n" % self.hostname)
else:
print("\n\tProtocol %s is not yet supported by this script.\n"
% ffdc_actions[machine_type]['PROTOCOL'][0])
@@ -175,8 +183,6 @@
"""
- self.remoteclient.scp_connection()
-
self.receive_file_list = []
progress_counter = 0
for filename in file_list: