chef-zero 4.2.2 → 4.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b4a6e710f90e47913be43c72b9cc0452443b3d8
4
- data.tar.gz: ce7a0c64ab54a3878aee472b1ad4b9bbd27212a4
3
+ metadata.gz: 98e9181d735cbb6ad5981b436498ff4dce7e279c
4
+ data.tar.gz: b81547d1267102697646f4bab429f47d48717383
5
5
  SHA512:
6
- metadata.gz: 9304111f0ee34e491f77e3846efc83e8181fcb8bdf286bff506c088f1cb9601614537ee1ae12b1b4b07932939e81253d1638cb733b650c0d21e4ef3c936363bc
7
- data.tar.gz: dde7e1304a4a52d2ccfcc5a0e124038d5cc93d9c03eeeaf6d837514245fd8e529148329cfb570d19e6cd93a14e5c72d298b4e743e6e3f2d1505573e8ebc19ae3
6
+ metadata.gz: 1aaf959db02e1ef2c2dadbcace84a159becdd37081b56c472d4231b4c44bdd0a5f7a42c74c0c96c9fa3af8f6e74052b9ea90d79b512ef7b898c82374a4fd0aa6
7
+ data.tar.gz: c1fe2d7f33df8ccd501374f69769cb057af2766bb35d8d536c24052961f4523df131a7e646c50616abf9e7f39a41d37b1559c47bab3b01c4883e8c6100f7a30e
@@ -46,25 +46,27 @@ module ChefZero
46
46
  extend WhenTheChefServerClassMethods
47
47
  include WhenTheChefServerInstanceMethods
48
48
 
49
- @@chef_server_options = { port: 8900, signals: false, log_requests: true, server_scope: :each }
49
+ # Take the passed-in options
50
50
 
51
- def self.chef_server_options
52
- @@chef_server_options
53
- end
51
+ define_singleton_method(:chef_server_options) {
52
+ @chef_server_options ||= begin
53
+ _chef_server_options = { port: 8900, signals: false, log_requests: true }
54
+ _chef_server_options = _chef_server_options.merge(tags.last) if tags.last.is_a?(Hash)
55
+ _chef_server_options = _chef_server_options.freeze
56
+ end
57
+ }
54
58
 
59
+ # Merge in chef_server_options from let(:chef_server_options)
55
60
  def chef_server_options
56
- self.class.chef_server_options
61
+ chef_server_options = self.class.chef_server_options.dup
62
+ chef_server_options = chef_server_options.merge(chef_zero_opts) if self.respond_to?(:chef_zero_opts)
63
+ chef_server_options
57
64
  end
58
65
 
59
- old_chef_server_url = nil
60
- old_node_name = nil
61
- old_client_key = nil
62
-
63
66
  before chef_server_options[:server_scope] do
64
- chef_server_options = self.chef_server_options
65
- chef_server_options = chef_server_options.merge(chef_zero_opts) if self.respond_to?(:chef_zero_opts)
66
- chef_server_options = chef_server_options.merge(tags.last) if tags.last.is_a?(Hash)
67
-
67
+ if chef_server_options[:server_scope] != self.class.chef_server_options[:server_scope]
68
+ raise "server_scope: #{chef_server_options[:server_scope]} will not be honored: it can only be set on when_the_chef_server!"
69
+ end
68
70
  Log.debug("Starting Chef server with options #{chef_server_options}")
69
71
 
70
72
  ChefZero::RSpec.set_server_options(chef_server_options)
@@ -74,9 +76,9 @@ module ChefZero
74
76
  end
75
77
 
76
78
  if defined?(Chef::Config)
77
- old_chef_server_url = Chef::Config.chef_server_url
78
- old_node_name = Chef::Config.node_name
79
- old_client_key = Chef::Config.client_key
79
+ @old_chef_server_url = Chef::Config.chef_server_url
80
+ @old_node_name = Chef::Config.node_name
81
+ @old_client_key = Chef::Config.client_key
80
82
  if chef_server_options[:organization]
81
83
  Chef::Config.chef_server_url = "#{ChefZero::RSpec.server.url}/organizations/#{chef_server_options[:organization]}"
82
84
  else
@@ -90,9 +92,9 @@ module ChefZero
90
92
 
91
93
  if defined?(Chef::Config)
92
94
  after chef_server_options[:server_scope] do
93
- Chef::Config.chef_server_url = old_chef_server_url
94
- Chef::Config.node_name = old_node_name
95
- Chef::Config.client_key = old_client_key
95
+ Chef::Config.chef_server_url = @old_chef_server_url
96
+ Chef::Config.node_name = @old_node_name
97
+ Chef::Config.client_key = @old_client_key
96
98
  end
97
99
  end
98
100
 
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '4.2.2'
2
+ VERSION = '4.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  requirements: []
241
241
  rubyforge_project:
242
- rubygems_version: 2.4.4
242
+ rubygems_version: 2.4.5
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: Self-contained, easy-setup, fast-start in-memory Chef server for testing