Skip to content

Commit

Permalink
Merge pull request #60 from Jainpriyal/master
Browse files Browse the repository at this point in the history
adding error/warning messages in log file and console
  • Loading branch information
vnitinv committed Mar 16, 2016
2 parents cd19c83 + 316ba8f commit 82e692d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/jnpr/jsnapy/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ def run_cmd(self, test_file, t, formats, dev, output_file, hostname, db):
cmd_name,
cmd_format,
output_file)
self.logger_snap.error(colorama.Fore.RED +
"ERROR occurred %s" %
str(sys.exc_info()[0]), extra=self.log_detail)
self.logger_snap.error(colorama.Fore.RED +
"\n**********Complete error message***********\n %s" %
str(sys.exc_info()), extra=self.log_detail)
return
except Exception:
self.logger_snap.error(colorama.Fore.RED +
Expand Down Expand Up @@ -258,6 +264,13 @@ def run_rpc(self, test_file, t, formats, dev, output_file, hostname, db):
rpc,
reply_format,
output_file)
self.logger_snap.error(colorama.Fore.RED +
"ERROR occurred:\n %s" %
str(sys.exc_info()[0]), extra=self.log_detail)
self.logger_snap.error(colorama.Fore.RED +
"\n**********Complete error message***********\n%s" %
str(sys.exc_info()), extra=self.log_detail)

return
except Exception:
self.logger_snap.error(colorama.Fore.RED +
Expand Down Expand Up @@ -300,6 +313,12 @@ def run_rpc(self, test_file, t, formats, dev, output_file, hostname, db):
rpc,
reply_format,
output_file)
self.logger_snap.error(colorama.Fore.RED +
"ERROR occurred: \n%s" %
str(sys.exc_info()[0]), extra=self.log_detail)
self.logger_snap.error(colorama.Fore.RED +
"\n**********Complete error message***********\n%s" %
str(sys.exc_info()), extra=self.log_detail)
return
except Exception:
self.logger_snap.error(colorama.Fore.RED +
Expand Down
1 change: 1 addition & 0 deletions lib/jnpr/jsnapy/testop.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def not_exists(self, x_path, ele_list, err_mssg, info_mssg,
tresult = {}
tresult['xpath'] = x_path
tresult['testoperation'] = "not-exists"
tresult['actual_node_value'] = []
try:
element = ele_list[0]
except IndexError as e:
Expand Down

0 comments on commit 82e692d

Please sign in to comment.