diff options
-rw-r--r-- | glance.yaml | 1 | ||||
-rw-r--r-- | heat.yaml | 1 | ||||
-rw-r--r-- | keystone.yaml | 1 | ||||
-rw-r--r-- | merge.py | 29 | ||||
-rw-r--r-- | quantum.yaml | 1 | ||||
-rw-r--r-- | rabbitmq.yaml | 1 |
6 files changed, 31 insertions, 3 deletions
diff --git a/glance.yaml b/glance.yaml index af75b224..b5c0079f 100644 --- a/glance.yaml +++ b/glance.yaml @@ -48,6 +48,7 @@ Resources: InstanceType: {Ref: InstanceType} KeyName: {Ref: KeyName} Metadata: + OpenStack::Role: stateless OpenStack::ImageBuilder::Elements: [ glance ] heat: access_key_id: @@ -83,7 +83,6 @@ Resources: {Ref: HeatApiImage} InstanceType: {Ref: InstanceType} KeyName: {Ref: KeyName} - UserData: "#!/bin/bash\ntouch /tmp/userdata-finished\necho Userdata finished $(date)\n" HeatAPI: Type: OS::Heat::InstanceGroup Properties: diff --git a/keystone.yaml b/keystone.yaml index 5c55c115..e4b96d71 100644 --- a/keystone.yaml +++ b/keystone.yaml @@ -38,6 +38,7 @@ Resources: InstanceType: {Ref: InstanceType} KeyName: {Ref: KeyName} Metadata: + OpenStack::Role: stateless OpenStack::ImageBuilder::Elements: [ keystone ] heat: access_key_id: @@ -1,7 +1,33 @@ import sys import yaml +import argparse -templates = list(sys.argv[1:]) +parser = argparse.ArgumentParser() +parser.add_argument('templates', nargs='+') +parser.add_argument('--master-role', nargs='?', + help='Translate slave_roles to this') +parser.add_argument('--slave-roles', nargs='*', + help='Translate all of these to master_role') + +args = parser.parse_args() + +templates = args.templates + +def _translate_role(role): + global args + if not args.master_role: + return role + if role == args.master_role: + return role + if role not in args.slave_roles: + return role + return args.master_role + +def translate_role(role): + r = _translate_role(role) + if not isinstance(r, basestring): + raise Exception('%s -> %r' % (role, r)) + return r errors = [] end_template={'HeatTemplateFormatVersion': '2012-12-12', @@ -39,6 +65,7 @@ for template_path in templates: # XXX Assuming ImageId is always a Ref del end_template['Parameters'][rbody['Properties']['ImageId']['Ref']] role = rbody.get('Metadata', {}).get('OpenStack::Role', r) + role = translate_role(role) if role != r: resource_changes.append((r, role)) if role in end_template.get('Resources', {}): diff --git a/quantum.yaml b/quantum.yaml index c7eaed02..bc08f014 100644 --- a/quantum.yaml +++ b/quantum.yaml @@ -51,6 +51,7 @@ Resources: InstanceType: {Ref: InstanceType} KeyName: {Ref: KeyName} Metadata: + OpenStack::Role: networking OpenStack::ImageBuilder::Elements: [ quantum ] heat: access_key_id: diff --git a/rabbitmq.yaml b/rabbitmq.yaml index 701f2d04..d8fdb5f6 100644 --- a/rabbitmq.yaml +++ b/rabbitmq.yaml @@ -24,7 +24,6 @@ Resources: {Ref: RabbitMQImage} InstanceType: {Ref: InstanceType} KeyName: {Ref: KeyName} - UserData: "#!/bin/bash\ntouch /tmp/userdata-finished\necho Userdata finished $(date)\n" RabbitMQPasswordHandle: Type: AWS::CloudFormation::WaitConditionHandle RabbitMQPassword: |