Merge "Add more classes to Instance inheritance hierarchy"

This commit is contained in:
Jenkins 2014-05-13 16:39:34 +00:00 committed by Gerrit Code Review
commit 36ace6b00b
6 changed files with 123 additions and 53 deletions

View File

@ -124,58 +124,5 @@ Workflow:
Arguments:
- groupName:
Contract: $.string().notNull()
Body:
# TODO: This is a temporary (and quite dirty) workaround. It should be
# implemented using polymorphism, by overriding parts of this method in
# derived classes related to particular OS type
# However bug #1314618 does not allow to do it
- If: !yaql "'w' in toLower($.image)"
Then:
- $rules:
- ToPort: 3389
IpProtocol: tcp
FromPort: 3389
External: true
Else:
- $rules:
- ToPort: 22
IpProtocol: tcp
FromPort: 22
External: true
- $.environment.securityGroupManager.addGroupIngress(
rules => $rules, groupName => $groupName)
getDefaultSecurityRules:
prepareUserData:
Body:
# TODO: This is a temporary (and quite dirty) workaround. It should be
# implemented using polymorphism, by overriding parts of this method in
# derived classes related to particular OS type
# However bug #1314618 does not allow to do it
- If: !yaql "'w' in toLower($.image)"
Then:
- $configFile: $.resources.string('Agent-v1.template')
- $initScript: $.resources.string('windows-init.ps1')
Else:
- $configFile: $.resources.string('Agent-v2.template')
- $initScript: $.resources.string('linux-init.sh')
- $configReplacements:
"%RABBITMQ_HOST%": config(rabbitmq, host)
"%RABBITMQ_PORT%": config(rabbitmq, port)
"%RABBITMQ_USER%": config(rabbitmq, login)
"%RABBITMQ_PASSWORD%": config(rabbitmq, password)
"%RABBITMQ_VHOST%": config(rabbitmq, virtual_host)
"%RABBITMQ_SSL%": str(config(rabbitmq, ssl)).toLower()
"%RABBITMQ_INPUT_QUEUE%": $.agent.queueName()
"%RESULT_QUEUE%": $.environment.agentListener.queueName()
- $scriptReplacements:
"%AGENT_CONFIG_BASE64%": base64encode($configFile.replace($configReplacements))
"%INTERNAL_HOSTNAME%": $.name
"%MURANO_SERVER_ADDRESS%": coalesce(config(file_server), config(rabbitmq, host))
"%CA_ROOT_CERT_BASE64%": ""
- Return: $initScript.replace($scriptReplacements)

View File

@ -0,0 +1,21 @@
Namespaces:
=: io.murano.resources
std: io.murano
Name: LinuxInstance
Extends: Instance
Workflow:
createDefaultInstanceSecurityGroupRules:
Arguments:
- groupName:
Contract: $.string().notNull()
Body:
- $rules:
- ToPort: 22
IpProtocol: tcp
FromPort: 22
External: true
- $.environment.securityGroupManager.addGroupIngress(
rules => $rules, groupName => $groupName)

View File

@ -0,0 +1,30 @@
Namespaces:
=: io.murano.resources
std: io.murano
Name: LinuxMuranoInstance
Extends:
- LinuxInstance
Workflow:
prepareUserData:
Body:
- $configFile: $.resources.string('Agent-v2.template')
- $initScript: $.resources.string('linux-init.sh')
- $configReplacements:
"%RABBITMQ_HOST%": config(rabbitmq, host)
"%RABBITMQ_PORT%": config(rabbitmq, port)
"%RABBITMQ_USER%": config(rabbitmq, login)
"%RABBITMQ_PASSWORD%": config(rabbitmq, password)
"%RABBITMQ_VHOST%": config(rabbitmq, virtual_host)
"%RABBITMQ_SSL%": str(config(rabbitmq, ssl)).toLower()
"%RABBITMQ_INPUT_QUEUE%": $.agent.queueName()
"%RESULT_QUEUE%": $.environment.agentListener.queueName()
- $scriptReplacements:
"%AGENT_CONFIG_BASE64%": base64encode($configFile.replace($configReplacements))
"%INTERNAL_HOSTNAME%": $.name
"%MURANO_SERVER_ADDRESS%": coalesce(config(file_server), config(rabbitmq, host))
"%CA_ROOT_CERT_BASE64%": ""
- Return: $initScript.replace($scriptReplacements)

View File

@ -0,0 +1,26 @@
Namespaces:
=: io.murano.resources
std: io.murano
Name: LinuxUDInstance
Extends:
- LinuxInstance
Properties:
customUserData:
Contract: $.string()
Usage: InOut
Default: null
Workflow:
prepareUserData:
Body:
- Return: $.customUserData
setCustomUserData:
Arguments:
- data:
Contract: $.string().notNull()
Body:
- $.customUserData: $data

View File

@ -0,0 +1,41 @@
Namespaces:
=: io.murano.resources
std: io.murano
Name: WindowsInstance
Extends: Instance
Workflow:
createDefaultInstanceSecurityGroupRules:
Arguments:
- groupName:
Contract: $.string().notNull()
Body:
- $rules:
- ToPort: 3389
IpProtocol: tcp
FromPort: 3389
External: true
- $.environment.securityGroupManager.addGroupIngress(
rules => $rules, groupName => $groupName)
prepareUserData:
Body:
- $configFile: $.resources.string('Agent-v1.template')
- $initScript: $.resources.string('windows-init.ps1')
- $configReplacements:
"%RABBITMQ_HOST%": config(rabbitmq, host)
"%RABBITMQ_PORT%": config(rabbitmq, port)
"%RABBITMQ_USER%": config(rabbitmq, login)
"%RABBITMQ_PASSWORD%": config(rabbitmq, password)
"%RABBITMQ_VHOST%": config(rabbitmq, virtual_host)
"%RABBITMQ_SSL%": str(config(rabbitmq, ssl)).toLower()
"%RABBITMQ_INPUT_QUEUE%": $.agent.queueName()
"%RESULT_QUEUE%": $.environment.agentListener.queueName()
- $scriptReplacements:
"%AGENT_CONFIG_BASE64%": base64encode($configFile.replace($configReplacements))
"%INTERNAL_HOSTNAME%": $.name
"%MURANO_SERVER_ADDRESS%": coalesce(config(file_server), config(rabbitmq, host))
"%CA_ROOT_CERT_BASE64%": ""
- Return: $initScript.replace($scriptReplacements)

View File

@ -22,3 +22,8 @@ Classes:
io.murano.resources.Network: resources/Network.yaml
io.murano.resources.Instance: resources/Instance.yaml
io.murano.resources.LinuxInstance: resources/LinuxInstance.yaml
io.murano.resources.LinuxMuranoInstance: resources/LinuxMuranoInstance.yaml
io.murano.resources.LinuxUDInstance: resources/LinuxUDInstance.yaml
io.murano.resources.WindowsInstance: resources/WindowsInstance.yaml