Merge "Rename manifests to make their names match 'full_service_name'."

This commit is contained in:
Jenkins 2013-11-26 15:14:58 +00:00 committed by Gerrit Code Review
commit 465e1fe248
15 changed files with 86 additions and 94 deletions

View File

@ -0,0 +1,36 @@
agent:
- CreatePrimaryDC.template
- LeaveDomain.template
- SetPassword.template
- CreateSecondaryDC.template
- AskDnsIp.template
- JoinDomain.template
author: ''
description: <strong> The Active Directory Service </strong> includes one primary
and optionally a few secondary Domain Controllers, with DNS
enabled: true
full_service_name: activeDirectory
heat:
- RouterInterface.template
- Windows.template
- Network.template
- Param.template
- Subnet.template
- InstancePortWSubnet.template
- InstancePort.template
scripts:
- Install-RoleSecondaryDomainController.ps1
- Install-RolePrimaryDomainController.ps1
- Join-Domain.ps1
- ImportCoreFunctions.ps1
- Get-DnsListeningIpAddress.ps1
- Set-LocalUserPassword.ps1
service_display_name: Active Directory
service_version: ''
ui:
- ActiveDirectory.yaml
version: '0.1'
workflows:
- AD.xml
- Networking.xml
- Common.xml

View File

@ -1,46 +0,0 @@
version: 0.1
service_display_name: Active Directory
description: >-
<strong> The Active Directory Service </strong>
includes one primary and optionally a few secondary
Domain Controllers, with DNS
full_service_name: activeDirectory
author: Mirantis Inc.
service_version: 1.0
enabled: True
ui:
- ActiveDirectory.yaml
workflows:
- AD.xml
- Networking.xml
- Common.xml
heat:
- Windows.template
- InstancePort.template
- InstancePortWSubnet.template
- Network.template
- Param.template
- RouterInterface.template
- Subnet.template
agent:
- SetPassword.template
- CreatePrimaryDC.template
- AskDnsIp.template
- LeaveDomain.template
- JoinDomain.template
- CreateSecondaryDC.template
scripts:
- ImportCoreFunctions.ps1
- Set-LocalUserPassword.ps1
- Get-DnsListeningIpAddress.ps1
- Get-DnsListeningIpAddress.ps1
- Join-Domain.ps1
- Install-RolePrimaryDomainController.ps1
- Install-RoleSecondaryDomainController.ps1

View File

@ -1,32 +0,0 @@
version: 0.1
service_display_name: Demo Service
description: >-
<strong> Demo Service </strong>
shows how Murano is working.
full_service_name: demoService
author: Mirantis Inc.
service_version: 1.0
enabled: True
ui:
- Demo.yaml
workflows:
- Demo.xml
- Common.xml
- Networking.xml
heat:
- Demo.template
- InstancePort.template
- InstancePortWSubnet.template
- Network.template
- Param.template
- RouterInterface.template
- Subnet.template
agent:
- Demo.template

View File

@ -0,0 +1,24 @@
agent:
- Demo.template
author: ''
description: <strong> Demo Service </strong> shows how Murano is working.
enabled: true
full_service_name: demoService
heat:
- Demo.template
- RouterInterface.template
- Network.template
- Param.template
- Subnet.template
- InstancePortWSubnet.template
- InstancePort.template
scripts: []
service_display_name: Demo Service 11
service_version: ''
ui:
- Demo.yaml
version: '0.1'
workflows:
- Networking.xml
- Common.xml
- Demo.xml

View File

@ -165,7 +165,7 @@ def perform_deletion(files_for_deletion, manifest_for_deletion):
backup_dir = backup_data()
service_name = manifest_for_deletion.full_service_name
path_to_manifest = os.path.join(CONF.manifests,
manifest_for_deletion.manifest_file_name)
'{0}-manifest.yaml'.format(service_name))
try:
if os.path.exists(path_to_manifest):
log.debug('Deleting manifest file {0}'.format(path_to_manifest))

View File

@ -223,6 +223,13 @@ def create_service(service_name):
service_data = json.loads(request.data)
except:
return make_response('Unable to load json data', 500)
service_id = service_data.get('full_service_name')
if not service_id or service_id != service_name:
return make_response(
"Body attribute 'full_service_name' value is {0} which doesn't "
"correspond to 'service_name' part of URL (equals to {1})".format(
service_id, service_name), 400)
resp = api.create_service(service_name, service_data)
api.reset_cache()
return resp

View File

@ -52,8 +52,16 @@ class ManifestParser(object):
self.manifest_directory = manifest_directory
def _validate_manifest(self, file, service_manifest_data):
service_id = service_manifest_data.get('full_service_name')
if not service_id or '{0}-manifest.yaml'.format(service_id) != file:
log.error("Attribute 'full_service_name' inside manifest '{0}' "
"has value '{1}' which doesn't correspond to its "
"filename, skipping this manifest completely."
"".format(file, service_id))
return False, False
valid_file_info = True
for key, value in service_manifest_data.iteritems():
valid_file_info = True
if key in DATA_TYPES:
if key != MANIFEST:
root_directory = os.path.join(self.manifest_directory,
@ -78,7 +86,7 @@ class ManifestParser(object):
"doesn't exist at {2}".format(filename,
file,
absolute_path))
return valid_file_info
return valid_file_info, True
def parse(self):
manifests = []
@ -99,23 +107,18 @@ class ManifestParser(object):
"The reason: {1!s}".format(manifest_file,
exc))
continue
manifest_data['manifest_file_name'] = file
manifest_is_valid = self._validate_manifest(file,
manifest_data)
manifest_data["valid"] = manifest_is_valid
manifests.append(Manifest(manifest_data))
manifest_is_valid, use_manifest = self._validate_manifest(
file, manifest_data)
if use_manifest:
manifest_data["valid"] = manifest_is_valid
manifests.append(Manifest(manifest_data))
return manifests
def _get_manifest_path(self, service_name):
# ToDO: Rename manifests to it's id and remove this func
manifests = self.parse()
for manifest in manifests:
if manifest.full_service_name == service_name:
path_to_manifest = os.path.join(self.manifest_directory,
manifest.manifest_file_name)
return path_to_manifest
return None
return os.path.join(self.manifest_directory,
'{0}-manifest.yaml'.format(service_name))
def toggle_enabled(self, service_name):
path_to_manifest = self._get_manifest_path(service_name)