hiera 2.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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)
@@ -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
 
@@ -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,27 +1,30 @@
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: ruby
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
  description: A pluggable data store for hierarcical data
@@ -32,83 +35,84 @@ extensions: []
32
35
  extra_rdoc_files: []
33
36
  files:
34
37
  - bin/hiera
35
- - lib/hiera/backend.rb
36
- - lib/hiera/backend/json_backend.rb
37
- - lib/hiera/backend/yaml_backend.rb
38
- - lib/hiera/config.rb
39
- - lib/hiera/console_logger.rb
38
+ - lib/hiera/version.rb
39
+ - lib/hiera/noop_logger.rb
40
40
  - lib/hiera/error.rb
41
41
  - lib/hiera/fallback_logger.rb
42
+ - lib/hiera/recursive_guard.rb
43
+ - lib/hiera/backend/yaml_backend.rb
44
+ - lib/hiera/backend/json_backend.rb
45
+ - lib/hiera/config.rb
42
46
  - lib/hiera/filecache.rb
43
47
  - lib/hiera/interpolate.rb
44
- - lib/hiera/noop_logger.rb
48
+ - lib/hiera/console_logger.rb
45
49
  - lib/hiera/puppet_logger.rb
46
- - lib/hiera/recursive_guard.rb
47
50
  - lib/hiera/util.rb
48
- - lib/hiera/version.rb
51
+ - lib/hiera/backend.rb
49
52
  - lib/hiera.rb
50
53
  - COPYING
51
54
  - README.md
52
55
  - LICENSE
53
- - spec/spec_helper.rb
54
- - spec/unit/backend/json_backend_spec.rb
55
- - spec/unit/backend/yaml_backend_spec.rb
56
- - spec/unit/backend_spec.rb
57
- - spec/unit/config_spec.rb
58
- - spec/unit/console_logger_spec.rb
59
- - spec/unit/fallback_logger_spec.rb
60
- - spec/unit/filecache_spec.rb
61
- - spec/unit/fixtures/interpolate/config/hiera.yaml
62
- - spec/unit/fixtures/interpolate/data/niltest.yaml
63
- - spec/unit/fixtures/interpolate/data/recursive.yaml
56
+ - spec/unit/interpolate_spec.rb
64
57
  - spec/unit/fixtures/override/config/hiera.yaml
65
58
  - spec/unit/fixtures/override/data/alternate.yaml
66
59
  - spec/unit/fixtures/override/data/common.yaml
67
- - spec/unit/hiera_spec.rb
68
- - spec/unit/interpolate_spec.rb
60
+ - spec/unit/fixtures/interpolate/config/hiera.yaml
61
+ - spec/unit/fixtures/interpolate/data/niltest.yaml
62
+ - spec/unit/fixtures/interpolate/data/recursive.yaml
63
+ - spec/unit/backend_spec.rb
64
+ - spec/unit/filecache_spec.rb
65
+ - spec/unit/config_spec.rb
66
+ - spec/unit/backend/yaml_backend_spec.rb
67
+ - spec/unit/backend/json_backend_spec.rb
69
68
  - spec/unit/puppet_logger_spec.rb
70
- - spec/unit/util_spec.rb
69
+ - spec/unit/console_logger_spec.rb
71
70
  - spec/unit/version_spec.rb
71
+ - spec/unit/fallback_logger_spec.rb
72
+ - spec/unit/util_spec.rb
73
+ - spec/unit/hiera_spec.rb
74
+ - spec/spec_helper.rb
72
75
  homepage: https://github.com/puppetlabs/hiera
73
76
  licenses: []
74
- metadata: {}
75
77
  post_install_message:
76
78
  rdoc_options: []
77
79
  require_paths:
78
80
  - lib
79
81
  required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
80
83
  requirements:
81
- - - '>='
84
+ - - ! '>='
82
85
  - !ruby/object:Gem::Version
83
86
  version: '0'
84
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
85
89
  requirements:
86
- - - '>='
90
+ - - ! '>='
87
91
  - !ruby/object:Gem::Version
88
92
  version: '0'
89
93
  requirements: []
90
94
  rubyforge_project:
91
- rubygems_version: 2.0.14
95
+ rubygems_version: 1.8.23
92
96
  signing_key:
93
- specification_version: 4
97
+ specification_version: 3
94
98
  summary: Light weight hierarchical data store
95
99
  test_files:
96
- - spec/spec_helper.rb
97
- - spec/unit/backend/json_backend_spec.rb
98
- - spec/unit/backend/yaml_backend_spec.rb
99
- - spec/unit/backend_spec.rb
100
- - spec/unit/config_spec.rb
101
- - spec/unit/console_logger_spec.rb
102
- - spec/unit/fallback_logger_spec.rb
103
- - spec/unit/filecache_spec.rb
104
- - spec/unit/fixtures/interpolate/config/hiera.yaml
105
- - spec/unit/fixtures/interpolate/data/niltest.yaml
106
- - spec/unit/fixtures/interpolate/data/recursive.yaml
100
+ - spec/unit/interpolate_spec.rb
107
101
  - spec/unit/fixtures/override/config/hiera.yaml
108
102
  - spec/unit/fixtures/override/data/alternate.yaml
109
103
  - spec/unit/fixtures/override/data/common.yaml
110
- - spec/unit/hiera_spec.rb
111
- - spec/unit/interpolate_spec.rb
104
+ - spec/unit/fixtures/interpolate/config/hiera.yaml
105
+ - spec/unit/fixtures/interpolate/data/niltest.yaml
106
+ - spec/unit/fixtures/interpolate/data/recursive.yaml
107
+ - spec/unit/backend_spec.rb
108
+ - spec/unit/filecache_spec.rb
109
+ - spec/unit/config_spec.rb
110
+ - spec/unit/backend/yaml_backend_spec.rb
111
+ - spec/unit/backend/json_backend_spec.rb
112
112
  - spec/unit/puppet_logger_spec.rb
113
- - spec/unit/util_spec.rb
113
+ - spec/unit/console_logger_spec.rb
114
114
  - spec/unit/version_spec.rb
115
+ - spec/unit/fallback_logger_spec.rb
116
+ - spec/unit/util_spec.rb
117
+ - spec/unit/hiera_spec.rb
118
+ - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: dd4a69f9d2131165eba3e8767b8731dcc11f3a6d
4
- data.tar.gz: fd038d50edc2f8c3dd6d21d21d30cc9463b11c4c
5
- SHA512:
6
- metadata.gz: 6d669f8a2ea3cea56f2c0d66959e2aa2df7a84f74940ae51e8c192929f45e102d99b85c7530084c87294594557229060de56b093e87c5a96076c7849343efb15
7
- data.tar.gz: 10d478df00b859bddf583631ae9fe9f2f1028b3394fda6dfd38d3e0a2a57ce32a1b41a681b814552594421d9b9b373b94c6300eccdd2291827abacf8f9c3a566