[Puppet] PuppetInstance.applyManifest added
You can now apply Puppet manifest from MuranoPL directly Change-Id: I38c5cd4c2f8af194d42931ef2d70f5d8b158cac1
This commit is contained in:
parent
7af5ba3e1d
commit
cd7543a865
@ -139,3 +139,27 @@ Methods:
|
||||
code => $code
|
||||
))
|
||||
- Return: $.agent.call($template, $resources)
|
||||
#
|
||||
# Apply manifest
|
||||
#
|
||||
# Usage example:
|
||||
# - $fileContent: $resources.string('example.pp')
|
||||
# - $.instance1.applyManifest($fileContent)
|
||||
#
|
||||
# The code above is equal to:
|
||||
# puppet apply example.pp
|
||||
#
|
||||
applyManifest:
|
||||
Arguments:
|
||||
- manifest:
|
||||
Contract: $.string().notNull()
|
||||
- timeout:
|
||||
Contract: $.int().notNull()
|
||||
Default: 600
|
||||
Body:
|
||||
- $resources: new(sys:Resources)
|
||||
- $parameters:
|
||||
manifestContent: base64encode($manifest)
|
||||
- $template: $resources.yaml('ApplyManifest.template').bind($parameters)
|
||||
|
||||
- Return: $this.agent.call($template, $resources, $timeout)
|
37
murano-apps/Puppet/package/Resources/ApplyManifest.template
Normal file
37
murano-apps/Puppet/package/Resources/ApplyManifest.template
Normal file
@ -0,0 +1,37 @@
|
||||
# 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.
|
||||
FormatVersion: 2.1.0
|
||||
Version: 1.0.0
|
||||
Name: Apply Puppet Manifest
|
||||
|
||||
Parameters:
|
||||
|
||||
Body: |
|
||||
applyManifest()
|
||||
|
||||
Files:
|
||||
manifest:
|
||||
BodyType: Base64
|
||||
Name: site.pp
|
||||
Body: $manifestContent
|
||||
|
||||
Scripts:
|
||||
applyManifest:
|
||||
Type: Application
|
||||
Version: 1.0.0
|
||||
EntryPoint: apply_manifest.sh
|
||||
Files:
|
||||
- site.pp
|
||||
Options:
|
||||
captureStdout: true
|
||||
captureStderr: true
|
||||
verifyExitcode: true
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set +e
|
||||
|
||||
puppet apply --detailed-exitcodes --color=false "site.pp"
|
||||
|
||||
PUPPET_RETURN=$?
|
||||
if [ "${PUPPET_RETURN}" -eq 4 ] || [ "${PUPPET_RETURN}" -eq 6 ] ; then
|
||||
exit ${PUPPET_RETURN}
|
||||
fi
|
||||
|
||||
set -e
|
Loading…
x
Reference in New Issue
Block a user