Fix print_var calls: new fmt, indent, etc.
Changed print_var calls to correctly use new arguments:
- fmt
- indent
- col1_width
Change-Id: If80088d5b69865074fd510421b918da7fd8e874e
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/bin/process_plug_in_packages.py b/bin/process_plug_in_packages.py
index 42510a0..b03290c 100755
--- a/bin/process_plug_in_packages.py
+++ b/bin/process_plug_in_packages.py
@@ -28,8 +28,6 @@
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
-# I use this variable in calls to print_var.
-hex = 1
# Create parser object to process command line parameters and args.
@@ -273,7 +271,7 @@
+ " -------------------------------------------------")
if failed_plug_in_name != "":
print_var(failed_plug_in_name)
- print_var(shell_rc, hex)
+ print_var(shell_rc, hexa())
return rc, shell_rc, failed_plug_in_name
@@ -307,7 +305,7 @@
plug_in_packages_list = return_plug_in_packages_list(plug_in_dir_paths,
mch_class)
- qpvar(plug_in_packages_list)
+ qprint_var(plug_in_packages_list)
qprint("\n")
allow_shell_rc = int(allow_shell_rc, 0)
diff --git a/lib/func_timer.py b/lib/func_timer.py
index d07ba32..ef837ef 100644
--- a/lib/func_timer.py
+++ b/lib/func_timer.py
@@ -60,14 +60,12 @@
func_name = self.__func.__name__
except AttributeError:
func_name = ""
- buffer += gp.sprint_var(func_name, hex=1, loc_col1_indent=indent)
- buffer += gp.sprint_varx("time_out", self.__time_out,
- loc_col1_indent=indent)
- buffer += gp.sprint_varx("child_pid", self.__child_pid,
- loc_col1_indent=indent)
+ buffer += gp.sprint_var(func_name, indent=indent)
+ buffer += gp.sprint_varx("time_out", self.__time_out, indent=indent)
+ buffer += gp.sprint_varx("child_pid", self.__child_pid, indent=indent)
buffer += gp.sprint_varx("original_SIGUSR1_handler",
self.__original_SIGUSR1_handler,
- loc_col1_indent=indent)
+ indent=indent)
return buffer
def print_obj(self):
diff --git a/lib/gen_arg.py b/lib/gen_arg.py
index 7c82ece..f4abbe5 100755
--- a/lib/gen_arg.py
+++ b/lib/gen_arg.py
@@ -197,13 +197,13 @@
of output.
"""
- loc_col1_width = gp.col1_width + indent
+ col1_width = gp.dft_col1_width + indent
buffer = ""
for key in arg_obj.__dict__:
buffer += gp.sprint_varx(key, getattr(arg_obj, key), 0, indent,
- loc_col1_width)
+ col1_width)
return buffer
diff --git a/lib/gen_call_robot.py b/lib/gen_call_robot.py
index 3944c79..0372698 100755
--- a/lib/gen_call_robot.py
+++ b/lib/gen_call_robot.py
@@ -347,7 +347,7 @@
gp.qprint_timen("No robot output files were found in " + outputdir
+ ".")
return
- gp.qprint_var(robot_rc, 1)
+ gp.qprint_var(robot_rc, gp.hexa())
if SAVE_STATUS_POLICY == "FAIL" and robot_rc == 0:
gp.qprint_timen("The call to robot produced no failures."
+ " Deleting robot output files.")
@@ -480,8 +480,7 @@
gcr_last_robot_rc = shell_rc
process_robot_output_files()
if shell_rc != 0:
- hex = 1
- gp.print_var(shell_rc, hex)
+ gp.print_var(shell_rc, gp.hexa())
return False
return True
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 0dc0d64..9631182 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -66,7 +66,7 @@
if shell_rc != 0:
error_message = "Failed to find complete path for file \"" +\
file_path + "\".\n"
- error_message += gp.sprint_var(shell_rc, 1)
+ error_message += gp.sprint_var(shell_rc, gp.hexa())
error_message += out_buf
if robot_env:
BuiltIn().fail(gp.sprint_error(error_message))
@@ -454,10 +454,10 @@
var1 = 0xfffffffffffffff1
print_var(var1)
- print_var(var1, 1)
+ print_var(var1, hexa())
var1 = to_signed(var1)
print_var(var1)
- print_var(var1, 1)
+ print_var(var1, hexa())
The following is written to stdout:
var1: 18446744073709551601
diff --git a/lib/gen_robot_plug_in.py b/lib/gen_robot_plug_in.py
index 31236c4..1088cb5 100755
--- a/lib/gen_robot_plug_in.py
+++ b/lib/gen_robot_plug_in.py
@@ -212,12 +212,11 @@
failed_plug_in_name = properties.get('failed_plug_in_name', '')
if proc_plug_pkg_rc != 0:
- hex = 1
if quiet:
os.system("cat " + temp_file_path + " >&2")
if grep_rc != 0:
- gp.print_varx("grep_rc", grep_rc, hex)
- gp.print_varx("proc_plug_pkg_rc", proc_plug_pkg_rc, hex)
+ gp.print_var(grep_rc, gp.hexa())
+ gp.print_var(proc_plug_pkg_rc, gp.hexa())
gp.print_timen("Re-cap of plug-in failures:")
gc.cmd_fnc_u("egrep -A 1 '^failed_plug_in_name:[ ]+' "
+ temp_properties_file_path + " | egrep -v '^\\--'",
diff --git a/lib/gen_robot_ssh.py b/lib/gen_robot_ssh.py
index 1c9f564..770f67b 100755
--- a/lib/gen_robot_ssh.py
+++ b/lib/gen_robot_ssh.py
@@ -149,7 +149,7 @@
# re-raise exception.
break
# If we get to this point, the login has worked and we can return.
- gp.lpvar(out_buf)
+ gp.lprint_var(out_buf)
return
# If we get to this point, the login has failed on all attempts so the
@@ -339,7 +339,7 @@
return
if rc != 0 and print_err:
- gp.print_var(rc, 1)
+ gp.print_var(rc, gp.hexa())
if not print_out:
gp.print_var(stderr)
gp.print_var(stdout)
@@ -350,7 +350,8 @@
if not ignore_err:
message = gp.sprint_error("The prior SSH"
+ " command returned a non-zero return"
- + " code:\n" + gp.sprint_var(rc, 1) + stderr
+ + " code:\n"
+ + gp.sprint_var(rc, gp.hexa()) + stderr
+ "\n")
BuiltIn().should_be_equal(rc, 0, message)
diff --git a/lib/gen_valid.py b/lib/gen_valid.py
index ad5de1f..882e31d 100755
--- a/lib/gen_valid.py
+++ b/lib/gen_valid.py
@@ -154,7 +154,6 @@
gp.sprint_var(valid_values)
return error_message
- show_blanks = 1
if len_valid_values > 0:
# Processing the valid_values list.
if var_value in valid_values:
@@ -162,10 +161,9 @@
error_message += "The following variable has an invalid" +\
" value:\n" +\
gp.sprint_varx(get_var_name(var_name), var_value,
- show_blanks) +\
+ gp.blank()) +\
"\nIt must be one of the following values:\n" +\
- gp.sprint_varx("valid_values", valid_values,
- show_blanks)
+ gp.sprint_var(valid_values, gp.blank())
return error_message
if len_invalid_values == 0:
@@ -178,10 +176,9 @@
error_message += "The following variable has an invalid value:\n" +\
gp.sprint_varx(get_var_name(var_name), var_value,
- show_blanks) +\
+ gp.blank()) +\
"\nIt must NOT be one of the following values:\n" +\
- gp.sprint_varx("invalid_values", invalid_values,
- show_blanks)
+ gp.sprint_var(invalid_values, gp.blank())
return error_message
@@ -228,10 +225,9 @@
pass
# If we get to this point, the validation has failed.
- show_blanks = 1
error_message +=\
"Invalid integer value:\n" +\
- gp.sprint_varx(get_var_name(var_name), var_value, show_blanks)
+ gp.sprint_varx(get_var_name(var_name), var_value, gp.blank())
return error_message
@@ -437,8 +433,7 @@
if valid_range[0] is not None and valid_range[0] > valid_range[1]:
error_message = "Programmer error - In the following range, the" +\
" lower limit is greater than the upper" +\
- " limit:\n" + gp.sprint_varx("valid_range",
- valid_range)
+ " limit:\n" + gp.sprint_var(valid_range)
return error_message
if len_valid_range == 1:
@@ -513,7 +508,6 @@
error_message = ""
if len(var_value) == 0:
- show_blanks = 1
error_message += "The \"" + get_var_name(var_name)
error_message += "\" list is empty and is therefore invalid:\n"
return error_message
@@ -526,10 +520,9 @@
display_var_value[ix] = var_value[ix] + "*"
if found_error:
- show_blanks = 1
error_message += "The list entries marked with \"*\" are not valid:\n"
error_message += gp.sprint_varx(get_var_name(var_name),
- display_var_value, show_blanks)
+ display_var_value, gp.blank())
error_message += gp.sprint_var(valid_values)
return error_message
@@ -577,12 +570,11 @@
keys_missing = list(set(required_keys) - set(var_value.keys()))
if len(keys_missing) > 0:
- show_blanks = 1
var_name = get_var_name(var_name)
error_message = "The following key fields are missing from "
error_message += var_name + ":\n"
error_message += gp.sprint_var(keys_missing)
- error_message += gp.sprint_varx(var_name, var_value, show_blanks)
+ error_message += gp.sprint_varx(var_name, var_value, gp.blank())
return error_message
return ""
diff --git a/lib/logging_utils.py b/lib/logging_utils.py
index 9c43f21..c0ba4ab 100644
--- a/lib/logging_utils.py
+++ b/lib/logging_utils.py
@@ -74,7 +74,7 @@
pass
key_list.insert(0, var.BMC_LOGGING_ENTRY + ".*")
- gp.print_var(error_logs, hex=1, key_list=key_list)
+ gp.print_var(error_logs, gp.terse(), key_list=key_list)
def get_esels(error_logs=None):
diff --git a/lib/openbmctool_utils.py b/lib/openbmctool_utils.py
index 96e7b5f..1a79b7d 100755
--- a/lib/openbmctool_utils.py
+++ b/lib/openbmctool_utils.py
@@ -126,7 +126,7 @@
Example robot code:
${fru_status}= Get Fru Status
- Rprint Vars 1 fru_status
+ Rprint Vars fru_status fmt=1
Example result (excerpt):
@@ -196,7 +196,7 @@
Example robot code:
${fru_print}= Get Fru Print
- Rprint Vars 1 fru_print
+ Rprint Vars fru_print fmt=1
Example result (excerpt):
@@ -267,7 +267,7 @@
Example robot code:
${fru_list}= Get Fru List
- Rprint Vars 1 fru_list
+ Rprint Vars fru_list fmt=1
Example result (excerpt):
@@ -312,7 +312,7 @@
Example robot code:
${sensors_print}= Get Sensors Print
- Rprint Vars 1 sensors_print
+ Rprint Vars sensors_print fmt=1
Example result (excerpt):
@@ -351,7 +351,7 @@
Example robot code:
${sensors_list}= Get Sensors List
- Rprint Vars 1 sensors_list
+ Rprint Vars sensors_list fmt=1
Example result (excerpt):
@@ -483,7 +483,7 @@
Example robot code:
${health_check}= Get Health Check
- Rpvars 1 health_check
+ Rprint Vars health_check fmt=1
Example result:
@@ -530,7 +530,7 @@
Example robot code:
${remote_logging_view}= Get Remote Logging View
- Rpvars 1 remote_logging_view
+ Rprint Vars remote_logging_view fmt=1
Example result:
diff --git a/lib/var_stack.py b/lib/var_stack.py
index 5bb56a7..f09845c 100644
--- a/lib/var_stack.py
+++ b/lib/var_stack.py
@@ -92,7 +92,8 @@
buffer += self.__obj_name + ":\n"
indent = 2
- buffer += gp.sprint_varx('stack_dict', self.__stack_dict, 1, indent)
+ buffer += gp.sprint_varx('stack_dict', self.__stack_dict, gp.terse(),
+ indent)
return buffer
diff --git a/redfish/service_root/test_service_root_security.robot b/redfish/service_root/test_service_root_security.robot
index f8f6376..5583a07 100644
--- a/redfish/service_root/test_service_root_security.robot
+++ b/redfish/service_root/test_service_root_security.robot
@@ -121,7 +121,7 @@
# X-XSS-Protection: 1; mode=block
# X-Content-Type-Options: nosniff
- Rprint Vars 1 header_requirements
+ Rprint Vars header_requirements fmt=1
Redfish.Login
${resp}= Redfish.Get /redfish/v1/SessionService/Sessions
@@ -142,7 +142,7 @@
# [Content-Length]: 2177
${headers}= Key Value List To Dict ${resp.getheaders()}
- Rprint Vars 1 headers
+ Rprint Vars headers fmt=1
Dictionary Should Contain Sub Dictionary ${headers} ${header_requirements}
diff --git a/systest/htx_hardbootme_test.robot b/systest/htx_hardbootme_test.robot
index 73e7d76..149a0c9 100755
--- a/systest/htx_hardbootme_test.robot
+++ b/systest/htx_hardbootme_test.robot
@@ -74,7 +74,7 @@
[Tags] Hard_Bootme_Test
Printn
- Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
+ Rprint Vars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
... INV_IGNORE_LIST PREV_INV_FILE_PATH
Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
@@ -124,7 +124,7 @@
${estimated_time_remaining}= Convert Time
... ${est_seconds_left} result_format=compact
Printn
- Rpvars loop_count estimated_loop_time estimated_time_remaining
+ Rprint Vars loop_count estimated_loop_time estimated_time_remaining
Run Keyword ${rest_keyword} Power On stack_mode=skip
Run Key U Sleep \ 15s
@@ -164,7 +164,7 @@
${estimated_time_remaining}= Convert Time
... ${est_seconds_left} result_format=compact
- Rpvars loop_count estimated_time_remaining
+ Rprint Vars loop_count estimated_time_remaining
Do Inventory And Compare
@@ -252,10 +252,10 @@
${bmc_version} ${stderr} ${rc}= BMC Execute Command
... cat /etc/os-release
Printn
- Rpvars bmc_version
+ Rprint Vars bmc_version
${pnor_version}= Get Host Software Objects Details
- Rpvars pnor_version
+ Rprint Vars pnor_version
${is_redfish}= Run Keyword And Return Status Redfish.Login
${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
@@ -269,7 +269,7 @@
Tool Exist htxcmdline
${os_release_info}= Get OS Release Info
- Rpvars 1 os_release_info
+ Rprint Vars os_release_info fmt=1
# Shutdown if HTX is running.
${status}= Is HTX Running