hiera 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/hiera/config.rb +7 -1
- data/lib/hiera/filecache.rb +1 -1
- data/lib/hiera/version.rb +1 -1
- data/spec/unit/config_spec.rb +4 -0
- data/spec/unit/filecache_spec.rb +30 -0
- data/spec/unit/fixtures/badconfig/config/hiera.yaml +6 -0
- data/spec/unit/fixtures/badconfig/data/common.yaml +2 -0
- metadata +33 -29
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDNkNGRjODE5NjE5N2FlZDc4MWQ0MWMxMDBhYjA5ODNhYjg2ODZiOA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7c13650072ce82f7b941ac80e14c8a04c78e4b8e
|
4
|
+
data.tar.gz: 374ab47d4d1cb6462246d61dc1c4e6235a29a4f0
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OTM4MTMzOWZkNDU2MWJhZjZmZDU4YjU0Y2ZiNmU0ZGVlODcwYzg5ZGYwODNi
|
11
|
-
OGMwYjlhODRmYmE4MjZmNmNhNzg3ZjU1NzM3ZTA1MDhhMDBmZTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MmY2NTZmOTZhODEyOGNhMDMxM2Q0MzI0NDVmNzlhYzc2NDVlMzk1MjBkMmQz
|
14
|
-
NWI4ZWJkZDhiNjIzNzczYTIzNjI4MTU3YTU4MWM2ZjJlOWFmNzNhNzdlOWYy
|
15
|
-
ZGIyNWRiNDBkNGIxNDQ2ZWM2ZDllN2Y1ZWY3OWJhZWY3ZjRkNzg=
|
6
|
+
metadata.gz: 0710bac409a578923260a095d31aa1bf355ee77e3ce4696973bd463a567a82551f5600bf92d2b081a32f2af10e2b505c4a26b7e187e82bc296774dd49268cd0d
|
7
|
+
data.tar.gz: c0e7e3b8c6a8adbd8d30e850a29a8523d2b61f48f03af50768bf76d53445e442098e81b6256b87b3bbf7091200e9e271ef8ccbbd44f7a1628a57446f0884df62
|
data/lib/hiera/config.rb
CHANGED
@@ -26,7 +26,13 @@ class Hiera::Config
|
|
26
26
|
raise detail
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
if config
|
30
|
+
version = config['version'] || config[:version] || 3
|
31
|
+
if version >= 4
|
32
|
+
raise "v4 hiera.yaml is only to be used inside an environment or a module and cannot be given to the global hiera"
|
33
|
+
end
|
34
|
+
@config.merge! config
|
35
|
+
end
|
30
36
|
else
|
31
37
|
raise "Config file #{source} not found"
|
32
38
|
end
|
data/lib/hiera/filecache.rb
CHANGED
@@ -49,7 +49,7 @@ class Hiera
|
|
49
49
|
# in processing will be propagated to the caller
|
50
50
|
def read_file(path, expected_type = Object)
|
51
51
|
if stale?(path)
|
52
|
-
data = File.read(path)
|
52
|
+
data = File.read(path, :encoding => 'BOM|UTF-8')
|
53
53
|
@cache[path][:data] = block_given? ? yield(data) : data
|
54
54
|
|
55
55
|
if !@cache[path][:data].is_a?(expected_type)
|
data/lib/hiera/version.rb
CHANGED
data/spec/unit/config_spec.rb
CHANGED
@@ -12,6 +12,10 @@ class Hiera
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'should raise an error if the configuration version is greater than 3' do
|
16
|
+
expect { Hiera.new(:config => File.join(HieraSpec::FIXTURE_DIR, 'badconfig', 'config', 'hiera.yaml')) }.to raise_error(/v4 hiera\.yaml is only to be used inside an environment or a module/)
|
17
|
+
end
|
18
|
+
|
15
19
|
it "should raise an error for missing config files" do
|
16
20
|
File.expects(:exist?).with("/nonexisting").returns(false)
|
17
21
|
YAML.expects(:load_file).with("/nonexisting").never
|
data/spec/unit/filecache_spec.rb
CHANGED
@@ -84,6 +84,36 @@ class Hiera
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
it "sets the encoding to UTF-8 when reading a file" do
|
88
|
+
begin
|
89
|
+
original_encoding = Encoding.default_external
|
90
|
+
Encoding.default_external = Encoding::ISO_8859_1
|
91
|
+
|
92
|
+
Dir.mktmpdir do |dir|
|
93
|
+
file = File.join(dir, "testing")
|
94
|
+
write_file(file, "my data")
|
95
|
+
expect(@cache.read_file(file).encoding).to eq(Encoding::UTF_8)
|
96
|
+
end
|
97
|
+
ensure
|
98
|
+
Encoding.default_external = original_encoding
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
it "reads a file with unicode characters" do
|
103
|
+
begin
|
104
|
+
original_encoding = Encoding.default_external
|
105
|
+
Encoding.default_external = Encoding::ISO_8859_1
|
106
|
+
|
107
|
+
Dir.mktmpdir do |dir|
|
108
|
+
file = File.join(dir, "testing")
|
109
|
+
write_file(file, "\u2603")
|
110
|
+
expect(@cache.read_file(file)).to eq("\u2603")
|
111
|
+
end
|
112
|
+
ensure
|
113
|
+
Encoding.default_external = original_encoding
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
87
117
|
it "rereads data when the file changes" do
|
88
118
|
Dir.mktmpdir do |dir|
|
89
119
|
file = File.join(dir, "testing")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A pluggable data store for hierarcical data
|
14
14
|
email: info@puppetlabs.com
|
@@ -17,11 +17,7 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- COPYING
|
21
|
-
- LICENSE
|
22
|
-
- README.md
|
23
20
|
- bin/hiera
|
24
|
-
- lib/hiera.rb
|
25
21
|
- lib/hiera/backend.rb
|
26
22
|
- lib/hiera/backend/json_backend.rb
|
27
23
|
- lib/hiera/backend/yaml_backend.rb
|
@@ -36,6 +32,10 @@ files:
|
|
36
32
|
- lib/hiera/recursive_guard.rb
|
37
33
|
- lib/hiera/util.rb
|
38
34
|
- lib/hiera/version.rb
|
35
|
+
- lib/hiera.rb
|
36
|
+
- COPYING
|
37
|
+
- README.md
|
38
|
+
- LICENSE
|
39
39
|
- spec/spec_helper.rb
|
40
40
|
- spec/unit/backend/json_backend_spec.rb
|
41
41
|
- spec/unit/backend/yaml_backend_spec.rb
|
@@ -44,6 +44,8 @@ files:
|
|
44
44
|
- spec/unit/console_logger_spec.rb
|
45
45
|
- spec/unit/fallback_logger_spec.rb
|
46
46
|
- spec/unit/filecache_spec.rb
|
47
|
+
- spec/unit/fixtures/badconfig/config/hiera.yaml
|
48
|
+
- spec/unit/fixtures/badconfig/data/common.yaml
|
47
49
|
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
48
50
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml
|
49
51
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml
|
@@ -73,46 +75,48 @@ require_paths:
|
|
73
75
|
- lib
|
74
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
77
|
requirements:
|
76
|
-
- -
|
78
|
+
- - '>='
|
77
79
|
- !ruby/object:Gem::Version
|
78
80
|
version: '0'
|
79
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
82
|
requirements:
|
81
|
-
- -
|
83
|
+
- - '>='
|
82
84
|
- !ruby/object:Gem::Version
|
83
85
|
version: '0'
|
84
86
|
requirements: []
|
85
87
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.0.14
|
87
89
|
signing_key:
|
88
90
|
specification_version: 4
|
89
91
|
summary: Light weight hierarchical data store
|
90
92
|
test_files:
|
91
|
-
- spec/
|
92
|
-
- spec/unit/
|
93
|
-
- spec/unit/
|
94
|
-
- spec/unit/
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- spec/unit/backend/json_backend_spec.rb
|
95
|
+
- spec/unit/backend/yaml_backend_spec.rb
|
96
|
+
- spec/unit/backend_spec.rb
|
97
|
+
- spec/unit/config_spec.rb
|
98
|
+
- spec/unit/console_logger_spec.rb
|
99
|
+
- spec/unit/fallback_logger_spec.rb
|
100
|
+
- spec/unit/filecache_spec.rb
|
101
|
+
- spec/unit/fixtures/badconfig/config/hiera.yaml
|
102
|
+
- spec/unit/fixtures/badconfig/data/common.yaml
|
103
|
+
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
95
104
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml
|
96
105
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml
|
97
|
-
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
98
|
-
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
99
|
-
- spec/unit/fixtures/interpolate/data/complex.yaml
|
100
|
-
- spec/unit/fixtures/interpolate/data/frontend.json
|
101
|
-
- spec/unit/fixtures/interpolate/data/role.json
|
102
106
|
- spec/unit/fixtures/interpolate/data/bad_interpolation.yaml
|
107
|
+
- spec/unit/fixtures/interpolate/data/complex.yaml
|
103
108
|
- spec/unit/fixtures/interpolate/data/dotted_keys.yaml
|
104
|
-
- spec/unit/fixtures/interpolate/data/weird_keys.yaml
|
105
109
|
- spec/unit/fixtures/interpolate/data/empty_interpolation.yaml
|
110
|
+
- spec/unit/fixtures/interpolate/data/frontend.json
|
111
|
+
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
106
112
|
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
107
|
-
- spec/unit/
|
108
|
-
- spec/unit/
|
109
|
-
- spec/unit/
|
110
|
-
- spec/unit/
|
111
|
-
- spec/unit/
|
113
|
+
- spec/unit/fixtures/interpolate/data/role.json
|
114
|
+
- spec/unit/fixtures/interpolate/data/weird_keys.yaml
|
115
|
+
- spec/unit/fixtures/override/config/hiera.yaml
|
116
|
+
- spec/unit/fixtures/override/data/alternate.yaml
|
117
|
+
- spec/unit/fixtures/override/data/common.yaml
|
118
|
+
- spec/unit/hiera_spec.rb
|
119
|
+
- spec/unit/interpolate_spec.rb
|
112
120
|
- spec/unit/puppet_logger_spec.rb
|
113
|
-
- spec/unit/console_logger_spec.rb
|
114
|
-
- spec/unit/version_spec.rb
|
115
|
-
- spec/unit/fallback_logger_spec.rb
|
116
121
|
- spec/unit/util_spec.rb
|
117
|
-
- spec/unit/
|
118
|
-
- spec/spec_helper.rb
|
122
|
+
- spec/unit/version_spec.rb
|