Get HTTPS_PORT as robot var, then os.environ
- The prior code would get HTTPS_PORT if it was an environment variable
but NOT if it was a robot variable (e.g. -v HTTPS_PORT:443).
- Simplified the code as well.
Change-Id: I5f3be1a366cb2381a6987ded49507ee356f0a3ae
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 231d08f..4894632 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -1,4 +1,5 @@
import os
+from robot.libraries.BuiltIn import BuiltIn
OPENBMC_BASE_URI = '/xyz/openbmc_project/'
OPENBMC_BASE_DBUS = 'xyz.openbmc_project.'
@@ -197,7 +198,6 @@
SYSTEM_BASE_URI = REDFISH_BASE_URI + 'Systems/system/'
EVENT_LOG_URI = SYSTEM_BASE_URI + 'LogServices/EventLog/'
-
'''
QEMU HTTPS variable:
@@ -207,26 +207,7 @@
the port from the OS environment
'''
-
-def get_port_https():
- # defaulted to empty string
- l_suffix = ''
- try:
- l_https_port = os.getenv('HTTPS_PORT')
- if l_https_port:
- l_suffix = ':' + l_https_port
- except BaseException:
- print ("Environment variable HTTPS_PORT not set,\
- using default HTTPS port")
- return l_suffix
-
-
-AUTH_SUFFIX = {
- "https_port": [get_port_https()],
-}
-
-# Update the ':Port number' to this variable
-AUTH_SUFFIX = AUTH_SUFFIX['https_port'][0]
+AUTH_SUFFIX = ":" + BuiltIn().get_variable_value("${HTTPS_PORT}", os.getenv('HTTPS_PORT', '443'))
# Here contains a list of valid Properties bases on fru_type after a boot.
INVENTORY_ITEMS = {