murano/meta/io.murano/Classes/configuration/Linux.yaml

85 lines
2.5 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:
=: io.murano.configuration
std: io.murano
sys: io.murano.system
Name: Linux
Methods:
runCommand:
Arguments:
- agent:
Contract: $.class(sys:Agent)
- command:
Contract: $.string().notNull()
- helpText:
Contract: $.string()
Default: null
- captureStderr:
Contract: $.bool().notNull()
Default: true
- captureStdout:
Contract: $.bool().notNull()
Default: true
- ignoreErrors:
Contract: $.bool().notNull()
Default: false
Body:
- $resources: new(sys:Resources)
- If: $helpText != null
Then:
- $planName: $helpText
Else:
- $planName: format('Execute {0}', $command)
- $template: $resources.yaml('RunCommand.template').bind(dict(
command => $command,
planName => $planName,
captureStderr => $captureStderr,
captureStdout => $captureStdout,
verifyExitcode => not $ignoreErrors
))
- Return: $agent.call($template, $resources)
putFile:
Arguments:
- agent:
Contract: $.class(sys:Agent)
- fileContent:
Contract: $.string().notNull()
- path:
Contract: $.string().notNull()
- helpText:
Contract: $.string()
Default: null
- ignoreErrors:
Contract: $.bool().notNull()
Default: false
Body:
- $data: base64encode($fileContent)
- $resources: new(sys:Resources)
- If: $helpText != null
Then:
- $planName: $helpText
Else:
- $planName: format('Put to {0}', $path)
- $template: $resources.yaml('PutFile.template').bind(dict(
path => $path,
fileContent => $data,
planName => $planName,
verifyExitcode => not $ignoreErrors
))
- Return: $agent.call($template, $resources)