mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 10:48:02 +00:00 
			
		
		
		
	Remove halt on error from all inheritors of realm
Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
		| @@ -30,7 +30,6 @@ class LFCliBase: | |||||||
|     # very confused. |     # very confused. | ||||||
|     def __init__(self, _lfjson_host, _lfjson_port, |     def __init__(self, _lfjson_host, _lfjson_port, | ||||||
|                  _debug=False, |                  _debug=False, | ||||||
|                  _halt_on_error=False, |  | ||||||
|                  _exit_on_error=False, |                  _exit_on_error=False, | ||||||
|                  _exit_on_fail=False, |                  _exit_on_fail=False, | ||||||
|                  _local_realm=None, |                  _local_realm=None, | ||||||
| @@ -53,7 +52,6 @@ class LFCliBase: | |||||||
|         #     print("LFCliBase._proxy_str: %s" % _proxy_str) |         #     print("LFCliBase._proxy_str: %s" % _proxy_str) | ||||||
|         self.lfclient_url = "http://%s:%s" % (self.lfclient_host, self.lfclient_port) |         self.lfclient_url = "http://%s:%s" % (self.lfclient_host, self.lfclient_port) | ||||||
|         self.test_results = [] |         self.test_results = [] | ||||||
|         self.halt_on_error = _halt_on_error |  | ||||||
|         self.exit_on_error = _exit_on_error |         self.exit_on_error = _exit_on_error | ||||||
|         self.exit_on_fail = _exit_on_fail |         self.exit_on_fail = _exit_on_fail | ||||||
|         self.capture_signals = _capture_signal_list |         self.capture_signals = _capture_signal_list | ||||||
| @@ -211,12 +209,12 @@ class LFCliBase: | |||||||
|             if debug_ and (response_json_list_ is not None): |             if debug_ and (response_json_list_ is not None): | ||||||
|                 pprint.pprint(response_json_list_) |                 pprint.pprint(response_json_list_) | ||||||
|         except Exception as x: |         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) |                 print("json_post posted to %s" % _req_url) | ||||||
|                 pprint.pprint(_data) |                 pprint.pprint(_data) | ||||||
|                 print("Exception %s:" % x) |                 print("Exception %s:" % x) | ||||||
|                 traceback.print_exception(Exception, x, x.__traceback__, chain=True) |                 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) |                 exit(1) | ||||||
|         return json_response |         return json_response | ||||||
|  |  | ||||||
| @@ -249,12 +247,12 @@ class LFCliBase: | |||||||
|             if debug_ and (response_json_list_ is not None): |             if debug_ and (response_json_list_ is not None): | ||||||
|                 pprint.pprint(response_json_list_) |                 pprint.pprint(response_json_list_) | ||||||
|         except Exception as x: |         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) |                 print("json_put submitted to %s" % _req_url) | ||||||
|                 pprint.pprint(_data) |                 pprint.pprint(_data) | ||||||
|                 print("Exception %s:" % x) |                 print("Exception %s:" % x) | ||||||
|                 traceback.print_exception(Exception, x, x.__traceback__, chain=True) |                 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) |                 exit(1) | ||||||
|         return json_response |         return json_response | ||||||
|  |  | ||||||
| @@ -272,17 +270,17 @@ class LFCliBase: | |||||||
|                                        proxies_=self.proxy, |                                        proxies_=self.proxy, | ||||||
|                                        debug_=debug_, |                                        debug_=debug_, | ||||||
|                                        die_on_error_=self.exit_on_error) |                                        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) |             #debug_printer.pprint(json_response) | ||||||
|             if (json_response is None) and debug_: |             if (json_response is None) and debug_: | ||||||
|                 print("LFCliBase.json_get: no entity/response, probabily status 404") |                 print("LFCliBase.json_get: no entity/response, probabily status 404") | ||||||
|                 return None |                 return None | ||||||
|         except ValueError as ve: |         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("jsonGet asked for " + _req_url) | ||||||
|                 print("Exception %s:" % ve) |                 print("Exception %s:" % ve) | ||||||
|                 traceback.print_exception(ValueError, ve, ve.__traceback__, chain=True) |                 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) |                 sys.exit(1) | ||||||
|  |  | ||||||
|         return json_response |         return json_response | ||||||
| @@ -299,18 +297,18 @@ class LFCliBase: | |||||||
|                                        proxies_=self.proxy, |                                        proxies_=self.proxy, | ||||||
|                                        debug_=debug_, |                                        debug_=debug_, | ||||||
|                                        die_on_error_=self.exit_on_error) |                                        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) |             print(json_response) | ||||||
|             #debug_printer.pprint(json_response) |             #debug_printer.pprint(json_response) | ||||||
|             if (json_response is None) and debug_: |             if (json_response is None) and debug_: | ||||||
|                 print("LFCliBase.json_delete: no entity/response, probabily status 404") |                 print("LFCliBase.json_delete: no entity/response, probabily status 404") | ||||||
|                 return None |                 return None | ||||||
|         except ValueError as ve: |         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("json_delete asked for " + _req_url) | ||||||
|                 print("Exception %s:" % ve) |                 print("Exception %s:" % ve) | ||||||
|                 traceback.print_exception(ValueError, ve, ve.__traceback__, chain=True) |                 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) |                 sys.exit(1) | ||||||
|         # print("----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ") |         # print("----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ") | ||||||
|         return json_response |         return json_response | ||||||
| @@ -350,11 +348,6 @@ class LFCliBase: | |||||||
|         # print("lfcli_base error: %s" % exception) |         # print("lfcli_base error: %s" % exception) | ||||||
|         pprint.pprint(exception) |         pprint.pprint(exception) | ||||||
|         traceback.print_exception(Exception, exception, exception.__traceback__, chain=True) |         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): |     def check_connect(self): | ||||||
|         if self.debug: |         if self.debug: | ||||||
|   | |||||||
| @@ -29,7 +29,6 @@ import csv | |||||||
| class LFDataCollection: | class LFDataCollection: | ||||||
|     def __init__(self, local_realm, debug=False): |     def __init__(self, local_realm, debug=False): | ||||||
|         self.parent_realm = local_realm |         self.parent_realm = local_realm | ||||||
|         self.halt_on_error = False |  | ||||||
|         self.exit_on_error = False |         self.exit_on_error = False | ||||||
|         self.debug = debug or local_realm.debug |         self.debug = debug or local_realm.debug | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,7 +31,6 @@ class CreateQVlan(Realm): | |||||||
|                  gateway=None, |                  gateway=None, | ||||||
|                  port_list=[], |                  port_list=[], | ||||||
|                  ip_list=[], |                  ip_list=[], | ||||||
|                  halt_on_error=False, |  | ||||||
|                  exit_on_error=False, |                  exit_on_error=False, | ||||||
|                  debug=False): |                  debug=False): | ||||||
|         super().__init__(host, port) |         super().__init__(host, port) | ||||||
| @@ -41,7 +40,6 @@ class CreateQVlan(Realm): | |||||||
|         self.debug = debug |         self.debug = debug | ||||||
|         self.port_list = port_list |         self.port_list = port_list | ||||||
|         self.ip_list = ip_list |         self.ip_list = ip_list | ||||||
|         self.halt_on_error = halt_on_error |  | ||||||
|         self.exit_on_error = exit_on_error |         self.exit_on_error = exit_on_error | ||||||
|  |  | ||||||
|         self.qvlan_profile = self.new_qvlan_profile() |         self.qvlan_profile = self.new_qvlan_profile() | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ class TestStatusMessage(LFCliBase): | |||||||
|                  _debug_on=False, |                  _debug_on=False, | ||||||
|                  _exit_on_error=False, |                  _exit_on_error=False, | ||||||
|                  _exit_on_fail=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.deep_clean = _deep_clean | ||||||
|         self.check_connect() |         self.check_connect() | ||||||
|  |  | ||||||
| @@ -167,7 +167,6 @@ class TestStatusMessage(LFCliBase): | |||||||
|             if self.debug: |             if self.debug: | ||||||
|                 print("--- del -------------------- -------------------- --------------------") |                 print("--- del -------------------- -------------------- --------------------") | ||||||
|             self.exit_on_error=False |             self.exit_on_error=False | ||||||
|             self.halt_on_error=False |  | ||||||
|             message_response = self.json_delete(self.session_url, debug_=False) |             message_response = self.json_delete(self.session_url, debug_=False) | ||||||
|             if self.debug: |             if self.debug: | ||||||
|                 print("--- ~del -------------------- -------------------- --------------------") |                 print("--- ~del -------------------- -------------------- --------------------") | ||||||
| @@ -195,7 +194,6 @@ class TestStatusMessage(LFCliBase): | |||||||
|             if self.debug: |             if self.debug: | ||||||
|                 print("--- del -------------------- -------------------- --------------------") |                 print("--- del -------------------- -------------------- --------------------") | ||||||
|             self.exit_on_error=False |             self.exit_on_error=False | ||||||
|             self.halt_on_error=False |  | ||||||
|             message_response = self.json_delete(self.session_url+"/this", debug_=False) |             message_response = self.json_delete(self.session_url+"/this", debug_=False) | ||||||
|             if self.debug: |             if self.debug: | ||||||
|                 print("--- ~del -------------------- -------------------- --------------------") |                 print("--- ~del -------------------- -------------------- --------------------") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham