compat_resource 12.5.22 → 12.5.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56f5605c8ca73b413ec75b669cf3549c4de2f505
4
- data.tar.gz: f921bee4348789f9273c7f2b957e6ecd2f27e0d9
3
+ metadata.gz: 20b6ff32f42d52aecb0ecb45f035cd0f8c249cae
4
+ data.tar.gz: 307a13a11117fbda601165b63e63d778e9f558b4
5
5
  SHA512:
6
- metadata.gz: ed1175035f86084a16308023862e78a0fb629e69658a535a00eca05655e46b70c4057af23eb22f2131f75ac7ef46a4fccfde1eb080b09a6debbb217207898ad0
7
- data.tar.gz: 436e9ccc5fedd5f05c6968f7f8b16b0e335fc85fbc4408bcc6348b15d8d85fa264d13ac2360ba596a58271c84b370b884b4062ebce13c737df9be7e9006f0864
6
+ metadata.gz: ec41b460026d108a332797bbd87d0285bb3432d2e2a69abed92c724f680c7606cd0b50751f0170f815aca299df194598fb22eab1c5468c18a357fd547221aa11
7
+ data.tar.gz: c8a0dc03a4daf33d7b471ddb423365391049efd1d06e5c1e7aa16356013d85f6c2673f62bfd1f9007d675e8da0824abd9062ad53cd1f474fba43e77e828bedb9
data/Rakefile CHANGED
@@ -45,14 +45,14 @@ KEEP_FUNCTIONS = {
45
45
  resource_name self.use_automatic_resource_name
46
46
 
47
47
  identity state state_for_resource_reporter property_is_set reset_property
48
- to_hash
48
+ resource_initializing to_hash
49
49
  self.properties self.state_properties self.state_attr
50
50
  self.identity_properties self.identity_property self.identity_attrs
51
51
  self.property self.property_type
52
52
  self.lazy
53
53
 
54
54
  action allowed_actions self.allowed_actions self.default_action
55
- currently_running_action self.action self.declare_action_class self.action_class
55
+ self.action self.declare_action_class self.action_class
56
56
 
57
57
  load_current_value current_value_does_not_exist
58
58
  self.load_current_value
@@ -319,9 +319,9 @@ super if defined?(::Chef::Property)
319
319
  #
320
320
  # It won't do what they expect. This checks whether you try to *read*
321
321
  # `content` while we are compiling the resource.
322
- if resource.respond_to?(:enclosing_provider) && resource.enclosing_provider &&
323
- !resource.currently_running_action &&
324
- !name_property? &&
322
+ if resource.resource_initializing &&
323
+ resource.respond_to?(:enclosing_provider) &&
324
+ resource.enclosing_provider &&
325
325
  resource.enclosing_provider.respond_to?(name)
326
326
  Chef::Log.warn("#{Chef::Log.caller_location}: property #{name} is declared in both #{resource} and #{resource.enclosing_provider}. Use new_resource.#{name} instead. At #{Chef::Log.caller_location}")
327
327
  end
@@ -73,7 +73,7 @@ super if defined?(::Chef::Resource)
73
73
  return result.values.first if identity_properties.size == 1
74
74
  result
75
75
  end
76
- attr_reader :currently_running_action
76
+ attr_accessor :resource_initializing
77
77
  def to_hash
78
78
  # Grab all current state, then any other ivars (backcompat)
79
79
  result = {}
@@ -75,7 +75,14 @@ super if defined?(::Chef::ResourceBuilder)
75
75
  resource.params = params
76
76
 
77
77
  # Evaluate resource attribute DSL
78
- resource.instance_eval(&block) if block_given?
78
+ if block_given?
79
+ resource.resource_initializing = true
80
+ begin
81
+ resource.instance_eval(&block)
82
+ ensure
83
+ resource.resource_initializing = false
84
+ end
85
+ end
79
86
 
80
87
  # emit a cloned resource warning if it is warranted
81
88
  if prior_resource
@@ -1,3 +1,3 @@
1
1
  module CompatResource
2
- VERSION = '12.5.22'
2
+ VERSION = '12.5.23'
3
3
  end
@@ -1,20 +1,20 @@
1
1
  GEM
2
2
  specs:
3
3
  builder (3.2.2)
4
- chef (12.5.1)
5
- chef-config (= 12.5.1)
6
- chef-zero (~> 4.2, >= 4.2.2)
4
+ chef (12.1.0)
5
+ chef-zero (~> 4.0)
7
6
  diff-lcs (~> 1.2, >= 1.2.4)
8
7
  erubis (~> 2.7)
9
- ffi-yajl (~> 2.2)
8
+ ffi-yajl (~> 1.2)
10
9
  highline (~> 1.6, >= 1.6.9)
11
10
  mixlib-authentication (~> 1.3)
12
11
  mixlib-cli (~> 1.4)
12
+ mixlib-config (~> 2.0)
13
13
  mixlib-log (~> 1.3)
14
- mixlib-shellout (~> 2.0)
14
+ mixlib-shellout (>= 2.0.0.rc.0, < 3.0)
15
15
  net-ssh (~> 2.6)
16
16
  net-ssh-multi (~> 1.1)
17
- ohai (>= 8.6.0.alpha.1, < 9)
17
+ ohai (~> 8.0)
18
18
  plist (~> 3.1.0)
19
19
  pry (~> 0.9)
20
20
  rspec-core (~> 3.2)
@@ -23,13 +23,9 @@ GEM
23
23
  rspec_junit_formatter (~> 0.2.0)
24
24
  serverspec (~> 2.7)
25
25
  specinfra (~> 2.10)
26
- syslog-logger (~> 1.6)
27
- chef-config (12.5.1)
28
- mixlib-config (~> 2.0)
29
- mixlib-shellout (~> 2.0)
30
- chef-zero (4.4.0)
31
- ffi-yajl (~> 2.2)
32
- hashie (>= 2.0, < 4.0)
26
+ chef-zero (4.2.3)
27
+ ffi-yajl (>= 1.1, < 3.0)
28
+ hashie (~> 2.0)
33
29
  mixlib-log (~> 1.3)
34
30
  rack
35
31
  uuidtools (~> 2.1)
@@ -37,13 +33,15 @@ GEM
37
33
  diff-lcs (1.2.5)
38
34
  erubis (2.7.0)
39
35
  ffi (1.9.10)
40
- ffi-yajl (2.2.2)
36
+ ffi-yajl (1.4.0)
37
+ ffi (~> 1.5)
41
38
  libyajl2 (~> 1.2)
42
- hashie (3.4.3)
39
+ hashie (2.1.2)
43
40
  highline (1.7.8)
44
41
  ipaddress (0.8.0)
45
42
  libyajl2 (1.2.0)
46
43
  method_source (0.8.2)
44
+ mime-types (2.99)
47
45
  mixlib-authentication (1.3.0)
48
46
  mixlib-log
49
47
  mixlib-cli (1.5.0)
@@ -60,11 +58,11 @@ GEM
60
58
  net-ssh (>= 2.6.5)
61
59
  net-ssh-gateway (>= 1.2.0)
62
60
  net-telnet (0.1.1)
63
- ohai (8.8.1)
64
- chef-config (>= 12.5.0.alpha.1, < 13)
61
+ ohai (8.4.0)
65
62
  ffi (~> 1.9)
66
- ffi-yajl (~> 2.2)
63
+ ffi-yajl (>= 1.1, < 3.0)
67
64
  ipaddress
65
+ mime-types (~> 2.0)
68
66
  mixlib-cli
69
67
  mixlib-config (~> 2.0)
70
68
  mixlib-log
@@ -110,7 +108,6 @@ GEM
110
108
  net-ssh (>= 2.7, < 3.1)
111
109
  net-telnet
112
110
  sfl
113
- syslog-logger (1.6.8)
114
111
  systemu (2.6.5)
115
112
  uuidtools (2.1.5)
116
113
  wmi-lite (1.0.0)
@@ -119,7 +116,7 @@ PLATFORMS
119
116
  ruby
120
117
 
121
118
  DEPENDENCIES
122
- chef (= 12.5.1)
119
+ chef (>= 12.1, < 12.2)
123
120
 
124
121
  BUNDLED WITH
125
122
  1.10.6
@@ -4,5 +4,9 @@ class FutureCustomResource < ChefCompat::Resource
4
4
  action :create do
5
5
  converge_if_changed do
6
6
  end
7
+ future_custom_resource 'hi' do
8
+ x x # test that a warning is emitted properly (and no crashey)
9
+ action :nothing
10
+ end
7
11
  end
8
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compat_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.5.22
4
+ version: 12.5.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser