hiera 2.0.0-x64-mingw32 → 3.0.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hiera/config.rb +6 -6
- data/lib/hiera/util.rb +2 -2
- data/lib/hiera/version.rb +1 -1
- data/spec/unit/backend_spec.rb +5 -4
- data/spec/unit/config_spec.rb +5 -3
- data/spec/unit/util_spec.rb +2 -2
- metadata +51 -45
- checksums.yaml +0 -7
data/lib/hiera/config.rb
CHANGED
@@ -4,14 +4,14 @@ class Hiera::Config
|
|
4
4
|
# load takes a string or hash as input, strings are treated as filenames
|
5
5
|
# hashes are stored as data that would have been in the config file
|
6
6
|
#
|
7
|
-
# Unless specified it will only use YAML as backend with a
|
8
|
-
# 'common'
|
7
|
+
# Unless specified it will only use YAML as backend with a
|
8
|
+
# hierarchy of 'nodes/%{::trusted.certname}' and 'common', and with a
|
9
|
+
# console logger.
|
9
10
|
#
|
10
|
-
# @return [Hash] representing the configuration.
|
11
|
-
# {:backends => "yaml", :hierarchy => "common"}
|
11
|
+
# @return [Hash] representing the configuration.
|
12
12
|
def load(source)
|
13
|
-
@config = {:backends => "yaml",
|
14
|
-
:hierarchy => "common",
|
13
|
+
@config = {:backends => ["yaml"],
|
14
|
+
:hierarchy => ["nodes/%{::trusted.certname}", "common"],
|
15
15
|
:merge_behavior => :native }
|
16
16
|
|
17
17
|
if source.is_a?(String)
|
data/lib/hiera/util.rb
CHANGED
@@ -29,9 +29,9 @@ class Hiera
|
|
29
29
|
|
30
30
|
def var_dir
|
31
31
|
if microsoft_windows?
|
32
|
-
File.join(common_appdata, 'PuppetLabs', 'code', 'hieradata')
|
32
|
+
File.join(common_appdata, 'PuppetLabs', 'code', 'environments' , '%{environment}' , 'hieradata')
|
33
33
|
else
|
34
|
-
'/etc/puppetlabs/code/hieradata'
|
34
|
+
'/etc/puppetlabs/code/environments/%{environment}/hieradata'
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
data/lib/hiera/version.rb
CHANGED
data/spec/unit/backend_spec.rb
CHANGED
@@ -22,13 +22,13 @@ class Hiera
|
|
22
22
|
|
23
23
|
it "defaults to a directory in var" do
|
24
24
|
Config.load({})
|
25
|
-
Backend.datadir(:rspec, {}).should == Hiera::Util.var_dir
|
25
|
+
Backend.datadir(:rspec, { "environment" => "foo" }).should == Hiera::Util.var_dir % { :environment => "foo"}
|
26
26
|
|
27
27
|
Config.load({:rspec => nil})
|
28
|
-
Backend.datadir(:rspec, {}).should == Hiera::Util.var_dir
|
28
|
+
Backend.datadir(:rspec, { "environment" => "foo" }).should == Hiera::Util.var_dir % { :environment => "foo"}
|
29
29
|
|
30
30
|
Config.load({:rspec => {}})
|
31
|
-
Backend.datadir(:rspec, {}).should == Hiera::Util.var_dir
|
31
|
+
Backend.datadir(:rspec, { "environment" => "foo" }).should == Hiera::Util.var_dir % { :environment => "foo"}
|
32
32
|
end
|
33
33
|
|
34
34
|
it "fails when the datadir is an array" do
|
@@ -92,7 +92,8 @@ class Hiera
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "parses the names of the hierarchy levels using the given scope" do
|
95
|
-
Backend.expects(:parse_string).with(
|
95
|
+
Backend.expects(:parse_string).with('nodes/%{::trusted.certname}', {:rspec => :tests}, {}, {:order_override => nil})
|
96
|
+
Backend.expects(:parse_string).with('common', {:rspec => :tests}, {}, {:order_override => nil})
|
96
97
|
Backend.datasources({:rspec => :tests}) { }
|
97
98
|
end
|
98
99
|
|
data/spec/unit/config_spec.rb
CHANGED
@@ -6,7 +6,7 @@ class Hiera
|
|
6
6
|
let(:default_config) do
|
7
7
|
{
|
8
8
|
:backends => ["yaml"],
|
9
|
-
:hierarchy =>
|
9
|
+
:hierarchy => ['nodes/%{::trusted.certname}', 'common'],
|
10
10
|
:logger => "console",
|
11
11
|
:merge_behavior=>:native
|
12
12
|
}
|
@@ -44,11 +44,13 @@ class Hiera
|
|
44
44
|
|
45
45
|
it "should merge defaults with the loaded or supplied config" do
|
46
46
|
config = Config.load({})
|
47
|
-
config.should == {:backends => ["yaml"], :hierarchy =>
|
47
|
+
config.should == {:backends => ["yaml"], :hierarchy => ['nodes/%{::trusted.certname}', 'common'],
|
48
|
+
:logger => "console", :merge_behavior=>:native}
|
48
49
|
end
|
49
50
|
|
50
51
|
it "should force :backends to be a flattened array" do
|
51
|
-
Config.load({:backends => [["foo", ["bar"]]]}).should == {:backends => ["foo", "bar"],
|
52
|
+
Config.load({:backends => [["foo", ["bar"]]]}).should == {:backends => ["foo", "bar"],
|
53
|
+
:hierarchy => ['nodes/%{::trusted.certname}', 'common'], :logger => "console", :merge_behavior=>:native}
|
52
54
|
end
|
53
55
|
|
54
56
|
it "should load the supplied logger" do
|
data/spec/unit/util_spec.rb
CHANGED
@@ -36,13 +36,13 @@ describe Hiera::Util do
|
|
36
36
|
describe 'Hiera::Util.var_dir' do
|
37
37
|
it 'should return the correct path for posix systems' do
|
38
38
|
Hiera::Util.expects(:file_alt_separator).returns(nil)
|
39
|
-
Hiera::Util.var_dir.should == '/etc/puppetlabs/code/hieradata'
|
39
|
+
Hiera::Util.var_dir.should == '/etc/puppetlabs/code/environments/%{environment}/hieradata'
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should return the correct path for microsoft windows systems' do
|
43
43
|
Hiera::Util.expects(:microsoft_windows?).returns(true)
|
44
44
|
Hiera::Util.expects(:common_appdata).returns('C:\\ProgramData')
|
45
|
-
Hiera::Util.var_dir.should == 'C:\\ProgramData/PuppetLabs/code/hieradata'
|
45
|
+
Hiera::Util.var_dir.should == 'C:\\ProgramData/PuppetLabs/code/environments/%{environment}/hieradata'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,32 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
|
+
prerelease:
|
5
6
|
platform: x64-mingw32
|
6
7
|
authors:
|
7
8
|
- Puppet Labs
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
+
date: 2015-06-23 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: json_pure
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: win32-dir
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -46,83 +51,84 @@ extensions: []
|
|
46
51
|
extra_rdoc_files: []
|
47
52
|
files:
|
48
53
|
- bin/hiera
|
49
|
-
- lib/hiera/
|
50
|
-
- lib/hiera/
|
51
|
-
- lib/hiera/backend/yaml_backend.rb
|
52
|
-
- lib/hiera/config.rb
|
53
|
-
- lib/hiera/console_logger.rb
|
54
|
+
- lib/hiera/version.rb
|
55
|
+
- lib/hiera/noop_logger.rb
|
54
56
|
- lib/hiera/error.rb
|
55
57
|
- lib/hiera/fallback_logger.rb
|
58
|
+
- lib/hiera/recursive_guard.rb
|
59
|
+
- lib/hiera/backend/yaml_backend.rb
|
60
|
+
- lib/hiera/backend/json_backend.rb
|
61
|
+
- lib/hiera/config.rb
|
56
62
|
- lib/hiera/filecache.rb
|
57
63
|
- lib/hiera/interpolate.rb
|
58
|
-
- lib/hiera/
|
64
|
+
- lib/hiera/console_logger.rb
|
59
65
|
- lib/hiera/puppet_logger.rb
|
60
|
-
- lib/hiera/recursive_guard.rb
|
61
66
|
- lib/hiera/util.rb
|
62
|
-
- lib/hiera/
|
67
|
+
- lib/hiera/backend.rb
|
63
68
|
- lib/hiera.rb
|
64
69
|
- COPYING
|
65
70
|
- README.md
|
66
71
|
- LICENSE
|
67
|
-
- spec/
|
68
|
-
- spec/unit/backend/json_backend_spec.rb
|
69
|
-
- spec/unit/backend/yaml_backend_spec.rb
|
70
|
-
- spec/unit/backend_spec.rb
|
71
|
-
- spec/unit/config_spec.rb
|
72
|
-
- spec/unit/console_logger_spec.rb
|
73
|
-
- spec/unit/fallback_logger_spec.rb
|
74
|
-
- spec/unit/filecache_spec.rb
|
75
|
-
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
76
|
-
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
77
|
-
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
72
|
+
- spec/unit/interpolate_spec.rb
|
78
73
|
- spec/unit/fixtures/override/config/hiera.yaml
|
79
74
|
- spec/unit/fixtures/override/data/alternate.yaml
|
80
75
|
- spec/unit/fixtures/override/data/common.yaml
|
81
|
-
- spec/unit/
|
82
|
-
- spec/unit/
|
76
|
+
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
77
|
+
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
78
|
+
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
79
|
+
- spec/unit/backend_spec.rb
|
80
|
+
- spec/unit/filecache_spec.rb
|
81
|
+
- spec/unit/config_spec.rb
|
82
|
+
- spec/unit/backend/yaml_backend_spec.rb
|
83
|
+
- spec/unit/backend/json_backend_spec.rb
|
83
84
|
- spec/unit/puppet_logger_spec.rb
|
84
|
-
- spec/unit/
|
85
|
+
- spec/unit/console_logger_spec.rb
|
85
86
|
- spec/unit/version_spec.rb
|
87
|
+
- spec/unit/fallback_logger_spec.rb
|
88
|
+
- spec/unit/util_spec.rb
|
89
|
+
- spec/unit/hiera_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
86
91
|
homepage: https://github.com/puppetlabs/hiera
|
87
92
|
licenses: []
|
88
|
-
metadata: {}
|
89
93
|
post_install_message:
|
90
94
|
rdoc_options: []
|
91
95
|
require_paths:
|
92
96
|
- lib
|
93
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
94
99
|
requirements:
|
95
|
-
- - '>='
|
100
|
+
- - ! '>='
|
96
101
|
- !ruby/object:Gem::Version
|
97
102
|
version: '0'
|
98
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
99
105
|
requirements:
|
100
|
-
- - '>='
|
106
|
+
- - ! '>='
|
101
107
|
- !ruby/object:Gem::Version
|
102
108
|
version: '0'
|
103
109
|
requirements: []
|
104
110
|
rubyforge_project:
|
105
|
-
rubygems_version:
|
111
|
+
rubygems_version: 1.8.23
|
106
112
|
signing_key:
|
107
|
-
specification_version:
|
113
|
+
specification_version: 3
|
108
114
|
summary: Light weight hierarchical data store
|
109
115
|
test_files:
|
110
|
-
- spec/
|
111
|
-
- spec/unit/backend/json_backend_spec.rb
|
112
|
-
- spec/unit/backend/yaml_backend_spec.rb
|
113
|
-
- spec/unit/backend_spec.rb
|
114
|
-
- spec/unit/config_spec.rb
|
115
|
-
- spec/unit/console_logger_spec.rb
|
116
|
-
- spec/unit/fallback_logger_spec.rb
|
117
|
-
- spec/unit/filecache_spec.rb
|
118
|
-
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
119
|
-
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
120
|
-
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
116
|
+
- spec/unit/interpolate_spec.rb
|
121
117
|
- spec/unit/fixtures/override/config/hiera.yaml
|
122
118
|
- spec/unit/fixtures/override/data/alternate.yaml
|
123
119
|
- spec/unit/fixtures/override/data/common.yaml
|
124
|
-
- spec/unit/
|
125
|
-
- spec/unit/
|
120
|
+
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
121
|
+
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
122
|
+
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
123
|
+
- spec/unit/backend_spec.rb
|
124
|
+
- spec/unit/filecache_spec.rb
|
125
|
+
- spec/unit/config_spec.rb
|
126
|
+
- spec/unit/backend/yaml_backend_spec.rb
|
127
|
+
- spec/unit/backend/json_backend_spec.rb
|
126
128
|
- spec/unit/puppet_logger_spec.rb
|
127
|
-
- spec/unit/
|
129
|
+
- spec/unit/console_logger_spec.rb
|
128
130
|
- spec/unit/version_spec.rb
|
131
|
+
- spec/unit/fallback_logger_spec.rb
|
132
|
+
- spec/unit/util_spec.rb
|
133
|
+
- spec/unit/hiera_spec.rb
|
134
|
+
- spec/spec_helper.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 316ccaf4e48cf2d8c30d8531d20a1155528e1aa0
|
4
|
-
data.tar.gz: fd038d50edc2f8c3dd6d21d21d30cc9463b11c4c
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 2d9807317dd2ad62779fb8980f8d44075a7193d39b006209a5349095e4e5504563e01e056d48f296aabd3fef86422964b848ff1bcec3c8890756d143b031e347
|
7
|
-
data.tar.gz: 10d478df00b859bddf583631ae9fe9f2f1028b3394fda6dfd38d3e0a2a57ce32a1b41a681b814552594421d9b9b373b94c6300eccdd2291827abacf8f9c3a566
|