hiera 2.0.0-x86-mingw32
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/COPYING +202 -0
- data/LICENSE +18 -0
- data/README.md +276 -0
- data/bin/hiera +248 -0
- data/lib/hiera.rb +115 -0
- data/lib/hiera/backend.rb +325 -0
- data/lib/hiera/backend/json_backend.rb +58 -0
- data/lib/hiera/backend/yaml_backend.rb +63 -0
- data/lib/hiera/config.rb +90 -0
- data/lib/hiera/console_logger.rb +13 -0
- data/lib/hiera/error.rb +4 -0
- data/lib/hiera/fallback_logger.rb +41 -0
- data/lib/hiera/filecache.rb +86 -0
- data/lib/hiera/interpolate.rb +98 -0
- data/lib/hiera/noop_logger.rb +8 -0
- data/lib/hiera/puppet_logger.rb +17 -0
- data/lib/hiera/recursive_guard.rb +20 -0
- data/lib/hiera/util.rb +47 -0
- data/lib/hiera/version.rb +89 -0
- data/spec/spec_helper.rb +78 -0
- data/spec/unit/backend/json_backend_spec.rb +85 -0
- data/spec/unit/backend/yaml_backend_spec.rb +138 -0
- data/spec/unit/backend_spec.rb +743 -0
- data/spec/unit/config_spec.rb +118 -0
- data/spec/unit/console_logger_spec.rb +19 -0
- data/spec/unit/fallback_logger_spec.rb +80 -0
- data/spec/unit/filecache_spec.rb +142 -0
- data/spec/unit/fixtures/interpolate/config/hiera.yaml +6 -0
- data/spec/unit/fixtures/interpolate/data/niltest.yaml +2 -0
- data/spec/unit/fixtures/interpolate/data/recursive.yaml +3 -0
- data/spec/unit/fixtures/override/config/hiera.yaml +5 -0
- data/spec/unit/fixtures/override/data/alternate.yaml +1 -0
- data/spec/unit/fixtures/override/data/common.yaml +2 -0
- data/spec/unit/hiera_spec.rb +81 -0
- data/spec/unit/interpolate_spec.rb +36 -0
- data/spec/unit/puppet_logger_spec.rb +31 -0
- data/spec/unit/util_spec.rb +49 -0
- data/spec/unit/version_spec.rb +44 -0
- metadata +142 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hiera/util'
|
3
|
+
|
4
|
+
describe "Hiera" do
|
5
|
+
context "when doing interpolation" do
|
6
|
+
let(:fixtures) { File.join(HieraSpec::FIXTURE_DIR, 'interpolate') }
|
7
|
+
|
8
|
+
it 'should prevent endless recursion' do
|
9
|
+
Hiera::Util.expects(:var_dir).at_least_once.returns(File.join(fixtures, 'data'))
|
10
|
+
hiera = Hiera.new(:config => File.join(fixtures, 'config', 'hiera.yaml'))
|
11
|
+
expect do
|
12
|
+
hiera.lookup('foo', nil, {})
|
13
|
+
end.to raise_error Hiera::InterpolationLoop, 'Detected in [hiera("bar"), hiera("foo")]'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when not finding value for interpolated key" do
|
18
|
+
let(:fixtures) { File.join(HieraSpec::FIXTURE_DIR, 'interpolate') }
|
19
|
+
|
20
|
+
it 'should resolve the interpolation to an empty string' do
|
21
|
+
Hiera::Util.expects(:var_dir).at_least_once.returns(File.join(fixtures, 'data'))
|
22
|
+
hiera = Hiera.new(:config => File.join(fixtures, 'config', 'hiera.yaml'))
|
23
|
+
expect(hiera.lookup('niltest', nil, {})).to eq('Missing key ##. Key with nil ##')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when doing interpolation with override" do
|
28
|
+
let(:fixtures) { File.join(HieraSpec::FIXTURE_DIR, 'override') }
|
29
|
+
|
30
|
+
it 'should resolve interpolation using the override' do
|
31
|
+
Hiera::Util.expects(:var_dir).at_least_once.returns(File.join(fixtures, 'data'))
|
32
|
+
hiera = Hiera.new(:config => File.join(fixtures, 'config', 'hiera.yaml'))
|
33
|
+
expect(hiera.lookup('foo', nil, {}, 'alternate')).to eq('alternate')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'hiera/puppet_logger'
|
2
|
+
|
3
|
+
describe Hiera::Puppet_logger do
|
4
|
+
it "is not suitable when Puppet is not defined" do
|
5
|
+
ensure_puppet_not_defined
|
6
|
+
|
7
|
+
Hiera::Puppet_logger.suitable?.should == false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "is suitable when Puppet is defined" do
|
11
|
+
ensure_puppet_defined
|
12
|
+
|
13
|
+
Hiera::Puppet_logger.suitable?.should == true
|
14
|
+
end
|
15
|
+
|
16
|
+
after :each do
|
17
|
+
ensure_puppet_not_defined
|
18
|
+
end
|
19
|
+
|
20
|
+
def ensure_puppet_defined
|
21
|
+
if !Kernel.const_defined? :Puppet
|
22
|
+
Kernel.const_set(:Puppet, "Fake Puppet")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def ensure_puppet_not_defined
|
27
|
+
if Kernel.const_defined? :Puppet
|
28
|
+
Kernel.send(:remove_const, :Puppet)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hiera::Util do
|
4
|
+
describe 'Hiera::Util.posix?' do
|
5
|
+
it 'should return true on posix systems' do
|
6
|
+
Etc.expects(:getpwuid).with(0).returns(true)
|
7
|
+
Hiera::Util.posix?.should be_true
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should return false on non posix systems' do
|
11
|
+
Etc.expects(:getpwuid).with(0).returns(nil)
|
12
|
+
Hiera::Util.posix?.should be_false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'Hiera::Util.microsoft_windows?' do
|
17
|
+
it 'should return false on posix systems' do
|
18
|
+
Hiera::Util.expects(:file_alt_separator).returns(nil)
|
19
|
+
Hiera::Util.microsoft_windows?.should be_false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'Hiera::Util.config_dir' do
|
24
|
+
it 'should return the correct path for posix systems' do
|
25
|
+
Hiera::Util.expects(:file_alt_separator).returns(nil)
|
26
|
+
Hiera::Util.config_dir.should == '/etc/puppetlabs/code'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should return the correct path for microsoft windows systems' do
|
30
|
+
Hiera::Util.expects(:microsoft_windows?).returns(true)
|
31
|
+
Hiera::Util.expects(:common_appdata).returns('C:\\ProgramData')
|
32
|
+
Hiera::Util.config_dir.should == 'C:\\ProgramData/PuppetLabs/code'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'Hiera::Util.var_dir' do
|
37
|
+
it 'should return the correct path for posix systems' do
|
38
|
+
Hiera::Util.expects(:file_alt_separator).returns(nil)
|
39
|
+
Hiera::Util.var_dir.should == '/etc/puppetlabs/code/hieradata'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should return the correct path for microsoft windows systems' do
|
43
|
+
Hiera::Util.expects(:microsoft_windows?).returns(true)
|
44
|
+
Hiera::Util.expects(:common_appdata).returns('C:\\ProgramData')
|
45
|
+
Hiera::Util.var_dir.should == 'C:\\ProgramData/PuppetLabs/code/hieradata'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "hiera/version"
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
describe "Hiera.version Public API" do
|
6
|
+
subject() { Hiera }
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
Hiera.instance_eval do
|
10
|
+
if @hiera_version
|
11
|
+
@hiera_version = nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "without a VERSION file" do
|
17
|
+
before :each do
|
18
|
+
subject.stubs(:read_version_file).returns(nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "is Hiera::VERSION" do
|
22
|
+
subject.version.should == Hiera::VERSION
|
23
|
+
end
|
24
|
+
it "respects the version= setter" do
|
25
|
+
subject.version = '1.2.3'
|
26
|
+
subject.version.should == '1.2.3'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "with a VERSION file" do
|
31
|
+
it "is the content of the file" do
|
32
|
+
subject.expects(:read_version_file).with() do |path|
|
33
|
+
pathname = Pathname.new(path)
|
34
|
+
pathname.basename.to_s == "VERSION"
|
35
|
+
end.returns('1.2.1-9-g9fda440')
|
36
|
+
|
37
|
+
subject.version.should == '1.2.1-9-g9fda440'
|
38
|
+
end
|
39
|
+
it "respects the version= setter" do
|
40
|
+
subject.version = '1.2.3'
|
41
|
+
subject.version.should == '1.2.3'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hiera
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: x86-mingw32
|
6
|
+
authors:
|
7
|
+
- Puppet Labs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json_pure
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: win32console
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: win32-dir
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.4.8
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.8
|
55
|
+
description: A pluggable data store for hierarcical data
|
56
|
+
email: info@puppetlabs.com
|
57
|
+
executables:
|
58
|
+
- hiera
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- bin/hiera
|
63
|
+
- lib/hiera/backend.rb
|
64
|
+
- lib/hiera/backend/json_backend.rb
|
65
|
+
- lib/hiera/backend/yaml_backend.rb
|
66
|
+
- lib/hiera/config.rb
|
67
|
+
- lib/hiera/console_logger.rb
|
68
|
+
- lib/hiera/error.rb
|
69
|
+
- lib/hiera/fallback_logger.rb
|
70
|
+
- lib/hiera/filecache.rb
|
71
|
+
- lib/hiera/interpolate.rb
|
72
|
+
- lib/hiera/noop_logger.rb
|
73
|
+
- lib/hiera/puppet_logger.rb
|
74
|
+
- lib/hiera/recursive_guard.rb
|
75
|
+
- lib/hiera/util.rb
|
76
|
+
- lib/hiera/version.rb
|
77
|
+
- lib/hiera.rb
|
78
|
+
- COPYING
|
79
|
+
- README.md
|
80
|
+
- LICENSE
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
- spec/unit/backend/json_backend_spec.rb
|
83
|
+
- spec/unit/backend/yaml_backend_spec.rb
|
84
|
+
- spec/unit/backend_spec.rb
|
85
|
+
- spec/unit/config_spec.rb
|
86
|
+
- spec/unit/console_logger_spec.rb
|
87
|
+
- spec/unit/fallback_logger_spec.rb
|
88
|
+
- spec/unit/filecache_spec.rb
|
89
|
+
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
90
|
+
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
91
|
+
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
92
|
+
- spec/unit/fixtures/override/config/hiera.yaml
|
93
|
+
- spec/unit/fixtures/override/data/alternate.yaml
|
94
|
+
- spec/unit/fixtures/override/data/common.yaml
|
95
|
+
- spec/unit/hiera_spec.rb
|
96
|
+
- spec/unit/interpolate_spec.rb
|
97
|
+
- spec/unit/puppet_logger_spec.rb
|
98
|
+
- spec/unit/util_spec.rb
|
99
|
+
- spec/unit/version_spec.rb
|
100
|
+
homepage: https://github.com/puppetlabs/hiera
|
101
|
+
licenses: []
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.0.14
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Light weight hierarchical data store
|
123
|
+
test_files:
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/unit/backend/json_backend_spec.rb
|
126
|
+
- spec/unit/backend/yaml_backend_spec.rb
|
127
|
+
- spec/unit/backend_spec.rb
|
128
|
+
- spec/unit/config_spec.rb
|
129
|
+
- spec/unit/console_logger_spec.rb
|
130
|
+
- spec/unit/fallback_logger_spec.rb
|
131
|
+
- spec/unit/filecache_spec.rb
|
132
|
+
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
133
|
+
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
134
|
+
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
135
|
+
- spec/unit/fixtures/override/config/hiera.yaml
|
136
|
+
- spec/unit/fixtures/override/data/alternate.yaml
|
137
|
+
- spec/unit/fixtures/override/data/common.yaml
|
138
|
+
- spec/unit/hiera_spec.rb
|
139
|
+
- spec/unit/interpolate_spec.rb
|
140
|
+
- spec/unit/puppet_logger_spec.rb
|
141
|
+
- spec/unit/util_spec.rb
|
142
|
+
- spec/unit/version_spec.rb
|