Remove use of deprecated rprint functions
For each of the rprint functions, there is a corresponding gen_print function
that can be used instead.
Change-Id: I89c6e0b63cac7aee92da7dc7945e413001287967
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/boot_data.py b/lib/boot_data.py
index abb41b7..27ef3ea 100755
--- a/lib/boot_data.py
+++ b/lib/boot_data.py
@@ -18,7 +18,6 @@
import collections
import gen_print as gp
-import gen_robot_print as grp
import gen_valid as gv
import gen_misc as gm
import gen_cmd as gc
@@ -264,7 +263,7 @@
See sprint_report for details.
"""
- grp.rqprint(self.sprint_report(header_footer))
+ gp.qprint(self.sprint_report(header_footer))
def sprint_obj(self):
r"""
@@ -288,7 +287,7 @@
debug purposes.
"""
- grp.rprint(self.sprint_obj())
+ gp.gp_print(self.sprint_obj())
def create_boot_results_file_path(pgm_name,
diff --git a/lib/common_utils.robot b/lib/common_utils.robot
index 711dbf0..4e6595b 100755
--- a/lib/common_utils.robot
+++ b/lib/common_utils.robot
@@ -158,7 +158,7 @@
# quiet Indicates whether this keyword should write to console.
# print_string A string to be printed before checking the OS.
- rprint ${print_string}
+ Log To Console ${print_string} no_newline=True
# Attempt to ping the OS. Store the return code to check later.
${ping_rc}= Run Keyword and Return Status Ping Host ${os_host}
@@ -197,7 +197,7 @@
[Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
... ${os_password}=${OS_PASSWORD} ${timeout}=${OS_WAIT_TIMEOUT}
... ${quiet}=${0}
- [Teardown] rprintn
+ [Teardown] Printn
# Description of argument(s):
# os_host The DNS name or IP of the OS host associated with our
@@ -213,15 +213,15 @@
${message}= Catenate Checking every ${interval} seconds for up to
... ${timeout} seconds for the operating system to communicate.
- rqprint_timen ${message}
+ Qprint Timen ${message}
Wait Until Keyword Succeeds ${timeout} sec ${interval} Check OS
... ${os_host} ${os_username} ${os_password}
... print_string=\#
- rqprintn
+ Qprintn
- rqprint_timen The operating system is now communicating.
+ Qprint Timen The operating system is now communicating.
Copy PNOR to BMC
@@ -289,7 +289,7 @@
${cmd}= Catenate which ssh_pw 2>/dev/null || find
... ${EXECDIR} -name 'ssh_pw'
- Rdpissuing ${cmd}
+ Dprint Issuing ${cmd}
${rc} ${output}= Run And Return Rc And Output ${cmd}
Rdpvars rc output
@@ -320,7 +320,7 @@
${ps_cmd}= Catenate ps axwwo user,pid,cmd
${cmd_buf}= Catenate echo $(${ps_cmd} | egrep '${search_string}' |
... egrep -v grep | cut -c10-14)
- Rdpissuing ${cmd_buf}
+ Dprint Issuing ${cmd_buf}
${rc} ${os_con_pid}= Run And Return Rc And Output ${cmd_buf}
Rdpvars os_con_pid
# If rc is not zero it just means that there is no OS Console process
@@ -361,7 +361,7 @@
${os_con_pid}= Get SOL Console Pid
${cmd_buf}= Catenate kill -9 ${os_con_pid}
- Run Keyword If '${os_con_pid}' != '${EMPTY}' Rdpissuing ${cmd_buf}
+ Run Keyword If '${os_con_pid}' != '${EMPTY}' Dprint Issuing ${cmd_buf}
${rc} ${output}= Run Keyword If '${os_con_pid}' != '${EMPTY}'
... Run And Return Rc And Output ${cmd_buf}
Run Keyword If '${os_con_pid}' != '${EMPTY}' Rdpvars rc output
@@ -411,7 +411,7 @@
# nohup detaches the process completely from our pty.
#${cmd_buf}= Catenate nohup ${sub_cmd_buf} &> ${log_file_path} &
${cmd_buf}= Catenate ${sub_cmd_buf} > ${log_file_path} 2>&1 &
- Rdpissuing ${cmd_buf}
+ Dprint Issuing ${cmd_buf}
${rc} ${output}= Run And Return Rc And Output ${cmd_buf}
# Because we are forking this command, we essentially will never get a
# non-zero return code or any output.
diff --git a/lib/dump_utils.robot b/lib/dump_utils.robot
index 30b5ef4..140338e 100644
--- a/lib/dump_utils.robot
+++ b/lib/dump_utils.robot
@@ -88,7 +88,7 @@
${exception}= Set Variable ${resp.json()['data']['exception']}
${at_capacity}= Set Variable Dump not captured due to a cap
${too_many_dumps}= Evaluate $at_capacity in $exception
- Rprintn
+ Printn
Rprint Vars exception too_many_dumps
# If there are too many dumps, return ${EMPTY}, otherwise Fail.
${status}= Run Keyword If ${too_many_dumps} Set Variable ${EMPTY}
diff --git a/lib/fan_utils.robot b/lib/fan_utils.robot
index d00e236..aa20e33 100755
--- a/lib/fan_utils.robot
+++ b/lib/fan_utils.robot
@@ -177,7 +177,7 @@
# For an air cooled system.
${min_fans_air}= Set Variable 3
- Rprintn
+ Printn
Rpvars num_fans water_cooled
# If water cooled must have at least min_fans_water fans, otherwise
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index 9483bb6..4d92771 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -20,7 +20,6 @@
robot_env = gp.robot_env
if robot_env:
- import gen_robot_print as grp
from robot.libraries.BuiltIn import BuiltIn
@@ -105,10 +104,7 @@
err_buf += line
if not print_output:
continue
- if robot_env:
- grp.rprint(line)
- else:
- sys.stdout.write(line)
+ gp.gp_print(line)
for line in sub_proc.stdout:
try:
out_buf += line
@@ -117,10 +113,7 @@
out_buf += line
if not print_output:
continue
- if robot_env:
- grp.rprint(line)
- else:
- sys.stdout.write(line)
+ gp.gp_print(line)
if print_output and not robot_env:
sys.stdout.flush()
sub_proc.communicate()
@@ -132,10 +125,7 @@
err_msg += "out_buf:\n" + out_buf
if show_err:
- if robot_env:
- grp.rprint_error_report(err_msg)
- else:
- gp.print_error_report(err_msg)
+ gp.print_error_report(err_msg)
if not ignore_err:
if robot_env:
BuiltIn().fail(err_msg)
@@ -468,10 +458,7 @@
err_msg += "err_buf:\n" + err_buf
err_msg += "out_buf:\n" + out_buf
if show_err:
- if robot_env:
- func_stdout += grp.sprint_error_report(err_msg)
- else:
- func_stdout += gp.sprint_error_report(err_msg)
+ func_stdout += gp.sprint_error_report(err_msg)
func_history_stdout += func_stdout
if attempt_num < max_attempts:
func_history_stdout += gp.sprint_issuing("time.sleep("
@@ -482,11 +469,7 @@
if shell_rc not in allowed_shell_rcs:
func_stdout = func_history_stdout
- if robot_env:
- grp.rprint(func_stdout)
- else:
- sys.stdout.write(func_stdout)
- sys.stdout.flush()
+ gp.gp_print(func_stdout)
if shell_rc not in allowed_shell_rcs:
if not ignore_err:
diff --git a/lib/gen_robot_valid.py b/lib/gen_robot_valid.py
index c69b8a4..06d87be 100755
--- a/lib/gen_robot_valid.py
+++ b/lib/gen_robot_valid.py
@@ -4,7 +4,7 @@
This file contains functions useful for validating variables in robot.
"""
-import gen_robot_print as grp
+import gen_print as gp
import gen_valid as gv
from robot.libraries.BuiltIn import BuiltIn
@@ -17,7 +17,7 @@
r"""
Validate a robot value.
- This function is the robot wrapper for gen_robot_print.svalid_value.
+ This function is the robot wrapper for gen_valid.svalid_value.
Description of arguments:
var_name The name of the variable whose value is to
@@ -94,7 +94,7 @@
error_message = gv.svalid_value(var_value, invalid_values,
valid_values, var_name)
if not error_message == "":
- error_message = grp.sprint_error_report(error_message)
+ error_message = gp.sprint_error_report(error_message)
BuiltIn().fail(error_message)
@@ -102,7 +102,7 @@
r"""
Validate a robot integer.
- This function is the robot wrapper for gen_robot_print.svalid_integer.
+ This function is the robot wrapper for gen_valid.svalid_integer.
Description of arguments:
var_name The name of the variable whose value is to
@@ -143,7 +143,7 @@
else:
error_message = gv.svalid_integer(var_value, var_name)
if not error_message == "":
- error_message = grp.sprint_error_report(error_message)
+ error_message = gp.sprint_error_report(error_message)
BuiltIn().fail(error_message)
@@ -152,7 +152,7 @@
r"""
Validate that a robot integer is within the given range.
- This function is the robot wrapper for gen_robot_print.svalid_range.
+ This function is the robot wrapper for gen_valid.svalid_range.
Description of arguments:
var_name The name of the variable whose value is to
@@ -196,5 +196,5 @@
range = [x for x in range if x]
error_message = gv.svalid_range(var_value, range, var_name)
if not error_message == "":
- error_message = grp.sprint_error_report(error_message)
+ error_message = gp.sprint_error_report(error_message)
BuiltIn().fail(error_message)
diff --git a/lib/obmc_boot_test.py b/lib/obmc_boot_test.py
index 8acc4e4..a575d79 100755
--- a/lib/obmc_boot_test.py
+++ b/lib/obmc_boot_test.py
@@ -22,7 +22,6 @@
from boot_data import *
import gen_print as gp
-import gen_robot_print as grp
import gen_robot_plug_in as grpi
import gen_robot_valid as grv
import gen_misc as gm
@@ -403,7 +402,7 @@
validate_parms()
- grp.rqprint_pgm_header()
+ gp.qprint_pgm_header()
grk.run_key("Set BMC Power Policy ALWAYS_POWER_OFF")
@@ -414,7 +413,7 @@
call_point='setup')
if rc != 0:
error_message = "Plug-in setup failed.\n"
- grp.rprint_error_report(error_message)
+ gp.print_error_report(error_message)
BuiltIn().fail(error_message)
# Setting cp_setup_called lets our Teardown know that it needs to call
# the cleanup plug-in call point.
@@ -641,7 +640,7 @@
gp.qprintn("Last 10 boots:\n")
for boot_entry in last_ten:
- grp.rqprint(boot_entry)
+ gp.qprint(boot_entry)
gp.qprint_dashes(0, 90)
@@ -1021,7 +1020,7 @@
"A keyword timeout occurred ending this program.\n"]
BuiltIn().run_keyword_if_timeout_occurred(*cmd_buf)
- grp.rqprint_pgm_footer()
+ gp.qprint_pgm_footer()
def post_stack():