murano/murano/tests/functional/engine/io.murano.conflang.chef.Exa.../Classes/ExampleChef.yaml

49 lines
1.3 KiB
YAML

Namespaces:
=: io.murano.conflang.chef
std: io.murano
res: io.murano.resources
sys: io.murano.system
Name: ExampleChef
Extends: std:Application
Properties:
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 Chef example ')
- $securityGroupIngress:
- ToPort: 22
FromPort: 22
IpProtocol: tcp
External: true
- $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $.instance.deploy()
- $resources: new(sys:Resources)
# Deploy Chef example
- $template: $resources.yaml('DeployExampleChef.template')
- $._environment.reporter.report($this, 'Instance is created. Deploying Chef example')
- $.instance.agent.call($template, $resources)
- If: $.instance.assignFloatingIp
Then:
- $host: $.instance.floatingIpAddress
Else:
- $host: $.instance.ipAddresses[0]
- $._environment.reporter.report($this, format('Chef example is installed at {0}', $host))
- $.setAttr(deployed, true)