murano-apps/Puppet/MySQLPuppet/package/Classes/MySQLPuppet.yaml

56 lines
1.6 KiB
YAML

Namespaces:
=: io.murano.conflang.puppet.MySQLPuppet
std: io.murano
res: io.murano.resources
sys: io.murano.system
Name: MySQLPuppet
Extends: std:Application
Properties:
port:
Contract: $.string().notNull()
instance:
Contract: $.class(res:Instance).notNull()
Methods:
initialize:
Body:
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- If: not $.getAttr(deployed, false)
Then:
- $._environment.reporter.report($this, 'Creating VM for Puppet example ')
- $securityGroupIngress:
- ToPort: $.port
FromPort: $.port
IpProtocol: tcp
External: true
- ToPort: 22
FromPort: 22
IpProtocol: tcp
External: true
- $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $.instance.deploy()
- $resources: new(sys:Resources)
# Deploy Puppet example
- $template: $resources.yaml('DeployMySQLPuppet.template').bind(dict( port => $.port))
- $._environment.reporter.report($this, 'Instance is created. Deploying MySQL Puppet example')
- $.instance.agent.call($template, $resources)
- If: $.instance.assignFloatingIp
Then:
- $host: $.instance.floatingIpAddress
Else:
- $host: $.instance.ipAddresses[0]
- $._environment.reporter.report($this, format('MySQL Puppet example is installed at {0} on {1} port', $host, $.port))
- $.setAttr(deployed, true)