Added use of OS_AUTH_URL to security_scan and exec_test.sh 33/15633/5
authorLuke Hinds <lukehinds@gmail.com>
Wed, 15 Jun 2016 15:50:52 +0000 (16:50 +0100)
committerJose Lausuch <jose.lausuch@ericsson.com>
Wed, 15 Jun 2016 17:44:30 +0000 (17:44 +0000)
JIRA: FUNCTEST-315

Change-Id: I1f8ac20cd93ce25548dbf47d62fc6a076d347d62
Signed-off-by: Luke Hinds <lukehinds@gmail.com>
ci/exec_test.sh
testcases/security_scan/security_scan.py

index 3af1649..04f38e6 100755 (executable)
@@ -130,10 +130,12 @@ function run_test(){
         ;;
         "ovno")
             # suite under rewritting for colorado
-            # no need to run anything until refactoring done 
+            # no need to run anything until refactoring done
             # ${repos_dir}/ovno/Testcases/RunTests.sh
         ;;
         "security_scan")
+            echo "Sourcing Credentials ${FUNCTEST_CONF_DIR}/stackrc for security_scan test.."
+            source ${FUNCTEST_CONF_DIR}/stackrc
             python ${FUNCTEST_REPO_DIR}/testcases/security_scan/security_scan.py --config ${FUNCTEST_REPO_DIR}/testcases/security_scan/config.ini
         ;;
         *)
index e6fc5a8..7ed85b6 100644 (file)
@@ -27,10 +27,17 @@ __author__ = 'Luke Hinds (lhinds@redhat.com)'
 __url__ = 'https://wiki.opnfv.org/display/functest/Functest+Security'
 
 # Global vars
-INSTALLER_IP = os.getenv('INSTALLER_IP')
 oscapbin = 'sudo /bin/oscap'
+INSTALLER_IP = os.getenv('INSTALLER_IP')
+
+# Apex Spefic var needed to query Undercloud
+if os.getenv('OS_AUTH_URL') is None:
+    connect.logger.error(" Enviroment variable OS_AUTH_URL is not set")
+    sys.exit(0)
+else:
+    OS_AUTH_URL = os.getenv('OS_AUTH_URL')
 
-# args
+# argparse
 parser = argparse.ArgumentParser(description='OPNFV OpenSCAP Scanner')
 parser.add_argument('--config', action='store', dest='cfgfile',
                     help='Config file', required=True)
@@ -51,7 +58,7 @@ setup.getockey()
 com = 'sudo hiera admin_password'
 setup = connect.SetUp(com)
 keypass = setup.keystonepass()
-auth = v2.Password(auth_url='http://{0}:5000/v2.0'.format(INSTALLER_IP),
+auth = v2.Password(auth_url='http://{0}:5000/v2.0'.format(OS_AUTH_URL),
                    username='admin',
                    password=str(keypass).rstrip(),
                    tenant_name='admin')