ansible: Fix custom 'influxdb_host' setting for grafana
[barometer.git] / baro_tests / collectd.py
index 3d78762..4148c27 100644 (file)
@@ -23,6 +23,8 @@ import time
 import logging
 import config_server
 import tests
+import local_agent
+from distutils import version
 from opnfv.deployment import factory
 
 AODH_NAME = 'aodh'
@@ -649,7 +651,7 @@ def mcelog_install():
     for node in nodes:
         if node.is_compute():
             centos_release = node.run_cmd('uname -r')
-            if centos_release not in ('3.10.0-514.26.2.el7.x86_64', '3.10.0-693.17.1.el7.x86_64'):
+            if version.LooseVersion(centos_release) < version.LooseVersion('3.10.0-514.26.2.el7.x86_64'):
                 logger.info(
                     'Mcelog will NOT be enabled on node-{}.'
                     + ' Unsupported CentOS release found ({}).'.format(
@@ -792,15 +794,15 @@ def main(bt_logger=None):
         compute_node_names.append(node_name)
         plugins_to_enable = []
         error_plugins = []
-        gnocchi_running = (
+        gnocchi_running_com = (
             gnocchi_running and conf.check_gnocchi_plugin_included(
                 compute_node))
-        aodh_running = (
+        aodh_running_com = (
             aodh_running and conf.check_aodh_plugin_included(compute_node))
         # logger.info("SNMP enabled on {}" .format(node_name))
-        if gnocchi_running:
+        if gnocchi_running_com:
             out_plugins[node_id].append("Gnocchi")
-        if aodh_running:
+        if aodh_running_com:
             out_plugins[node_id].append("AODH")
         if snmp_running:
             out_plugins[node_id].append("SNMP")
@@ -865,14 +867,19 @@ def main(bt_logger=None):
     print_overall_summary(
         compute_ids, plugin_labels, aodh_plugin_labels, results, out_plugins)
 
+    res_overall = 0
     for res in results:
-        if res[3] is 'False' or 'None':
+        if not res[3]:
             logger.error('Some tests have failed or have not been executed')
             logger.error('Overall Result is Fail')
-            return 1
+            res_overall = 1
         else:
             pass
-    return 0
+
+    _print_label('Testing LocalAgent on compute nodes')
+    res_agent = local_agent.local_agent_main(logger, conf, computes)
+
+    return 0 if res_overall == 0 and res_agent == 0 else 1
 
 
 if __name__ == '__main__':