hiera 2.0.0-x86-mingw32 → 3.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
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 single
8
- # 'common' hierarchy and console logger
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. e.g.
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
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  class Hiera
10
- VERSION = "2.0.0"
10
+ VERSION = "3.0.1"
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -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("common", {:rspec => :tests}, {}, {:order_override => nil})
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
 
@@ -6,7 +6,7 @@ class Hiera
6
6
  let(:default_config) do
7
7
  {
8
8
  :backends => ["yaml"],
9
- :hierarchy => "common",
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 => "common", :logger => "console", :merge_behavior=>:native}
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"], :hierarchy => "common", :logger => "console", :merge_behavior=>:native}
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
@@ -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: 2.0.0
4
+ version: 3.0.1
5
+ prerelease:
5
6
  platform: x86-mingw32
6
7
  authors:
7
8
  - Puppet Labs
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
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: win32console
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
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: win32-dir
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -60,83 +67,84 @@ extensions: []
60
67
  extra_rdoc_files: []
61
68
  files:
62
69
  - 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
70
+ - lib/hiera/version.rb
71
+ - lib/hiera/noop_logger.rb
68
72
  - lib/hiera/error.rb
69
73
  - lib/hiera/fallback_logger.rb
74
+ - lib/hiera/recursive_guard.rb
75
+ - lib/hiera/backend/yaml_backend.rb
76
+ - lib/hiera/backend/json_backend.rb
77
+ - lib/hiera/config.rb
70
78
  - lib/hiera/filecache.rb
71
79
  - lib/hiera/interpolate.rb
72
- - lib/hiera/noop_logger.rb
80
+ - lib/hiera/console_logger.rb
73
81
  - lib/hiera/puppet_logger.rb
74
- - lib/hiera/recursive_guard.rb
75
82
  - lib/hiera/util.rb
76
- - lib/hiera/version.rb
83
+ - lib/hiera/backend.rb
77
84
  - lib/hiera.rb
78
85
  - COPYING
79
86
  - README.md
80
87
  - 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
88
+ - spec/unit/interpolate_spec.rb
92
89
  - spec/unit/fixtures/override/config/hiera.yaml
93
90
  - spec/unit/fixtures/override/data/alternate.yaml
94
91
  - spec/unit/fixtures/override/data/common.yaml
95
- - spec/unit/hiera_spec.rb
96
- - spec/unit/interpolate_spec.rb
92
+ - spec/unit/fixtures/interpolate/config/hiera.yaml
93
+ - spec/unit/fixtures/interpolate/data/niltest.yaml
94
+ - spec/unit/fixtures/interpolate/data/recursive.yaml
95
+ - spec/unit/backend_spec.rb
96
+ - spec/unit/filecache_spec.rb
97
+ - spec/unit/config_spec.rb
98
+ - spec/unit/backend/yaml_backend_spec.rb
99
+ - spec/unit/backend/json_backend_spec.rb
97
100
  - spec/unit/puppet_logger_spec.rb
98
- - spec/unit/util_spec.rb
101
+ - spec/unit/console_logger_spec.rb
99
102
  - spec/unit/version_spec.rb
103
+ - spec/unit/fallback_logger_spec.rb
104
+ - spec/unit/util_spec.rb
105
+ - spec/unit/hiera_spec.rb
106
+ - spec/spec_helper.rb
100
107
  homepage: https://github.com/puppetlabs/hiera
101
108
  licenses: []
102
- metadata: {}
103
109
  post_install_message:
104
110
  rdoc_options: []
105
111
  require_paths:
106
112
  - lib
107
113
  required_ruby_version: !ruby/object:Gem::Requirement
114
+ none: false
108
115
  requirements:
109
- - - '>='
116
+ - - ! '>='
110
117
  - !ruby/object:Gem::Version
111
118
  version: '0'
112
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
113
121
  requirements:
114
- - - '>='
122
+ - - ! '>='
115
123
  - !ruby/object:Gem::Version
116
124
  version: '0'
117
125
  requirements: []
118
126
  rubyforge_project:
119
- rubygems_version: 2.0.14
127
+ rubygems_version: 1.8.23
120
128
  signing_key:
121
- specification_version: 4
129
+ specification_version: 3
122
130
  summary: Light weight hierarchical data store
123
131
  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
132
+ - spec/unit/interpolate_spec.rb
135
133
  - spec/unit/fixtures/override/config/hiera.yaml
136
134
  - spec/unit/fixtures/override/data/alternate.yaml
137
135
  - spec/unit/fixtures/override/data/common.yaml
138
- - spec/unit/hiera_spec.rb
139
- - spec/unit/interpolate_spec.rb
136
+ - spec/unit/fixtures/interpolate/config/hiera.yaml
137
+ - spec/unit/fixtures/interpolate/data/niltest.yaml
138
+ - spec/unit/fixtures/interpolate/data/recursive.yaml
139
+ - spec/unit/backend_spec.rb
140
+ - spec/unit/filecache_spec.rb
141
+ - spec/unit/config_spec.rb
142
+ - spec/unit/backend/yaml_backend_spec.rb
143
+ - spec/unit/backend/json_backend_spec.rb
140
144
  - spec/unit/puppet_logger_spec.rb
141
- - spec/unit/util_spec.rb
145
+ - spec/unit/console_logger_spec.rb
142
146
  - spec/unit/version_spec.rb
147
+ - spec/unit/fallback_logger_spec.rb
148
+ - spec/unit/util_spec.rb
149
+ - spec/unit/hiera_spec.rb
150
+ - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 1009a888af453aa872d1ebb4f9bd74aae3b69625
4
- data.tar.gz: fd038d50edc2f8c3dd6d21d21d30cc9463b11c4c
5
- SHA512:
6
- metadata.gz: 0c65c6bdbdce2bf2173eaca6a81eab423bd27dd65c95ef82745b40117985f6337d4e271cba32807f5fa6d8d3afe34024b0d4fb48af81b88767a0410796e3993f
7
- data.tar.gz: 10d478df00b859bddf583631ae9fe9f2f1028b3394fda6dfd38d3e0a2a57ce32a1b41a681b814552594421d9b9b373b94c6300eccdd2291827abacf8f9c3a566