61 lines
1.7 KiB
YAML
61 lines
1.7 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
|
|
|
|
Name: Hiera
|
|
|
|
Properties:
|
|
dataFilePath:
|
|
Contract: $.string()
|
|
Default: '/etc/puppet/hieradata/murano.yaml'
|
|
configFilePath:
|
|
Contract: $.string()
|
|
Default: '/etc/puppet/hiera.yaml'
|
|
configFile:
|
|
Contract: $.class(YamlFile)
|
|
dataFile:
|
|
Contract: $.class(YamlFile)
|
|
|
|
Methods:
|
|
.init:
|
|
Body:
|
|
- $this.configFile: new(YamlFile, path => $this.configFilePath)
|
|
- $this.dataFile: new(YamlFile, path => $this.dataFilePath)
|
|
# add new data file to hiera
|
|
# this file is the only one to store all data passed using Hiera class
|
|
- $config: dict(':hierarchy' => 'murano')
|
|
- $this.configFile.putData($config)
|
|
|
|
putData:
|
|
Arguments:
|
|
- data:
|
|
Contract: {}
|
|
Body:
|
|
- $this.dataFile.putData($data)
|
|
|
|
syncronize:
|
|
Arguments:
|
|
instance:
|
|
Contract: $.class(PuppetInstance).notNull()
|
|
Body:
|
|
- $tool: new(YamlTool)
|
|
- $tool.update(
|
|
$instance,
|
|
$this.configFile.path,
|
|
$this.configFile.data)
|
|
- $tool.update(
|
|
$instance,
|
|
$this.dataFile.path,
|
|
$this.dataFile.data)
|