aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorvitikkan <viktor.tikkanen@nokia.com>2016-04-25 10:43:29 +0300
committervitikkan <viktor.tikkanen@nokia.com>2016-04-25 10:44:48 +0300
commitd36a76e6425c914a8243033175c3233e449e624b (patch)
tree8f816e8e89bccb43cad00c1d8b904894d5ed2c0b /testcases
parentc7d29ebd0487482d253262e2dc515d39ff5a2b46 (diff)
ConfigParser is used for tempest.conf updating
Bash commands are replaced with python's ConfigParser routines for configuration file reading/updating. Removed updating of ssh_user_regex parameter since it is now into upstream Rally code. JIRA: FUNCTEST-198 Change-Id: I95f926948a395993e28e993bf7ea2872d6b5c969 Signed-off-by: vitikkan <viktor.tikkanen@nokia.com>
Diffstat (limited to 'testcases')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index b2240c9c2..8407da2c6 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -23,6 +23,7 @@ import shutil
import subprocess
import time
import yaml
+import ConfigParser
import keystoneclient.v2_0.client as ksclient
from neutronclient.v2_0 import client as neutronclient
@@ -217,7 +218,9 @@ def configure_tempest(mode):
cmd += "testr list-tests >" + TEMPEST_LIST_FILE + ";cd"
functest_utils.execute_command(cmd, logger)
- logger.debug(" Updating fixed_network_name...")
+ logger.debug("Updating selected tempest.conf parameters...")
+ config = ConfigParser.RawConfigParser()
+ config.read(tempest_conf_file)
private_net_name = ""
creds_neutron = openstack_utils.get_credentials("neutron")
neutron_client = neutronclient.Client(**creds_neutron)
@@ -226,24 +229,12 @@ def configure_tempest(mode):
logger.error("No shared private networks found.")
else:
private_net_name = private_net['name']
- cmd = "crudini --set " + tempest_conf_file + \
- " compute fixed_network_name " + \
- private_net_name
- functest_utils.execute_command(cmd, logger)
-
- logger.debug(" Updating non-admin credentials...")
- cmd = "crudini --set " + tempest_conf_file + " identity tenant_name " \
- + TENANT_NAME
- functest_utils.execute_command(cmd, logger)
- cmd = "crudini --set " + tempest_conf_file + " identity username " \
- + USER_NAME
- functest_utils.execute_command(cmd, logger)
- cmd = "crudini --set " + tempest_conf_file + " identity password " \
- + USER_PASSWORD
- functest_utils.execute_command(cmd, logger)
- cmd = "sed -i 's/.*ssh_user_regex.*/ssh_user_regex = " + SSH_USER_REGEX + \
- "/' " + tempest_conf_file
- functest_utils.execute_command(cmd, logger)
+ config.set('compute', 'fixed_network_name', private_net_name)
+ config.set('identity', 'tenant_name', TENANT_NAME)
+ config.set('identity', 'username', USER_NAME)
+ config.set('identity', 'password', USER_PASSWORD)
+ with open(tempest_conf_file, 'wb') as config_file:
+ config.write(config_file)
# Copy tempest.conf to /home/opnfv/functest/results/tempest/
shutil.copyfile(tempest_conf_file, TEMPEST_RESULTS_DIR + '/tempest.conf')