[US449915] NC 1.0 - Fixing CMS Heat Template for Ocata
Change-Id: I5ef61ae240d1d86fd6130db1014348dc9fe08d2b
This commit is contained in:
parent
242640c855
commit
c7be34dfb1
@ -83,11 +83,18 @@ yaml_configs = {
|
||||
'yaml_keys': {
|
||||
'quotas_keys': {
|
||||
'keypairs': 'key_pairs',
|
||||
'network': 'networks',
|
||||
'port': 'ports',
|
||||
'router': 'routers',
|
||||
'subnet': 'subnets',
|
||||
'floatingip': 'floating_ips'
|
||||
'security_group_rules': 'security_group_rule',
|
||||
'security_groups': 'security_group',
|
||||
'floating_ips': 'floatingip',
|
||||
'networks': 'network',
|
||||
'ports': 'port',
|
||||
'routers': 'router',
|
||||
'members': 'member',
|
||||
'health_monitors': 'health_monitor',
|
||||
'pools': 'pool',
|
||||
'vips': 'vip',
|
||||
'vcpus': 'cores',
|
||||
'subnets': 'subnet'
|
||||
}
|
||||
},
|
||||
'cms_template_version': {
|
||||
|
@ -41,20 +41,6 @@ def create_final_yaml(title, description, resources, outputs):
|
||||
return yamldata
|
||||
|
||||
|
||||
def _create_metadata_yaml(alldata):
|
||||
metadata = {}
|
||||
metadata_items = {}
|
||||
for item in alldata['metadata']:
|
||||
metadata_items.update(item)
|
||||
metadata['tenant_metadata'] = {'type': 'OS::Keystone::Metadata\n',
|
||||
'properties': {
|
||||
'TENANT_ID': "{'get_resource': '%s'}" %
|
||||
alldata['uuid'],
|
||||
'METADATA': {
|
||||
'metadata': metadata_items}}}
|
||||
return metadata
|
||||
|
||||
|
||||
def _metadata_to_tags(metadata):
|
||||
|
||||
return '[' + ','.join(
|
||||
@ -87,21 +73,15 @@ def yamlbuilder(alldata, region):
|
||||
outputs['outputs'] = {}
|
||||
resources['resources'] = {}
|
||||
|
||||
if region['rangerAgentVersion'] >= 4.0:
|
||||
resources['resources']["%s" % alldata['uuid']] =\
|
||||
{'type': 'OS::Keystone::Project\n',
|
||||
'properties': {'name': "%s" % project_name,
|
||||
'description': project_description,
|
||||
'tags': _metadata_to_tags(alldata['metadata']),
|
||||
'enabled': status}}
|
||||
else:
|
||||
resources['resources']["%s" % alldata['uuid']] =\
|
||||
{'type': 'OS::Keystone::Project2\n',
|
||||
'properties': {'name': "%s" % project_name,
|
||||
'project_id': alldata['uuid'],
|
||||
'description': project_description,
|
||||
'enabled': status}}
|
||||
# create the output
|
||||
resources['resources']["%s" % alldata['uuid']] =\
|
||||
{'type': 'OS::Keystone::Project\n',
|
||||
'properties': {'name': "%s" % project_name,
|
||||
'project_id': alldata['uuid'],
|
||||
'description': project_description,
|
||||
'tags': _metadata_to_tags(alldata['metadata']),
|
||||
'enabled': status}}
|
||||
|
||||
# create the output
|
||||
outputs['outputs']["%s_id" % alldata['uuid']] =\
|
||||
{"value": {"get_resource": "%s" % alldata['uuid']}}
|
||||
|
||||
@ -160,10 +140,6 @@ def yamlbuilder(alldata, region):
|
||||
adjust_quota_resource = CMSAdjustResource(region['rangerAgentVersion'])
|
||||
adjust_quota_resource.fix_quota_resource_item(alldata['uuid'], quotas, resources, options)
|
||||
|
||||
if region['rangerAgentVersion'] < 4.0:
|
||||
metadata = _create_metadata_yaml(alldata)
|
||||
resources['resources'].update(metadata)
|
||||
|
||||
# putting all parts together for full yaml
|
||||
yamldata = create_final_yaml(title, description, resources, outputs)
|
||||
logger.debug(
|
||||
@ -192,8 +168,8 @@ class CMSAdjustResource(object):
|
||||
|
||||
self.adjust_quota_parameters(ite, items[item])
|
||||
|
||||
# adding tenant to each quota
|
||||
items[item]['tenant'] = \
|
||||
# adding project to each quota
|
||||
items[item]['project'] = \
|
||||
"{'get_resource': %s}" % uuid
|
||||
resources['resources'][options[item][0]] = \
|
||||
{"type": options[item][1], "properties": items[item]}
|
||||
|
@ -66,11 +66,18 @@ yaml_configs = {
|
||||
'yaml_keys': {
|
||||
'quotas_keys': {
|
||||
'keypairs': 'key_pairs',
|
||||
'network': 'networks',
|
||||
'port': 'ports',
|
||||
'router': 'routers',
|
||||
'subnet': 'subnets',
|
||||
'floatingip': 'floating_ips'
|
||||
'security_group_rules': 'security_group_rule',
|
||||
'security_groups': 'security_group',
|
||||
'floating_ips': 'floatingip',
|
||||
'networks': 'network',
|
||||
'ports': 'port',
|
||||
'routers': 'router',
|
||||
'members': 'member',
|
||||
'health_monitors': 'health_monitor',
|
||||
'pools': 'pool',
|
||||
'vips': 'vip',
|
||||
'vcpus': 'cores',
|
||||
'subnets': 'subnet'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -80,10 +80,7 @@ full_region = {'users': [{'id': 'userId1', 'roles': ['admin', 'other']},
|
||||
|
||||
fullyaml_with_users_quotasoff = \
|
||||
'heat_template_version: 2015-1-2\n\ndescription: yaml file for region - ' \
|
||||
'regionname\n\nresources:\n tenant_metadata:\n' \
|
||||
' properties:\n METADATA:\n metadata:\n my_server_name: Apache1\n ' \
|
||||
' ocx_cust: 123456889\n TENANT_ID: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' type: OS::Keystone::Metadata\n\n \n userId1:\n ' \
|
||||
'regionname\n\nresources:\n userId1:\n ' \
|
||||
'properties:\n groups:\n - {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group}\n ' \
|
||||
'name: userId1\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' role: admin\n - project: {get_resource: ' \
|
||||
@ -93,7 +90,8 @@ fullyaml_with_users_quotasoff = \
|
||||
'- project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n role: storage\n' \
|
||||
' type: OS::Keystone::User\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
||||
'description: this is a description\n enabled: true\n ' \
|
||||
'name: welcome_man\n project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n type: OS::Keystone::Project2\n\n ' \
|
||||
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
||||
'name: welcome_man\n project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n type: OS::Keystone::Project\n\n ' \
|
||||
'\n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group:\n properties:\n description: dummy\n ' \
|
||||
'domain: default\n name: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group\n roles:\n - ' \
|
||||
'project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n role: {get_resource: other}\n ' \
|
||||
@ -108,10 +106,7 @@ fullyaml_with_users_quotasoff = \
|
||||
|
||||
fullyaml_no_users_quotasoff = \
|
||||
'heat_template_version: 2015-1-1\n\ndescription: yaml file for region ' \
|
||||
'- regionnametest\n\nresources:\n tenant_metadata:\n properties:\n' \
|
||||
' METADATA:\n metadata:\n my_server_name: Apache1\n ocx_cust: 123456889\n' \
|
||||
' TENANT_ID: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Keystone::Metadata\n\n \n userId1zzzz:\n properties:\n ' \
|
||||
'- regionnametest\n\nresources:\n userId1zzzz:\n properties:\n ' \
|
||||
'groups:\n - {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group}\n ' \
|
||||
'name: userId1zzzz\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' role: adminzzzz\n - ' \
|
||||
@ -121,8 +116,9 @@ fullyaml_no_users_quotasoff = \
|
||||
'name: userId2zzz\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' role: storagezzzzz\n type: OS::Keystone::User\n\n ' \
|
||||
'\n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n description: this is a description\n' \
|
||||
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n' \
|
||||
' enabled: true\n name: welcome_man\n ' \
|
||||
' project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n type: OS::Keystone::Project2\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group:\n ' \
|
||||
' project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n type: OS::Keystone::Project\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group:\n ' \
|
||||
'properties:\n description: dummy\n domain: default\n ' \
|
||||
'name: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' role: {get_resource: otherzzzzz}\n type: OS::Keystone::Group\n\n' \
|
||||
@ -136,18 +132,15 @@ fullyaml_no_users_quotasoff = \
|
||||
|
||||
full_yaml_default_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml file for region ' \
|
||||
'- regionname\n\nresources:\n cinder_quota:\n properties:\n ' \
|
||||
'gigabytes: 111\n snapshots: 111\n tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
'gigabytes: 111\n snapshots: 111\n project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' volumes: 111\n type: OS::Cinder::Quota\n\n ' \
|
||||
' \n neutron_quota:\n properties:\n floatingip: 111\n' \
|
||||
' network: 111\n port: 111\n router: 111\n subnet: 111\n' \
|
||||
' tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n type: OS::Neutron::Quota\n\n' \
|
||||
' project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n type: OS::Neutron::Quota\n\n' \
|
||||
' \n nova_quota:\n properties:\n injected_files: 111\n ' \
|
||||
'instances: 111\n keypairs: 111\n ram: 111\n ' \
|
||||
'tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Nova::Quota\n\n \n tenant_metadata:\n properties:\n METADATA:\n ' \
|
||||
' metadata:\n my_server_name: Apache1\n ocx_cust: 123456889\n ' \
|
||||
'TENANT_ID: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Keystone::Metadata\n\n \n userId1:\n' \
|
||||
'project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Nova::Quota\n\n \n userId1:\n' \
|
||||
' properties:\n groups:\n ' \
|
||||
'- {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group}\n name: userId1\n' \
|
||||
' roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
@ -159,9 +152,10 @@ full_yaml_default_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml
|
||||
'name: userId2\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' role: storage\n type: OS::Keystone::User\n\n ' \
|
||||
'\n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n description: this is a description\n' \
|
||||
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n' \
|
||||
' enabled: true\n name: welcome_man\n' \
|
||||
' project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
||||
'type: OS::Keystone::Project2\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group:\n' \
|
||||
'type: OS::Keystone::Project\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group:\n' \
|
||||
' properties:\n description: dummy\n domain: default\n' \
|
||||
' name: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group\n roles:\n' \
|
||||
' - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
@ -178,18 +172,15 @@ full_yaml_default_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml
|
||||
full_yaml_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml file for region - ' \
|
||||
'regionnametest\n\nresources:\n cinder_quota:\n ' \
|
||||
'properties:\n gigabytes: 10\n snapshots: 10\n ' \
|
||||
'tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n volumes: 10\n ' \
|
||||
'project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n volumes: 10\n ' \
|
||||
'type: OS::Cinder::Quota\n\n \n neutron_quota:\n ' \
|
||||
'properties:\n floatingip: 10\n network: 10\n ' \
|
||||
'port: 10\n router: 10\n subnet: 10\n ' \
|
||||
'tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Neutron::Quota\n\n \n nova_quota:\n ' \
|
||||
'properties:\n injected_files: 10\n instances: 10\n ' \
|
||||
'keypairs: 10\n ram: 10\n tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Nova::Quota\n\n \n tenant_metadata:\n ' \
|
||||
'properties:\n METADATA:\n metadata:\n my_server_name: Apache1\n' \
|
||||
' ocx_cust: 123456889\n TENANT_ID: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' type: OS::Keystone::Metadata\n\n \n userId1zzzz:\n properties:\n ' \
|
||||
'keypairs: 10\n ram: 10\n project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'type: OS::Nova::Quota\n\n \n userId1zzzz:\n properties:\n ' \
|
||||
'groups:\n - {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group}\n ' \
|
||||
'name: userId1zzzz\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' role: adminzzzz\n - project: ' \
|
||||
@ -201,9 +192,10 @@ full_yaml_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml file fo
|
||||
'role: storagezzzzz\n type: OS::Keystone::User\n\n' \
|
||||
' \n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
||||
'description: this is a description\n ' \
|
||||
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
||||
'enabled: true\n name: welcome_man\n ' \
|
||||
'project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
||||
'type: OS::Keystone::Project2\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group:\n' \
|
||||
'type: OS::Keystone::Project\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group:\n' \
|
||||
' properties:\n description: dummy\n ' \
|
||||
'domain: default\n name: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1zzzz_group\n roles:\n ' \
|
||||
'- project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
@ -218,10 +210,7 @@ full_yaml_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml file fo
|
||||
'value: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n'
|
||||
|
||||
full_yaml_ldap = 'heat_template_version: 2015-1-2\n\ndescription: yaml file' \
|
||||
' for region - regionname\n\nresources:\n tenant_metadata:\n ' \
|
||||
'properties:\n METADATA:\n metadata:\n my_server_name: Apache1\n' \
|
||||
' ocx_cust: 123456889\n TENANT_ID: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||
' type: OS::Keystone::Metadata\n\n \n userId1:\n ' \
|
||||
' for region - regionname\n\nresources:\n userId1:\n ' \
|
||||
'properties:\n roles:\n ' \
|
||||
'- project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n ' \
|
||||
'role: admin\n - project: ' \
|
||||
@ -234,9 +223,10 @@ full_yaml_ldap = 'heat_template_version: 2015-1-2\n\ndescription: yaml file' \
|
||||
'type: OS::Keystone::UserRoleAssignment\n\n \n ' \
|
||||
'1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
||||
'description: this is a description\n ' \
|
||||
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
||||
'enabled: true\n name: welcome_man\n ' \
|
||||
'project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
||||
'type: OS::Keystone::Project2\n\n \n\noutputs:\n ' \
|
||||
'type: OS::Keystone::Project\n\n \n\noutputs:\n ' \
|
||||
'userId1_id:\n ' \
|
||||
'value: {get_resource: userId1}\n userId2_id:\n ' \
|
||||
'value: {get_resource: userId2}\n 1e24981a-fa51-11e5-86aa-5e5517507c66_id:\n ' \
|
||||
@ -247,7 +237,8 @@ fullyaml_aic4 = \
|
||||
'description: yaml file for region - regionname\n\nresources:\n'\
|
||||
' 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n'\
|
||||
' description: "this is a description"\n enabled: true\n'\
|
||||
' name: welcome_man\n tags: [my_server_name=Apache1,ocx_cust=123456889]\n'\
|
||||
' name: welcome_man\n project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n'\
|
||||
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n'\
|
||||
' type: OS::Keystone::Project\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group:\n'\
|
||||
' properties:\n description: dummy\n domain: default\n'\
|
||||
' name: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group\n roles:\n'\
|
||||
@ -259,13 +250,13 @@ fullyaml_aic4 = \
|
||||
' - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n'\
|
||||
' role: {get_resource: storage}\n type: OS::Keystone::Group\n\n'\
|
||||
' \n cinder_quota:\n properties:\n gigabytes: 111\n snapshots: 111\n'\
|
||||
' tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n volumes: 111\n'\
|
||||
' project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n volumes: 111\n'\
|
||||
' type: OS::Cinder::Quota\n\n \n neutron_quota:\n properties:\n'\
|
||||
' floatingip: 111\n network: 111\n port: 111\n router: 111\n'\
|
||||
' subnet: 111\n tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n'\
|
||||
' subnet: 111\n project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n'\
|
||||
' type: OS::Neutron::Quota\n\n \n nova_quota:\n properties:\n'\
|
||||
' injected_files: 111\n instances: 111\n keypairs: 111\n'\
|
||||
' ram: 111\n tenant: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n'\
|
||||
' ram: 111\n project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n'\
|
||||
' type: OS::Nova::Quota\n\n \n userId1:\n properties:\n groups:\n'\
|
||||
' - {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group}\n'\
|
||||
' name: userId1\n roles:\n'\
|
||||
|
Loading…
x
Reference in New Issue
Block a user