Align hyperconverged-ceph.yaml environment and adds some validation
authorGiulio Fidente <gfidente@redhat.com>
Tue, 28 Feb 2017 17:55:55 +0000 (18:55 +0100)
committerGiulio Fidente <gfidente@redhat.com>
Tue, 28 Feb 2017 17:55:55 +0000 (18:55 +0100)
Until bug #1635409 is fixed we'll have to keep the default list
of services deployed by hyperconverged-ceph.yaml in sync with the
ServicesDefault list provided in roles_data.yaml

This change adds some logic in the templates validation script to
ensure that is preserved with future updates.

Change-Id: Ib767f9a24c3541b16f96bd6b6455cf797113fbd8

environments/hyperconverged-ceph.yaml
tools/yaml-validate.py

index 3738072..f59b041 100644 (file)
@@ -29,3 +29,5 @@ parameter_defaults:
     - OS::TripleO::Services::AuditD
     - OS::TripleO::Services::Collectd
     - OS::TripleO::Services::CephOSD
+    - OS::TripleO::Services::Vpp
+    - OS::TripleO::Services::MySQLClient
index 1d0dba0..32987cb 100755 (executable)
@@ -54,6 +54,21 @@ def validate_endpoint_map(base_map, env_map):
     return sorted(base_map.keys()) == sorted(env_map.keys())
 
 
+def validate_hci_compute_services_default(env_filename, env_tpl):
+    env_services_list = env_tpl['parameter_defaults']['ComputeServices']
+    env_services_list.remove('OS::TripleO::Services::CephOSD')
+    roles_filename = os.path.join(os.path.dirname(env_filename),
+                                  '../roles_data.yaml')
+    roles_tpl = yaml.load(open(roles_filename).read())
+    for role in roles_tpl:
+        if role['name'] == 'Compute':
+            roles_services_list = role['ServicesDefault']
+            if sorted(env_services_list) != sorted(roles_services_list):
+                print('ERROR: ComputeServices in %s is different '
+                      'from ServicesDefault in roles_data.yaml' % env_filename)
+                return 1
+    return 0
+
 def validate_mysql_connection(settings):
     no_op = lambda *args: False
     error_status = [0]
@@ -143,6 +158,9 @@ def validate(filename):
                 filename != './puppet/services/services.yaml'):
             retval = validate_service(filename, tpl)
 
+        if filename.endswith('hyperconverged-ceph.yaml'):
+            retval = validate_hci_compute_services_default(filename, tpl)
+
     except Exception:
         print(traceback.format_exc())
         return 1