diff options
author | tomsou <soth@intracom-telecom.com> | 2017-07-24 14:02:00 +0000 |
---|---|---|
committer | tomsou <soth@intracom-telecom.com> | 2017-07-24 14:17:31 +0000 |
commit | 7abb51066dc537f1277eef243539a5b511d3e3cd (patch) | |
tree | f8f5b962584a6070670df371b453fbffa854da48 | |
parent | 38d1895faf9aaeefa6b64df6f4d149a00884b09b (diff) |
Fix log gathering functionality
Some fixes on https://gerrit.opnfv.org/gerrit/#/c/37261/
JIRA: SDNVPN-170
Change-Id: I2f396f509181b45bfccb76fbfd904d7591000df9
Signed-off-by: tomsou <soth@intracom-telecom.com>
-rw-r--r-- | sdnvpn/lib/gather_logs.py | 2 | ||||
-rwxr-xr-x | sdnvpn/sh_utils/fetch-log-script.sh | 17 | ||||
-rw-r--r-- | sdnvpn/test/functest/run_tests.py | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/sdnvpn/lib/gather_logs.py b/sdnvpn/lib/gather_logs.py index cf84f43..9afa077 100644 --- a/sdnvpn/lib/gather_logs.py +++ b/sdnvpn/lib/gather_logs.py @@ -45,7 +45,7 @@ def gather_logs(name): % node.get_dict()['name']) ft_utils.execute_command_raise('cd %s;tar czvf sdnvpn-logs-%s.tar.gz' - '-C /tmp/ sdnvpn-logs/' + ' sdnvpn-logs/' % (CONST.__getattribute__('dir_results'), name)) diff --git a/sdnvpn/sh_utils/fetch-log-script.sh b/sdnvpn/sh_utils/fetch-log-script.sh index 8e825d0..c3c037d 100755 --- a/sdnvpn/sh_utils/fetch-log-script.sh +++ b/sdnvpn/sh_utils/fetch-log-script.sh @@ -1,7 +1,7 @@ #!/bin/bash ### Configuration Required -set -e +# set -e tmp_folder=/tmp/opnfv-logs-$HOSTNAME/ rm -rf $tmp_folder @@ -80,6 +80,9 @@ log_command_exec(){ echo "$cmd" >> $file echo "==========================================================" >> $file $cmd 2>&1 >> $file + if [ "$?" -ne "0" ]; then + echo "Something went wrong with log gathering" + fi } flows() @@ -94,10 +97,13 @@ flows() node(){ node=$tmp_folder/$HOSTNAME.txt log_command_exec "$node" ifconfig -a - files_folders=( /opt/opendaylight/data/log/ /var/log/openvswitch/ /var/log/neutron/) + files_folders=( /opt/opendaylight/data/log/ /var/log/openvswitch/ /var/log/neutron/ /var/log/nova/) for ((i = 0; i < ${#files_folders[@]};i++));do if [ -e ${files_folders[$i]} ];then cp -r ${files_folders[$i]} $tmp_folder/ + if [ "$?" -ne "0" ]; then + echo "Something went wrong with log tranferring from nodes" + fi fi done # not all messages only tail the last 10k lines @@ -110,6 +116,9 @@ _curl_data_store(){ touch $file echo "============================= $url ======================" >> $file curl --silent -u admin:admin -X GET http://$odl_ip_port/$url | python -mjson.tool 2>&1 >> $file + if [ "$?" -ne "0" ]; then + echo "Something went wrong while reading from datastore" + fi } _get_output_karaf(){ @@ -118,7 +127,9 @@ _get_output_karaf(){ shift echo "============================ KARAF $@ ===================" >> $file sshpass -p karaf ssh -p 8101 -o "StrictHostKeyChecking no" karaf@localhost "$@" 2>&1 >> $file - + if [ "$?" -ne "0" ]; then + echo "Something went wrong with log gathering from karaf" + fi } datastore() { diff --git a/sdnvpn/test/functest/run_tests.py b/sdnvpn/test/functest/run_tests.py index 1bffe67..e671264 100644 --- a/sdnvpn/test/functest/run_tests.py +++ b/sdnvpn/test/functest/run_tests.py @@ -97,7 +97,7 @@ def main(report=False): gather_logs('overall') except Exception as ex: logger.error(('Something went wrong in the Log gathering.' - 'Ex: Trace: %s') + 'Ex: %s, Trace: %s') % ex, traceback.format_exc()) if overall_status == "FAIL": sys.exit(-1) |