Remove halt on error from all inheritors of realm

Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
Matthew Stidham
2021-03-17 14:26:06 -07:00
parent 7bede86c9e
commit 519cd785cb
4 changed files with 11 additions and 23 deletions

View File

@@ -30,7 +30,6 @@ class LFCliBase:
# very confused.
def __init__(self, _lfjson_host, _lfjson_port,
_debug=False,
_halt_on_error=False,
_exit_on_error=False,
_exit_on_fail=False,
_local_realm=None,
@@ -53,7 +52,6 @@ class LFCliBase:
# print("LFCliBase._proxy_str: %s" % _proxy_str)
self.lfclient_url = "http://%s:%s" % (self.lfclient_host, self.lfclient_port)
self.test_results = []
self.halt_on_error = _halt_on_error
self.exit_on_error = _exit_on_error
self.exit_on_fail = _exit_on_fail
self.capture_signals = _capture_signal_list
@@ -211,12 +209,12 @@ class LFCliBase:
if debug_ and (response_json_list_ is not None):
pprint.pprint(response_json_list_)
except Exception as x:
if debug_ or self.halt_on_error or self.exit_on_error:
if debug_ or self.exit_on_error:
print("json_post posted to %s" % _req_url)
pprint.pprint(_data)
print("Exception %s:" % x)
traceback.print_exception(Exception, x, x.__traceback__, chain=True)
if self.halt_on_error or self.exit_on_error:
if self.exit_on_error:
exit(1)
return json_response
@@ -249,12 +247,12 @@ class LFCliBase:
if debug_ and (response_json_list_ is not None):
pprint.pprint(response_json_list_)
except Exception as x:
if debug_ or self.halt_on_error or self.exit_on_error:
if debug_ or self.exit_on_error:
print("json_put submitted to %s" % _req_url)
pprint.pprint(_data)
print("Exception %s:" % x)
traceback.print_exception(Exception, x, x.__traceback__, chain=True)
if self.halt_on_error or self.exit_on_error:
if self.exit_on_error:
exit(1)
return json_response
@@ -272,17 +270,17 @@ class LFCliBase:
proxies_=self.proxy,
debug_=debug_,
die_on_error_=self.exit_on_error)
json_response = lf_r.get_as_json(debug_=debug_, die_on_error_=self.halt_on_error)
json_response = lf_r.get_as_json(debug_=debug_, die_on_error_=False)
#debug_printer.pprint(json_response)
if (json_response is None) and debug_:
print("LFCliBase.json_get: no entity/response, probabily status 404")
return None
except ValueError as ve:
if debug_ or self.halt_on_error or self.exit_on_error:
if debug_ or self.exit_on_error:
print("jsonGet asked for " + _req_url)
print("Exception %s:" % ve)
traceback.print_exception(ValueError, ve, ve.__traceback__, chain=True)
if self.halt_on_error or self.exit_on_error:
if self.exit_on_error:
sys.exit(1)
return json_response
@@ -299,18 +297,18 @@ class LFCliBase:
proxies_=self.proxy,
debug_=debug_,
die_on_error_=self.exit_on_error)
json_response = lf_r.json_delete(debug=debug_, die_on_error_=self.halt_on_error)
json_response = lf_r.json_delete(debug=debug_, die_on_error_=False)
print(json_response)
#debug_printer.pprint(json_response)
if (json_response is None) and debug_:
print("LFCliBase.json_delete: no entity/response, probabily status 404")
return None
except ValueError as ve:
if debug_ or self.halt_on_error or self.exit_on_error:
if debug_ or self.exit_on_error:
print("json_delete asked for " + _req_url)
print("Exception %s:" % ve)
traceback.print_exception(ValueError, ve, ve.__traceback__, chain=True)
if self.halt_on_error or self.exit_on_error:
if self.exit_on_error:
sys.exit(1)
# print("----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ")
return json_response
@@ -350,11 +348,6 @@ class LFCliBase:
# print("lfcli_base error: %s" % exception)
pprint.pprint(exception)
traceback.print_exception(Exception, exception, exception.__traceback__, chain=True)
if self.halt_on_error:
print("halting on error")
sys.exit(1)
# else:
# print("continuing...")
def check_connect(self):
if self.debug:

View File

@@ -29,7 +29,6 @@ import csv
class LFDataCollection:
def __init__(self, local_realm, debug=False):
self.parent_realm = local_realm
self.halt_on_error = False
self.exit_on_error = False
self.debug = debug or local_realm.debug

View File

@@ -31,7 +31,6 @@ class CreateQVlan(Realm):
gateway=None,
port_list=[],
ip_list=[],
halt_on_error=False,
exit_on_error=False,
debug=False):
super().__init__(host, port)
@@ -41,7 +40,6 @@ class CreateQVlan(Realm):
self.debug = debug
self.port_list = port_list
self.ip_list = ip_list
self.halt_on_error = halt_on_error
self.exit_on_error = exit_on_error
self.qvlan_profile = self.new_qvlan_profile()

View File

@@ -23,7 +23,7 @@ class TestStatusMessage(LFCliBase):
_debug_on=False,
_exit_on_error=False,
_exit_on_fail=False):
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
super().__init__(host, port, _debug=_debug_on, _exit_on_fail=_exit_on_fail)
self.deep_clean = _deep_clean
self.check_connect()
@@ -167,7 +167,6 @@ class TestStatusMessage(LFCliBase):
if self.debug:
print("--- del -------------------- -------------------- --------------------")
self.exit_on_error=False
self.halt_on_error=False
message_response = self.json_delete(self.session_url, debug_=False)
if self.debug:
print("--- ~del -------------------- -------------------- --------------------")
@@ -195,7 +194,6 @@ class TestStatusMessage(LFCliBase):
if self.debug:
print("--- del -------------------- -------------------- --------------------")
self.exit_on_error=False
self.halt_on_error=False
message_response = self.json_delete(self.session_url+"/this", debug_=False)
if self.debug:
print("--- ~del -------------------- -------------------- --------------------")