Fix loading default values from environment variables
Use cast of environment variable to expected type
Change-Id: I192772599b46545597c785bb5cc3c74f6ea5ad80
diff --git a/tcp_tests/helpers/oslo_cfg_types.py b/tcp_tests/helpers/oslo_cfg_types.py
index 962f2d3..135798f 100644
--- a/tcp_tests/helpers/oslo_cfg_types.py
+++ b/tcp_tests/helpers/oslo_cfg_types.py
@@ -104,7 +104,10 @@
env_var_name = args[0].upper()
if 'default' in kwargs:
- kwargs['default'] = os.environ.get(env_var_name, kwargs.get('default', None))
+ # Load a default environment variable with expected type
+ kwargs['default'] = args[1](
+ os.environ.get(env_var_name, kwargs.get('default', None))
+ )
super(Cfg, self).__init__(*args, **kwargs)
# Print info about default environment variables to console
diff --git a/tcp_tests/templates/ironic_standalone/underlay.yaml b/tcp_tests/templates/ironic_standalone/underlay.yaml
index ab9a9d2..6f54227 100644
--- a/tcp_tests/templates/ironic_standalone/underlay.yaml
+++ b/tcp_tests/templates/ironic_standalone/underlay.yaml
@@ -76,7 +76,7 @@
nodes:
- name: {{ HOSTNAME_IRONIC }}
- role: salt_master
+ role: ironic_master
params:
vcpu: !os_env SLAVE_NODE_CPU, 2
memory: !os_env SLAVE_NODE_MEMORY, 2048
diff --git a/tcp_tests/tests/environment/test_ironic_standalone.py b/tcp_tests/tests/environment/test_ironic_standalone.py
index 7d20c7c..8d60279 100644
--- a/tcp_tests/tests/environment/test_ironic_standalone.py
+++ b/tcp_tests/tests/environment/test_ironic_standalone.py
@@ -33,7 +33,7 @@
Before using, please set the correct roles and timeout:
- export ROLES=["ironic_master",]
+ export ROLES='["ironic_master"]'
export BOOTSTRAP_TIMEOUT=900
, and unset these variables after the bootstrap is completed.