ci-cd-pipeline-app-murano/murano-apps/Puppet/package/Classes/PuppetClient.yaml

69 lines
1.9 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
Namespaces:
=: org.openstack.ci_cd_pipeline_murano_app.puppet
conf: io.murano.configuration
sys: io.murano.system
Name: PuppetClient
Properties:
instance:
Contract: $.class(PuppetInstance).notNull()
role:
Contract: $.string().notNull()
Methods:
configure:
Body:
- $this.instance.setHieraValue( 'node_role', $this.role)
- $this.instance.applyManifest(
new(sys:Resources).string('scripts/server/puppet_client.pp'))
#
# useful to be sure that certificate request was sent to a server
#
testRun:
Body:
# non zero return until certificate is not signed
- $res: new(conf:Linux).runCommand(
agent => $this.instance.agent,
command => 'puppet agent --test',
ignoreErrors => true,
captureStdout => false,
captureStderr => false).stdout
- Return: $res
#
# Run puppet agent.
# Get manifest from the server and apply it
#
runPuppetAgent:
Body:
- $command: >
puppet agent --config /etc/puppet/puppet.conf
--onetime --no-daemonize --verbose --no-splay
- $res: new(conf:Linux).runCommand(
agent => $this.instance.agent,
command => $command,
ignoreErrors => false,
captureStdout => false,
captureStderr => true).stdout
- Return: $res