Changes to lib/boot/powerons.py.

  - bmc_power_on:  I added code to use globals STATE_CHANGE_TIMEOUT and
    POWER_ON_TIMEOUT.
  - Streamlined code to get OS_HOST.

Change-Id: I6d03be9719f563ce3bff4aa552b8f387c6d042d9
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/boot/powerons.py b/lib/boot/powerons.py
index a7a9ab1..a861d57 100755
--- a/lib/boot/powerons.py
+++ b/lib/boot/powerons.py
@@ -32,9 +32,12 @@
     grp.rpissuing_keyword(cmd_buf)
     power = BuiltIn().run_keyword(*cmd_buf)
 
+    state_change_timeout = BuiltIn().get_variable_value(
+        "${STATE_CHANGE_TIMEOUT}", default="1 min")
+
     # Wait for the state to change in any way.
-    state_mod.wait_state(match_state, wait_time="1 min", interval="3 seconds",
-                         invert=1)
+    state_mod.wait_state(match_state, wait_time=state_change_timeout,
+                         interval="3 seconds", invert=1)
 
     cmd_buf = ["Create Dictionary", "power=${1}",
                "bmc=HOST_BOOTED",
@@ -42,10 +45,7 @@
     grp.rdpissuing_keyword(cmd_buf)
     final_state = BuiltIn().run_keyword(*cmd_buf)
 
-    try:
-        os_host = BuiltIn().get_variable_value("${OS_HOST}")
-    except TypeError:
-        os_host = ""
+    os_host = BuiltIn().get_variable_value("${OS_HOST}", default="")
 
     if os_host != "":
         final_state['os_ping'] = 1
@@ -55,7 +55,9 @@
     final_state = state_mod.anchor_state(final_state)
 
     grp.rprintn()
-    state_mod.wait_state(final_state, wait_time="14 mins",
+    power_on_timeout = BuiltIn().get_variable_value(
+        "${POWER_ON_TIMEOUT}", default="14 mins")
+    state_mod.wait_state(final_state, wait_time=power_on_timeout,
                          interval="3 seconds")
 
 ###############################################################################