Merge "Add validation on role names"

This commit is contained in:
Zuul 2018-04-26 09:58:52 +00:00 committed by Gerrit Code Review
commit c71ffb5740
3 changed files with 16 additions and 4 deletions

View File

@ -1,7 +1,7 @@
############################################################################### ###############################################################################
# Role: Controller # # Role: ControllerStorageNfs #
############################################################################### ###############################################################################
- name: Controller - name: ControllerStorageNfs
description: | description: |
Controller role that has all the controler services loaded and handles Controller role that has all the controler services loaded and handles
Database, Messaging and Network functions. Database, Messaging and Network functions.

View File

@ -1,7 +1,7 @@
############################################################################### ###############################################################################
# Role: Undercloud # # Role: UndercloudLight #
############################################################################### ###############################################################################
- name: Undercloud - name: UndercloudLight
description: | description: |
EXPERIMENTAL. A role to deploy the minimal undercloud for pre-provisioned EXPERIMENTAL. A role to deploy the minimal undercloud for pre-provisioned
deployed servers via heat using the 'openstack undercloud deploy' command. deployed servers via heat using the 'openstack undercloud deploy' command.

View File

@ -245,6 +245,15 @@ def validate_endpoint_map(base_map, env_map):
return sorted(base_map.keys()) == sorted(env_map.keys()) return sorted(base_map.keys()) == sorted(env_map.keys())
def validate_role_name(filename):
role_data = yaml.load(open(filename).read())[0]
if role_data['name'] != os.path.basename(filename).split('.')[0]:
print('ERROR: role name should match file name for role : %s.'
% filename)
return 1
return 0
def validate_hci_compute_services_default(env_filename, env_tpl): def validate_hci_compute_services_default(env_filename, env_tpl):
env_services_list = env_tpl['parameter_defaults']['ComputeServices'] env_services_list = env_tpl['parameter_defaults']['ComputeServices']
env_services_list.remove('OS::TripleO::Services::CephOSD') env_services_list.remove('OS::TripleO::Services::CephOSD')
@ -931,6 +940,9 @@ def validate(filename, param_map):
if filename.endswith('hyperconverged-ceph.yaml'): if filename.endswith('hyperconverged-ceph.yaml'):
retval |= validate_hci_compute_services_default(filename, tpl) retval |= validate_hci_compute_services_default(filename, tpl)
if filename.startswith('./roles/'):
retval = validate_role_name(filename)
if filename.startswith('./roles/ComputeHCI.yaml'): if filename.startswith('./roles/ComputeHCI.yaml'):
retval |= validate_hci_computehci_role(filename, tpl) retval |= validate_hci_computehci_role(filename, tpl)