Sergey Kraynev 5e046b2169 Fix indentation warnings CI/CD
After patch Ia2498bdb0f7c310ec3d2c2f11f5d3fc08c8b352c there is possible to
run check for yaml and shell syntax.
This patch is oriented to fix some similar Warnings reported in yaml
syntax check for CI/CD apps, like "(indentation)".

Change-Id: Ie2d854e6feef6362ea07d6132e71072dae49b5d7
2016-08-03 17:14:47 +03:00

91 lines
2.2 KiB
YAML

Namespaces:
=: org.openstack.ci_cd_pipeline_murano_app.puppet.net
std: io.murano
res: io.murano.resources
sys: io.murano.system
puppet: org.openstack.ci_cd_pipeline_murano_app.puppet
conf: io.murano.configuration
Name: Hosts
Properties:
# The list of entries to be added to /etc/hosts
hosts:
Contract: {}
Usage: InOut
Methods:
#
# Add new entry to be put into /etc/hosts
#
addHost:
Arguments:
- hostname:
Contract: $.string().notNull()
- ip:
Contract: $.string().notNull()
- aliases:
Contract:
- $.string()
Default: list()
Body:
- $this.hosts[$hostname]:
name: $hostname
ip: $ip
host_aliases: $aliases
#
# Ask instance it's hostname and add it by calling addHost
#
addHostByInstance:
Arguments:
- instance:
Contract: $.class(res:LinuxMuranoInstance).notNull()
- aliases:
Contract:
- $.string()
Default: list()
Body:
- $hostname: $this.getHostName($instance, true)
- $shortname: $this.getHostName($instance, false)
- $aliases: $aliases.append($shortname)
- $ip: $instance.ipAddresses[0]
- $this.addHost(hostname=>$hostname, ip=>$ip, aliases=>$aliases)
#
# Get the hostname which gives us OS
#
getHostName:
Arguments:
- instance:
Contract: $.class(res:LinuxMuranoInstance).notNull()
- fqdn:
Contract: $.bool().notNull()
Default: false
Body:
- $linux: new(conf:Linux)
- If: $fqdn
Then:
- Return: $linux.runCommand($instance.agent, 'hostname -f').stdout
- Return: $linux.runCommand($instance.agent, 'hostname -s').stdout
# Put all of the hosts to the particular instance
# All of the data will be added to the hiera
# and then puppet scenario will generate hosts entries
#
applyTo:
Arguments:
- instance:
Contract: $.class(puppet:PuppetInstance)
Body:
- $data:
hosts: $this.hosts
- $instance.putHieraData($data)
- $instance.syncHieraData()
- $resources: new(sys:Resources)
- $instance.executeInline("create_resources('host', hiera('hosts'))")