Add validation on role names
Also, fixes role templates that weren't passing this new validation. Closes-bug: #1756346 Change-Id: I387386a0d7cf47fe11f24a68b9f2bb2ee2f0b7bd
This commit is contained in:
parent
1bec57e977
commit
3b56c9e501
@ -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.
|
||||||
|
@ -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.
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user