hiera_loader 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/hiera_loader.rb +34 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 812efc5f37cf994dff6fb89cf067b3574d55d80f
|
4
|
+
data.tar.gz: 274af89baf1ea646417e2915494e2236d0a18990
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0961d37a7c555a0db9b3042d6d8f1f4f7cf750c5b538444dc970f6ea0a307b655d42a8fbda51d35c03338df9b9c021660994f70ec4e1dac662085dbc0b75349
|
7
|
+
data.tar.gz: b14bc1e0a589b760f88c3cf6e58ae5622ffe87d4688127e7045d1b275eeaef34b1d3b3a7648f75be9470c6033ccb37db35e869773cd165441c8497bb764f7703
|
data/lib/hiera_loader.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright 2015 Adaptavist.com Ltd.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'hiera'
|
16
|
+
|
17
|
+
class HieraLoader
|
18
|
+
|
19
|
+
attr_accessor :hiera, :scope
|
20
|
+
|
21
|
+
def initialize(scope, config = 'hiera.yaml')
|
22
|
+
@hiera = Hiera.new(:config => config)
|
23
|
+
@scope = scope
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_config(key, is_required=true)
|
27
|
+
val = @hiera.lookup(key, nil, @scope)
|
28
|
+
if is_required == true and !val
|
29
|
+
puts "Required config #{key} not found. Please provide."
|
30
|
+
raise "Required config #{key} not found. Please provide."
|
31
|
+
end
|
32
|
+
val
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hiera_loader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Brehovsky
|
8
|
+
- Jon Bevan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.6'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: hiera
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: Access to hiera variables. Requires hiera.yaml and scope defined.
|
57
|
+
email:
|
58
|
+
- mbrehovsky@adaptavist.com
|
59
|
+
- jbevan@adaptavist.com
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- lib/hiera_loader.rb
|
65
|
+
homepage: https://github.org/Adaptavist/hiera_loader
|
66
|
+
licenses:
|
67
|
+
- Apache-2.0
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.2.0
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Helper methods to return values from hiera config.
|
89
|
+
test_files: []
|