hiera 3.3.0-x86-mingw32 → 3.3.1-x86-mingw32
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: 9658ce260edf33622e984b7a41b2ea19b5d1c90f
|
4
|
+
data.tar.gz: 71a56f8dc356487e3e9ced91009d9ffcfe6bb1b2
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
N2E3ODQyZjg1NjgxM2I0NjdhOTU0ZGVlYmJlY2YxNTc3N2E1MWEzMWY5YTQ5
|
11
|
-
NzAyOGQ0NzhmZWM0MTM0Y2M5YmY0NjlhZmNkOTgzYjg4MzU2NWE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MmY2NTZmOTZhODEyOGNhMDMxM2Q0MzI0NDVmNzlhYzc2NDVlMzk1MjBkMmQz
|
14
|
-
NWI4ZWJkZDhiNjIzNzczYTIzNjI4MTU3YTU4MWM2ZjJlOWFmNzNhNzdlOWYy
|
15
|
-
ZGIyNWRiNDBkNGIxNDQ2ZWM2ZDllN2Y1ZWY3OWJhZWY3ZjRkNzg=
|
6
|
+
metadata.gz: bb1fe712cf4b6f5d92abd42076e6e616d0b406e813bc638f4fea672e4b7bc89b2ae290c26d79fcf4434f46d6f05e71c64ab8ec0abe7cb9463d58223793c7a29b
|
7
|
+
data.tar.gz: 4400816c4d4e9fa6e24e93a9eece139682aba003eef03ec53afdf32932b8123248cecbff43c37870d85ffdec0603aeb86fc36d211f85f603f314a494a3192c1a
|
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: x86-mingw32
|
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
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: win32console
|
@@ -45,11 +45,7 @@ executables:
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- COPYING
|
49
|
-
- LICENSE
|
50
|
-
- README.md
|
51
48
|
- bin/hiera
|
52
|
-
- lib/hiera.rb
|
53
49
|
- lib/hiera/backend.rb
|
54
50
|
- lib/hiera/backend/json_backend.rb
|
55
51
|
- lib/hiera/backend/yaml_backend.rb
|
@@ -64,6 +60,10 @@ files:
|
|
64
60
|
- lib/hiera/recursive_guard.rb
|
65
61
|
- lib/hiera/util.rb
|
66
62
|
- lib/hiera/version.rb
|
63
|
+
- lib/hiera.rb
|
64
|
+
- COPYING
|
65
|
+
- README.md
|
66
|
+
- LICENSE
|
67
67
|
- spec/spec_helper.rb
|
68
68
|
- spec/unit/backend/json_backend_spec.rb
|
69
69
|
- spec/unit/backend/yaml_backend_spec.rb
|
@@ -72,6 +72,8 @@ files:
|
|
72
72
|
- spec/unit/console_logger_spec.rb
|
73
73
|
- spec/unit/fallback_logger_spec.rb
|
74
74
|
- spec/unit/filecache_spec.rb
|
75
|
+
- spec/unit/fixtures/badconfig/config/hiera.yaml
|
76
|
+
- spec/unit/fixtures/badconfig/data/common.yaml
|
75
77
|
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
76
78
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml
|
77
79
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml
|
@@ -101,46 +103,48 @@ require_paths:
|
|
101
103
|
- lib
|
102
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
105
|
requirements:
|
104
|
-
- -
|
106
|
+
- - '>='
|
105
107
|
- !ruby/object:Gem::Version
|
106
108
|
version: '0'
|
107
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
110
|
requirements:
|
109
|
-
- -
|
111
|
+
- - '>='
|
110
112
|
- !ruby/object:Gem::Version
|
111
113
|
version: '0'
|
112
114
|
requirements: []
|
113
115
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.0.14
|
115
117
|
signing_key:
|
116
118
|
specification_version: 4
|
117
119
|
summary: Light weight hierarchical data store
|
118
120
|
test_files:
|
119
|
-
- spec/
|
120
|
-
- spec/unit/
|
121
|
-
- spec/unit/
|
122
|
-
- spec/unit/
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
- spec/unit/backend/json_backend_spec.rb
|
123
|
+
- spec/unit/backend/yaml_backend_spec.rb
|
124
|
+
- spec/unit/backend_spec.rb
|
125
|
+
- spec/unit/config_spec.rb
|
126
|
+
- spec/unit/console_logger_spec.rb
|
127
|
+
- spec/unit/fallback_logger_spec.rb
|
128
|
+
- spec/unit/filecache_spec.rb
|
129
|
+
- spec/unit/fixtures/badconfig/config/hiera.yaml
|
130
|
+
- spec/unit/fixtures/badconfig/data/common.yaml
|
131
|
+
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
123
132
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera.yaml
|
124
133
|
- spec/unit/fixtures/interpolate/config/hiera_iplm_hiera_bad.yaml
|
125
|
-
- spec/unit/fixtures/interpolate/config/hiera.yaml
|
126
|
-
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
127
|
-
- spec/unit/fixtures/interpolate/data/complex.yaml
|
128
|
-
- spec/unit/fixtures/interpolate/data/frontend.json
|
129
|
-
- spec/unit/fixtures/interpolate/data/role.json
|
130
134
|
- spec/unit/fixtures/interpolate/data/bad_interpolation.yaml
|
135
|
+
- spec/unit/fixtures/interpolate/data/complex.yaml
|
131
136
|
- spec/unit/fixtures/interpolate/data/dotted_keys.yaml
|
132
|
-
- spec/unit/fixtures/interpolate/data/weird_keys.yaml
|
133
137
|
- spec/unit/fixtures/interpolate/data/empty_interpolation.yaml
|
138
|
+
- spec/unit/fixtures/interpolate/data/frontend.json
|
139
|
+
- spec/unit/fixtures/interpolate/data/niltest.yaml
|
134
140
|
- spec/unit/fixtures/interpolate/data/recursive.yaml
|
135
|
-
- spec/unit/
|
136
|
-
- spec/unit/
|
137
|
-
- spec/unit/
|
138
|
-
- spec/unit/
|
139
|
-
- spec/unit/
|
141
|
+
- spec/unit/fixtures/interpolate/data/role.json
|
142
|
+
- spec/unit/fixtures/interpolate/data/weird_keys.yaml
|
143
|
+
- spec/unit/fixtures/override/config/hiera.yaml
|
144
|
+
- spec/unit/fixtures/override/data/alternate.yaml
|
145
|
+
- spec/unit/fixtures/override/data/common.yaml
|
146
|
+
- spec/unit/hiera_spec.rb
|
147
|
+
- spec/unit/interpolate_spec.rb
|
140
148
|
- spec/unit/puppet_logger_spec.rb
|
141
|
-
- spec/unit/console_logger_spec.rb
|
142
|
-
- spec/unit/version_spec.rb
|
143
|
-
- spec/unit/fallback_logger_spec.rb
|
144
149
|
- spec/unit/util_spec.rb
|
145
|
-
- spec/unit/
|
146
|
-
- spec/spec_helper.rb
|
150
|
+
- spec/unit/version_spec.rb
|