Fixed issue with Key Pairs for Linux-based services

Modified UI forms and workflows for Linux services
Key Pair parameter moved to the last page of service
configuration form and this parameter is not required.

Implements: blueprint rewrite-key-pair-for-linux-based-services

Change-Id: I3c1a6bb075ecda4dd49ea2a8b86627723ffbb048
This commit is contained in:
TimurNurlygayanov 2013-12-06 17:32:43 +04:00
parent 9946642d01
commit abbc23ddad
8 changed files with 71 additions and 24 deletions

View File

@ -0,0 +1,9 @@
{
"Resources": {
"$instanceName": {
"Properties": {
"KeyName": "$keyName"
}
}
}
}

View File

@ -1,19 +1,10 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"KeyName": {
"Description": "Key Pair",
"Type": "String",
"Default": "$keyName"
}
},
"Resources": {
"$instanceName": {
"Type": "AWS::EC2::Instance",
"Properties": {
"KeyName": { "Ref" : "KeyName" },
"InstanceType": "$instanceType",
"ImageId": "$imageName",
"AvailabilityZone": "$availabilityZone",

View File

@ -30,6 +30,7 @@ heat:
- DefaultSecurity.template
- WebServerSecurity.template
- LinuxSecurity.template
- Keypair.template
agent:
- DeployApache.template

View File

@ -29,6 +29,7 @@ heat:
- DefaultSecurity.template
- LinuxSecurity.template
- TelnetSecurity.template
- Keypair.template
agent:
- DeployTelnet.template

View File

@ -27,11 +27,6 @@ forms:
label: Instance Count
description: Several instances with Apache web Service can be created at one time.
helpText: Enter an integer value between 1 and 10
- name: keyPair
type: keypair
label: Key Pair
description: >-
The Key Pair for VMs with this service
- name: unitNamingPattern
type: string
label: Hostname
@ -68,6 +63,13 @@ forms:
description: >-
Select valid image for a service. Image should already be prepared and
registered in glance.
- name: keyPair
type: keypair
label: Key Pair
description: >-
Select the Key Pair to control access to instances. You can login to
instances using this KeyPair after the deployment of service.
required: false
- name: availabilityZone
type: azone
label: Availability zone

View File

@ -27,11 +27,6 @@ forms:
hidden: true
attributeNames: units
initial: 1
- name: keyPair
type: keypair
label: Key Pair
description: >-
The Key Pair for VMs with this service
- name: unitNamingPattern
type: string
label: Hostname
@ -72,6 +67,13 @@ forms:
description: >-
Select valid image for a service. Image should already be prepared and
registered in glance.
- name: keyPair
type: keypair
label: Key Pair
description: >-
Select the Key Pair to control access to instances. You can login to
instances using this KeyPair after the deployment of service.
required: false
- name: availabilityZone
type: azone
label: Availability zone

View File

@ -1,4 +1,27 @@
<workflow>
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxApacheService' and @.keyPair)].units[?(not @.temp.KeyPairMapping)]"
desc="This rule allows to set Key Pair for all VMs with this service">
<update-cf-stack template="Keypair" result="outputs" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="keyName"><select path="::keyPair"/></mapping>
</map>
</parameter>
<success>
<set path="temp.KeyPairMapping"><true/></set>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to assign Key Pair on unit <select path="state.hostname"/> (<select path="name"/>) due to <format-error error="exception"/></parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<!-- Provisioning rules -->
<rule match="$.services[?(@.type == 'linuxApacheService' and not @.securityTemplates)]">
<set path="securityTemplates">
@ -26,9 +49,6 @@
<mapping name="instanceName">
<select path="state.hostname"/>
</mapping>
<mapping name="keyName">
<select path="::keyPair"/>
</mapping>
<mapping name="userData">
<prepare-user-data template="Linux" initFile="linux_init.sh">
<parameter name="hostname">

View File

@ -7,6 +7,29 @@
</list>
</set>
</rule>
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxTelnetService' and @.keyPair)].units[?(not @.temp.KeyPairMapping)]"
desc="This rule allows to set Key Pair for all VMs with this service">
<update-cf-stack template="Keypair" result="outputs" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="keyName"><select path="::keyPair"/></mapping>
</map>
</parameter>
<success>
<set path="temp.KeyPairMapping"><true/></set>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to assign Key Pair on unit <select path="state.hostname"/> (<select path="name"/>) due to <format-error error="exception"/></parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$[?(@.networking.state.ready_for_cf)].services[?(@.type == 'linuxTelnetService')].units[?(@.state.hostname and not @.temp.instanceName)]"
desc="Units of Linux Telnet service having hostname and image names assigned but without instances">
<report entity="unit">
@ -17,7 +40,6 @@
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="keyName"><select path="::keyPair"/></mapping>
<mapping name="userData">
<prepare-user-data template="Linux" initFile="linux_init.sh">
<parameter name="hostname"><select path="state.hostname"/></parameter>
@ -47,7 +69,6 @@
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'linuxTelnetService')].units[?(@.temp.instanceName and not @.state.TelnetInstalled)]"
desc="Units of Linux Telnet service which have got an instance deployed but have not got telnet service installed">
<report entity="unit">