Include domain at time of customer creation
Change-Id: I2887302af6ac44574d9423d197abd71ec92c386b
This commit is contained in:
parent
87b2ddb084
commit
340a0aecd8
@ -289,6 +289,9 @@ OrmRdsGroup = [
|
|||||||
cfg.StrOpt('repo_email',
|
cfg.StrOpt('repo_email',
|
||||||
default='orm@test.com',
|
default='orm@test.com',
|
||||||
help='Repo email address.'),
|
help='Repo email address.'),
|
||||||
|
cfg.StrOpt('customer_domain',
|
||||||
|
default='Default',
|
||||||
|
help='Keystone project domain'),
|
||||||
cfg.StrOpt('log',
|
cfg.StrOpt('log',
|
||||||
default='rds.log',
|
default='rds.log',
|
||||||
help='Rds log name.')
|
help='Rds log name.')
|
||||||
@ -376,6 +379,7 @@ rds = {'port': CONF.rds.port,
|
|||||||
'repo_remote_location': CONF.rds.repo_remote_location,
|
'repo_remote_location': CONF.rds.repo_remote_location,
|
||||||
'repo_user': CONF.rds.repo_user,
|
'repo_user': CONF.rds.repo_user,
|
||||||
'repo_email': CONF.rds.repo_email,
|
'repo_email': CONF.rds.repo_email,
|
||||||
|
'customer_domain': CONF.rds.customer_domain,
|
||||||
'base_url': '{}://{}:{}/'.format(protocol, orm_host, CONF.rds.port),
|
'base_url': '{}://{}:{}/'.format(protocol, orm_host, CONF.rds.port),
|
||||||
'log': '{}/{}'.format(CONF.log_location, CONF.rds.log)}
|
'log': '{}/{}'.format(CONF.log_location, CONF.rds.log)}
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ UUID_URL = config.uuid['base_url'] + 'v1/uuids'
|
|||||||
# yaml configurations
|
# yaml configurations
|
||||||
yaml_configs = {
|
yaml_configs = {
|
||||||
'customer_yaml': {
|
'customer_yaml': {
|
||||||
|
'customer_domain': config.rds['customer_domain'],
|
||||||
'yaml_version': '2014-10-16',
|
'yaml_version': '2014-10-16',
|
||||||
'yaml_options': {
|
'yaml_options': {
|
||||||
'quotas': True,
|
'quotas': True,
|
||||||
|
@ -61,6 +61,7 @@ def yamlbuilder(alldata, region):
|
|||||||
resources = {}
|
resources = {}
|
||||||
yaml_version = conf.yaml_configs.customer_yaml.yaml_version
|
yaml_version = conf.yaml_configs.customer_yaml.yaml_version
|
||||||
yaml_type = conf.yaml_configs.customer_yaml.yaml_options.type
|
yaml_type = conf.yaml_configs.customer_yaml.yaml_options.type
|
||||||
|
domain = conf.yaml_configs.customer_yaml.customer_domain
|
||||||
title = {'heat_template_version': yaml_version}
|
title = {'heat_template_version': yaml_version}
|
||||||
description = {'description': 'yaml file for region - %s' % region['name']}
|
description = {'description': 'yaml file for region - %s' % region['name']}
|
||||||
jsondata = alldata
|
jsondata = alldata
|
||||||
@ -78,6 +79,7 @@ def yamlbuilder(alldata, region):
|
|||||||
'properties': {'name': "%s" % project_name,
|
'properties': {'name': "%s" % project_name,
|
||||||
'project_id': alldata['uuid'],
|
'project_id': alldata['uuid'],
|
||||||
'description': project_description,
|
'description': project_description,
|
||||||
|
'domain': domain,
|
||||||
'tags': _metadata_to_tags(alldata['metadata']),
|
'tags': _metadata_to_tags(alldata['metadata']),
|
||||||
'enabled': status}}
|
'enabled': status}}
|
||||||
|
|
||||||
@ -111,11 +113,11 @@ def yamlbuilder(alldata, region):
|
|||||||
resources['resources'][group_name] = \
|
resources['resources'][group_name] = \
|
||||||
{'type': 'OS::Keystone::Group\n',
|
{'type': 'OS::Keystone::Group\n',
|
||||||
'properties': {'name': "%s" % group_name,
|
'properties': {'name': "%s" % group_name,
|
||||||
'domain': 'default',
|
'domain': domain,
|
||||||
'description': 'dummy',
|
'description': 'dummy',
|
||||||
'roles': any_role}}
|
'roles': any_role}}
|
||||||
|
|
||||||
# remove groupe section when type is ldap
|
# remove group section when type is ldap
|
||||||
# create users :: added the hard coded groupe
|
# create users :: added the hard coded groupe
|
||||||
user_group = ["{'get_resource': '%s'}" % group_name]
|
user_group = ["{'get_resource': '%s'}" % group_name]
|
||||||
resources['resources'][user['id']] = \
|
resources['resources'][user['id']] = \
|
||||||
|
@ -58,6 +58,7 @@ UUID_URL = 'http://127.0.0.1:8090/v1/uuids'
|
|||||||
|
|
||||||
yaml_configs = {
|
yaml_configs = {
|
||||||
'customer_yaml': {
|
'customer_yaml': {
|
||||||
|
'customer_domain': 'default',
|
||||||
'yaml_version': '2014-10-16',
|
'yaml_version': '2014-10-16',
|
||||||
'yaml_options': {
|
'yaml_options': {
|
||||||
'quotas': True,
|
'quotas': True,
|
||||||
|
@ -89,7 +89,7 @@ fullyaml_with_users_quotasoff = \
|
|||||||
'{get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId2_group}\n name: userId2\n roles:\n ' \
|
'{get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66_userId2_group}\n name: userId2\n roles:\n ' \
|
||||||
'- project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n role: storage\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 ' \
|
' type: OS::Keystone::User\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
||||||
'description: this is a description\n enabled: true\n ' \
|
'description: this is a description\n domain: default\n enabled: true\n ' \
|
||||||
'tags: [my_server_name=Apache1,ocx_cust=123456889]\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 ' \
|
'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 ' \
|
'\n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group:\n properties:\n description: dummy\n ' \
|
||||||
@ -117,8 +117,9 @@ fullyaml_no_users_quotasoff = \
|
|||||||
' role: storagezzzzz\n type: OS::Keystone::User\n\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' \
|
'\n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n description: this is a description\n' \
|
||||||
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n' \
|
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n' \
|
||||||
' enabled: true\n name: welcome_man\n ' \
|
' enabled: true\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_userId1zzzz_group:\n ' \
|
' domain: default\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 ' \
|
'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' \
|
'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' \
|
' role: {get_resource: otherzzzzz}\n type: OS::Keystone::Group\n\n' \
|
||||||
@ -152,6 +153,7 @@ 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' \
|
'name: userId2\n roles:\n - project: {get_resource: 1e24981a-fa51-11e5-86aa-5e5517507c66}\n' \
|
||||||
' role: storage\n type: OS::Keystone::User\n\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' \
|
'\n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n description: this is a description\n' \
|
||||||
|
' domain: default\n' \
|
||||||
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n' \
|
' tags: [my_server_name=Apache1,ocx_cust=123456889]\n' \
|
||||||
' enabled: true\n name: welcome_man\n' \
|
' enabled: true\n name: welcome_man\n' \
|
||||||
' project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
' project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
||||||
@ -192,6 +194,7 @@ full_yaml_quotas = 'heat_template_version: 2015-1-1\n\ndescription: yaml file fo
|
|||||||
'role: storagezzzzz\n type: OS::Keystone::User\n\n' \
|
'role: storagezzzzz\n type: OS::Keystone::User\n\n' \
|
||||||
' \n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
' \n 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
||||||
'description: this is a description\n ' \
|
'description: this is a description\n ' \
|
||||||
|
'domain: default\n ' \
|
||||||
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
||||||
'enabled: true\n name: welcome_man\n ' \
|
'enabled: true\n name: welcome_man\n ' \
|
||||||
'project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
'project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
||||||
@ -223,6 +226,7 @@ full_yaml_ldap = 'heat_template_version: 2015-1-2\n\ndescription: yaml file' \
|
|||||||
'type: OS::Keystone::UserRoleAssignment\n\n \n ' \
|
'type: OS::Keystone::UserRoleAssignment\n\n \n ' \
|
||||||
'1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
'1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n ' \
|
||||||
'description: this is a description\n ' \
|
'description: this is a description\n ' \
|
||||||
|
'domain: default\n ' \
|
||||||
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
'tags: [my_server_name=Apache1,ocx_cust=123456889]\n ' \
|
||||||
'enabled: true\n name: welcome_man\n ' \
|
'enabled: true\n name: welcome_man\n ' \
|
||||||
'project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
'project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n ' \
|
||||||
@ -236,7 +240,7 @@ fullyaml_aic4 = \
|
|||||||
'heat_template_version: 2015-1-2\n\n'\
|
'heat_template_version: 2015-1-2\n\n'\
|
||||||
'description: yaml file for region - regionname\n\nresources:\n'\
|
'description: yaml file for region - regionname\n\nresources:\n'\
|
||||||
' 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n'\
|
' 1e24981a-fa51-11e5-86aa-5e5517507c66:\n properties:\n'\
|
||||||
' description: "this is a description"\n enabled: true\n'\
|
' description: "this is a description"\n domain: default\n enabled: true\n'\
|
||||||
' name: welcome_man\n project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n'\
|
' name: welcome_man\n project_id: 1e24981a-fa51-11e5-86aa-5e5517507c66\n'\
|
||||||
' tags: [my_server_name=Apache1,ocx_cust=123456889]\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'\
|
' type: OS::Keystone::Project\n\n \n 1e24981a-fa51-11e5-86aa-5e5517507c66_userId1_group:\n'\
|
||||||
@ -280,6 +284,7 @@ class CreateResource(unittest.TestCase):
|
|||||||
def test_create_customer_yaml_nousers(self, mock_conf):
|
def test_create_customer_yaml_nousers(self, mock_conf):
|
||||||
"""test valid dict to yaml output as expected without users."""
|
"""test valid dict to yaml output as expected without users."""
|
||||||
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-1'
|
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-1'
|
||||||
|
domain = mock_conf.yaml_configs.customer_yaml.customer_domain = 'default'
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = False
|
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = False
|
||||||
yamlfile = CustomerBuild.yamlbuilder(alldata, region_quotas)
|
yamlfile = CustomerBuild.yamlbuilder(alldata, region_quotas)
|
||||||
yamlfile_as_json = yaml.safe_load(yamlfile)
|
yamlfile_as_json = yaml.safe_load(yamlfile)
|
||||||
@ -290,6 +295,7 @@ class CreateResource(unittest.TestCase):
|
|||||||
def test_create_flavor_yaml_noquotas(self, mock_conf):
|
def test_create_flavor_yaml_noquotas(self, mock_conf):
|
||||||
"""test valid dict to yaml output as expected with users."""
|
"""test valid dict to yaml output as expected with users."""
|
||||||
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-2'
|
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-2'
|
||||||
|
domain = mock_conf.yaml_configs.customer_yaml.customer_domain = 'default'
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = False
|
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = False
|
||||||
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users)
|
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users)
|
||||||
yamlfile_as_json = yaml.safe_load(yamlfile)
|
yamlfile_as_json = yaml.safe_load(yamlfile)
|
||||||
@ -300,6 +306,7 @@ class CreateResource(unittest.TestCase):
|
|||||||
def test_create_customer_yaml_noquotas_on(self, mock_conf):
|
def test_create_customer_yaml_noquotas_on(self, mock_conf):
|
||||||
"""test valid dict to yaml output as expected with default regions."""
|
"""test valid dict to yaml output as expected with default regions."""
|
||||||
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-1'
|
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-1'
|
||||||
|
domain = mock_conf.yaml_configs.customer_yaml.customer_domain = 'default'
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = True
|
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = True
|
||||||
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users)
|
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users)
|
||||||
yamlfile_as_json = yaml.safe_load(yamlfile)
|
yamlfile_as_json = yaml.safe_load(yamlfile)
|
||||||
@ -310,6 +317,7 @@ class CreateResource(unittest.TestCase):
|
|||||||
def test_create_customer_yaml_withquotas_on(self, mock_conf):
|
def test_create_customer_yaml_withquotas_on(self, mock_conf):
|
||||||
"""valid dict to yaml output as expect with regions default users."""
|
"""valid dict to yaml output as expect with regions default users."""
|
||||||
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-1'
|
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-1'
|
||||||
|
domain = mock_conf.yaml_configs.customer_yaml.customer_domain = 'default'
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = True
|
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = True
|
||||||
yamlfile = CustomerBuild.yamlbuilder(alldata, region_quotas)
|
yamlfile = CustomerBuild.yamlbuilder(alldata, region_quotas)
|
||||||
yamlfile_as_json = yaml.safe_load(yamlfile)
|
yamlfile_as_json = yaml.safe_load(yamlfile)
|
||||||
@ -320,16 +328,19 @@ class CreateResource(unittest.TestCase):
|
|||||||
def test_create_flavor_yaml_ldap(self, mock_conf):
|
def test_create_flavor_yaml_ldap(self, mock_conf):
|
||||||
"""test valid dict to yaml output as expected with ldap system."""
|
"""test valid dict to yaml output as expected with ldap system."""
|
||||||
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-2'
|
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-2'
|
||||||
|
domain = mock_conf.yaml_configs.customer_yaml.customer_domain = 'default'
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = False
|
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = False
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.type = "ldap"
|
mock_conf.yaml_configs.customer_yaml.yaml_options.type = "ldap"
|
||||||
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users)
|
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users)
|
||||||
yamlfile_as_json = yaml.safe_load(yamlfile)
|
yamlfile_as_json = yaml.safe_load(yamlfile)
|
||||||
self.assertEqual(yamlfile_as_json['heat_template_version'], ver)
|
self.assertEqual(yamlfile_as_json['heat_template_version'], ver)
|
||||||
|
|
||||||
self.assertEqual(yaml.safe_load(yamlfile), yaml.safe_load(full_yaml_ldap))
|
self.assertEqual(yaml.safe_load(yamlfile), yaml.safe_load(full_yaml_ldap))
|
||||||
|
|
||||||
@patch.object(CustomerBuild, 'conf')
|
@patch.object(CustomerBuild, 'conf')
|
||||||
def test_create_aicV4_customer_yaml(self, mock_conf):
|
def test_create_aicV4_customer_yaml(self, mock_conf):
|
||||||
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-2'
|
ver = mock_conf.yaml_configs.customer_yaml.yaml_version = '2015-1-2'
|
||||||
|
domain = mock_conf.yaml_configs.customer_yaml.customer_domain = 'default'
|
||||||
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = True
|
mock_conf.yaml_configs.customer_yaml.yaml_options.quotas = True
|
||||||
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users_v4)
|
yamlfile = CustomerBuild.yamlbuilder(alldata, region_users_v4)
|
||||||
yamlfile_as_json = yaml.safe_load(yamlfile)
|
yamlfile_as_json = yaml.safe_load(yamlfile)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user