Merge "merge N days and whole database process and not publish existed data any way"
authorMorgan Richomme <morgan.richomme@orange.com>
Wed, 14 Sep 2016 09:40:18 +0000 (09:40 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Wed, 14 Sep 2016 09:40:18 +0000 (09:40 +0000)
17 files changed:
jjb/doctor/doctor.yml
jjb/yardstick/yardstick-ci-jobs.yml
prototypes/bifrost/README.md
prototypes/bifrost/scripts/destroy-env.sh
utils/test/result_collection_api/opnfv_testapi/dashboard/bottlenecks2Dashboard.py
utils/test/result_collection_api/opnfv_testapi/dashboard/dashboard_utils.py
utils/test/result_collection_api/opnfv_testapi/dashboard/doctor2Dashboard.py
utils/test/result_collection_api/opnfv_testapi/dashboard/functest2Dashboard.py
utils/test/result_collection_api/opnfv_testapi/dashboard/promise2Dashboard.py
utils/test/result_collection_api/opnfv_testapi/dashboard/yardstick2Dashboard.py
utils/test/result_collection_api/opnfv_testapi/resources/handlers.py
utils/test/result_collection_api/opnfv_testapi/tests/unit/fake_pymongo.py
utils/test/result_collection_api/opnfv_testapi/tests/unit/test_dashboard.py
utils/test/result_collection_api/opnfv_testapi/tests/unit/test_fake_pymongo.py
utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py
utils/test/result_collection_api/update/templates/changes_in_mongodb.py
utils/test/result_collection_api/update/templates/update_mongodb.py

index ead6c00..2d0bbfb 100644 (file)
                 file-paths:
                   - compare-type: ANT
                     pattern: 'tests/**'
+            skip-vote:
+                successful: true
+                failed: true
+                unstable: true
+                notbuilt: true
 
     builders:
         - 'functest-suite-builder':
index dd88a52..d0794eb 100644 (file)
             installer: fuel
             auto-trigger-name: 'daily-trigger-disabled'
             <<: *master
+        - arm-pod2:
+            slave-label: '{pod}'
+            installer: fuel
+            auto-trigger-name: 'daily-trigger-disabled'
+            <<: *colorado
         - orange-pod2:
             slave-label: '{pod}'
             installer: joid
index 4bba0db..7f12793 100644 (file)
@@ -7,26 +7,26 @@ Please follow that steps:
 
 1. Clone bifrost::
 
-    git clone https://git.openstack.org/openstack/bifrost /opt/bifrost
+    sudo git clone https://git.openstack.org/openstack/bifrost /opt/bifrost
 
 2. Clone releng::
 
-    git clone https://gerrit.opnfv.org/gerrit/releng /opt/releng
+    sudo git clone https://gerrit.opnfv.org/gerrit/releng /opt/releng
 
 3. Clone infracloud::
 
-    git clone https://git.openstack.org/openstack-infra/puppet-infracloud /opt/puppet-infracloud
+    sudo git clone https://git.openstack.org/openstack-infra/puppet-infracloud /opt/puppet-infracloud
 
 4. Combine releng scripts and playbooks with bifrost::
 
-    cp -R /opt/releng/prototypes/bifrost/* /opt/bifrost/
+    sudo cp -R /opt/releng/prototypes/bifrost/* /opt/bifrost/
 
 5. If you are on a RHEL/CentOS box, ensure that selinux is disabled
 
 6. Run destroy script if you need to cleanup previous environment::
 
     cd /opt/bifrost
-    ./scripts/destroy-env.sh
+    sudo ./scripts/destroy-env.sh
 
 7. Run deployment script to spin up 3 vms with bifrost: jumphost, controller and compute::
 
index f092a65..86d7bc4 100755 (executable)
@@ -7,6 +7,13 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
+
+# We need to execute everything as root
+if [[ $(whoami) != "root" ]]; then
+    echo "Error: This script must be run as root!"
+    exit 1
+fi
+
 virsh destroy jumphost.opnfvlocal || true
 virsh destroy controller00.opnfvlocal || true
 virsh destroy compute00.opnfvlocal || true
@@ -22,7 +29,7 @@ mysql -u root ironic --execute "delete from node_tags;"
 mysql -u root ironic --execute "delete from nodes;"
 mysql -u root ironic --execute "delete from conductors;"
 echo "removing leases"
-> /var/lib/dnsmasq/dnsmasq.leases
+[[ -e /var/lib/misc/dnsmasq/dnsmasq.leases ]] && > /var/lib/misc/dnsmasq/dnsmasq.leases
 echo "removing logs"
 rm -rf /var/log/libvirt/baremetal_logs/*.log
 
@@ -38,6 +45,7 @@ fi
 rm -rf /var/lib/libvirt/images/*.qcow2
 
 echo "restarting services"
+service dnsmasq restart
 service libvirtd restart
 service ironic-api restart
 service ironic-conductor start
index 2e106be..f5e3d9a 100755 (executable)
@@ -48,8 +48,8 @@ def format_bottlenecks_for_dashboard(case, results):
     then build the call to the specific method
     """
     if check_bottlenecks_case_exist(case):
-        cmd = "format_" + case + "_for_dashboard(results)"
-        res = eval(cmd)
+        cmd = "format_" + case + "_for_dashboard"
+        res = globals()[cmd](results)
     else:
         res = []
         print "Test cases not declared"
index 121875d..42c6358 100644 (file)
@@ -14,7 +14,6 @@
 #
 # v0.1: basic example
 #
-import os
 import re
 import sys
 from functest2Dashboard import format_functest_for_dashboard, \
@@ -47,8 +46,8 @@ def check_dashboard_ready_project(test_project):
 
 
 def check_dashboard_ready_case(project, case):
-    cmd = "check_" + project + "_case_exist(case)"
-    return eval(cmd)
+    cmd = "check_" + project + "_case_exist"
+    return globals()[cmd](case)
 
 
 def get_dashboard_projects():
@@ -73,6 +72,5 @@ def get_dashboard_result(project, case, results=None):
     # project: project name
     # results: array of raw results pre-filterded
     # according to the parameters of the request
-    cmd = "format_" + project + "_for_dashboard(case,results)"
-    res = eval(cmd)
-    return res
+    cmd = "format_" + project + "_for_dashboard"
+    return globals()[cmd](case, results)
index 38b23ab..5b1f190 100644 (file)
@@ -36,8 +36,8 @@ def format_doctor_for_dashboard(case, results):
         # note we add _case because testcase and project had the same name
         # TODO refactoring...looks fine at the beginning wit only 1 project
         # not very ugly now and clearly not optimized...
-        cmd = "format_" + case.replace('-','_') + "_case_for_dashboard(results)"
-        res = eval(cmd)
+        cmd = "format_" + case.replace('-','_') + "_case_for_dashboard"
+        res = globals()[cmd](results)
     else:
         res = []
     return res
index 86521b9..01697f7 100644 (file)
@@ -34,8 +34,8 @@ def format_functest_for_dashboard(case, results):
     then build the call to the specific method
     """
     if check_functest_case_exist(case):
-        cmd = "format_" + case + "_for_dashboard(results)"
-        res = eval(cmd)
+        cmd = "format_" + case + "_for_dashboard"
+        res = globals()[cmd](results)
     else:
         res = []
         print "Test cases not declared"
index 84f43a7..c96341f 100644 (file)
@@ -14,9 +14,6 @@
 # a new method format_<Test_case>_for_dashboard(results)
 # v0.1: basic example with methods for odl, Tempest, Rally and vPing
 #
-import re
-import datetime
-
 
 def get_promise_cases():
     """
@@ -36,8 +33,8 @@ def format_promise_for_dashboard(case, results):
         # note we add _case because testcase and project had the same name
         # TODO refactoring...looks fine at the beginning wit only 1 project
         # not very ugly now and clearly not optimized...
-        cmd = "format_" + case + "_case_for_dashboard(results)"
-        res = eval(cmd)
+        cmd = "format_" + case + "_case_for_dashboard"
+        res = globals()[cmd](results)
     else:
         res = []
         print "Test cases not declared"
index 4f022d5..4df4b50 100644 (file)
@@ -16,7 +16,6 @@
 #       Fio, Lmbench, Perf, Cyclictest.
 #
 
-
 def get_yardstick_cases():
     """
     get the list of the supported test cases
@@ -33,8 +32,8 @@ def format_yardstick_for_dashboard(case, results):
     then build the call to the specific method
     """
     if check_yardstick_case_exist(case):
-        cmd = "format_" + case + "_for_dashboard(results)"
-        res = eval(cmd)
+        cmd = "format_" + case + "_for_dashboard"
+        res = globals()[cmd](results)
     else:
         res = []
         print "Test cases not declared"
index f98c35e..5059f5d 100644 (file)
@@ -23,8 +23,8 @@
 import json
 from datetime import datetime
 
-from tornado.web import RequestHandler, asynchronous, HTTPError
 from tornado import gen
+from tornado.web import RequestHandler, asynchronous, HTTPError
 
 from models import CreateResponse
 from opnfv_testapi.common.constants import DEFAULT_REPRESENTATION, \
@@ -217,7 +217,8 @@ class GenericApiHandler(RequestHandler):
         return equal, query
 
     def _eval_db(self, table, method, *args, **kwargs):
-        return eval('self.db.%s.%s(*args, **kwargs)' % (table, method))
+        exec_collection = self.db.__getattr__(table)
+        return exec_collection.__getattribute__(method)(*args, **kwargs)
 
     def _eval_db_find_one(self, query, table=None):
         if table is None:
index 4509692..3dd87e6 100644 (file)
@@ -181,6 +181,10 @@ class MemDb(object):
                 self._check_keys(doc.get(key))
 
 
+def __getattr__(name):
+    return globals()[name]
+
+
 pods = MemDb()
 projects = MemDb()
 testcases = MemDb()
index 8f729c0..27ec763 100644 (file)
@@ -8,9 +8,10 @@
 ##############################################################################
 import unittest
 
-from test_result import TestResultBase
 from opnfv_testapi.common.constants import HTTP_NOT_FOUND, HTTP_OK
 
+from test_result import TestResultBase
+
 
 class TestDashboardBase(TestResultBase):
     def setUp(self):
@@ -63,7 +64,7 @@ class TestDashboardQuery(TestDashboardBase):
             if k == 'self' or k == 'uri':
                 continue
             if v is None:
-                v = eval('self.' + k)
+                v = self.__getattribute__(k)
             if v != 'missing':
                 uri += '{}={}&'.format(k, v)
         uri += 'pod={}&'.format(self.pod)
index 9a1253e..5f50ba8 100644 (file)
@@ -115,7 +115,8 @@ class MyTest(AsyncHTTPTestCase):
             self.assertEqual(name_error, error)
 
     def _eval_pods_db(self, method, *args, **kwargs):
-        return eval('self.db.pods.%s(*args, **kwargs)' % method)
+        table_obj = vars(self.db)['pods']
+        return table_obj.__getattribute__(method)(*args, **kwargs)
 
 
 if __name__ == '__main__':
index eee06c6..8479b35 100644 (file)
@@ -305,7 +305,7 @@ class TestResultGet(TestResultBase):
 
     def _set_query(self, *args):
         def get_value(arg):
-            return eval('self.' + arg) \
+            return self.__getattribute__(arg) \
                 if arg != 'trust_indicator' else self.trust_indicator.current
         uri = ''
         for arg in args:
index 9744dd9..1a4d5a1 100644 (file)
@@ -45,6 +45,7 @@ docs_old2New = {
     #     ({'case_name': 'ovno'}, {'case_name': 'ocl'})
     # ]
     'results': [
-        ({'trust_indicator': 0}, {'trust_indicator': {'current': 0, 'histories': []}})
+        ({'trust_indicator': 0},
+         {'trust_indicator': {'current': 0, 'histories': []}})
     ]
 }
index b1e378d..ba4334a 100644 (file)
@@ -10,7 +10,8 @@ import argparse
 
 from pymongo import MongoClient
 
-from changes_in_mongodb import collections_old2New, fields_old2New, docs_old2New
+from changes_in_mongodb import collections_old2New, \
+    fields_old2New, docs_old2New
 from utils import main, parse_mongodb_url
 
 parser = argparse.ArgumentParser(description='Update MongoDBs')
@@ -54,11 +55,13 @@ def change_docs(a_dict):
 
 
 def eval_db(method, *args, **kwargs):
-    return eval('db.%s(*args, **kwargs)' % method)
+    exec_db = db.__getattribute__(method)
+    return exec_db(*args, **kwargs)
 
 
 def eval_collection(collection, method, *args, **kwargs):
-    return eval('db.%s.%s(*args, **kwargs)' % (collection, method))
+    exec_collection = db.__getattr__(collection)
+    return exec_collection.__getattribute__(method)(*args, **kwargs)
 
 
 def collection_update(a_dict, operator):