Switch to exit_on_error mode
Switch several programs to newer exit_on_error mode. This mode dictates
the behavior of the validation functions.
Also, valid_value recently:
- Switched the order of 2 positional arguments
- Added code to default invalid_values to ["", None] vs [""]
Changed Auto_reboot/cp_master accordingliny.
Change-Id: I3ade00d8b51d567604f59ff6c8f993f4afc864ee
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/bin/plug_ins/Auto_reboot/cp_master b/bin/plug_ins/Auto_reboot/cp_master
index e28d773..b7aad55 100755
--- a/bin/plug_ins/Auto_reboot/cp_master
+++ b/bin/plug_ins/Auto_reboot/cp_master
@@ -81,7 +81,7 @@
get_plug_vars()
- valid_value(AUTOBOOT_OPENBMC_HOST, ["", None])
+ valid_value(AUTOBOOT_OPENBMC_HOST)
global AUTO_REBOOT_DISABLE
if pgm_name == "cp_cleanup":
AUTO_REBOOT_DISABLE = 0
diff --git a/bin/plug_ins/Stop/cp_stop_check b/bin/plug_ins/Stop/cp_stop_check
index acaddfe..713bd96 100755
--- a/bin/plug_ins/Stop/cp_stop_check
+++ b/bin/plug_ins/Stop/cp_stop_check
@@ -21,6 +21,9 @@
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
+# Set exit_on_error for gen_valid functions.
+set_exit_on_error(True)
+
# Initialize.
STOP_REST_FAIL = ''
STOP_COMMAND = ''
@@ -95,8 +98,7 @@
get_plug_vars()
- if not valid_value(AUTOBOOT_OPENBMC_HOST, ["", None]):
- return False
+ valid_value(AUTOBOOT_OPENBMC_HOST)
gen_post_validation(exit_function, signal_handler)
diff --git a/lib/gen_call_robot.py b/lib/gen_call_robot.py
index d504d2e..9f67593 100755
--- a/lib/gen_call_robot.py
+++ b/lib/gen_call_robot.py
@@ -140,11 +140,9 @@
# Use to the apollo dir path.
ROBOT_TEST_BASE_DIR_PATH = apollo_dir_path + suffix
- if not gv.valid_value(ROBOT_TEST_BASE_DIR_PATH):
- return False
+ gv.valid_value(ROBOT_TEST_BASE_DIR_PATH)
gp.dprint_vars(ROBOT_TEST_RUNNING_FROM_SB, ROBOT_TEST_BASE_DIR_PATH)
- if not gv.valid_dir_path(ROBOT_TEST_BASE_DIR_PATH):
- return False
+ gv.valid_dir_path(ROBOT_TEST_BASE_DIR_PATH)
ROBOT_TEST_BASE_DIR_PATH = gm.add_trailing_slash(ROBOT_TEST_BASE_DIR_PATH)
gm.set_mod_global(ROBOT_TEST_BASE_DIR_PATH)
@@ -177,8 +175,7 @@
file.
"""
- if not gv.valid_value(robot_file_path):
- raise ValueError('Programmer error.')
+ gv.valid_value(robot_file_path)
try:
if ROBOT_TEST_BASE_DIR_PATH is NONE:
@@ -213,8 +210,7 @@
break
gp.dprint_var(robot_file_path)
- if not gv.valid_file_path(robot_file_path):
- raise ValueError('Programmer error.')
+ gv.valid_file_path(robot_file_path)
return robot_file_path
@@ -398,8 +394,7 @@
apolloxxx import files, programs, etc.
"""
- if not gv.valid_value(robot_cmd_buf):
- return False
+ gv.valid_value(robot_cmd_buf)
# Set global variables to aid in cleanup with process_robot_output_files.
global gcr_last_robot_cmd_buf