chef-provisioning-aws 1.0.3 → 1.0.4

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: 60ebd61ee3e107a614c90db71adbdfcf2f10af7f
4
- data.tar.gz: f95d73cf8361f9e5e9b6d235f82f84bffaa7b65f
3
+ metadata.gz: dd5c21364731d0404bcc87495c3a1e7fddc9b107
4
+ data.tar.gz: b0f57238cd577c5be3b7ee652079d1185a3fef8f
5
5
  SHA512:
6
- metadata.gz: 9a421dd9254887af2fd4d1d07c8bd00d6f638da36b36e8ddea987eae6cbd465b8d265490856cb1a46800d2a67749285cc33619d950b09959d35507e9a16d8038
7
- data.tar.gz: af3179a1ff3b3ab61e7c7a331119ad0f56423893d40e294c7e364228dfe89a89ffe5e84139107455a1479c48e6d5cd03d7462f32306f72190a705c8aa36c98cc
6
+ metadata.gz: 9676f4c941de6c694f9df2d58d04b0fd03a5958a23c10cacae91a50c4bfe52d1aadf249e36346ab2c003f4931d127d599a744ba9740505ee2d3c457f08ba6d79
7
+ data.tar.gz: c84c5149b0127cfabed5ad71f967a48cc0dce1cf05ebc80b8b90e3433b1ac485f5ff2a42459d4167aa1e954112617cf8cf8d4f295c6623b547ef97f8c60c85f3
@@ -1,45 +1,64 @@
1
1
  require 'chef/resource/lwrp_base'
2
2
 
3
3
  class Chef
4
- module Provisioning
5
- module AWSDriver
6
- class SuperLWRP < Chef::Resource::LWRPBase
7
- #
8
- # Add the :lazy_default and :coerce validation_opts to `attribute`
9
- #
10
- def self.attribute(attr_name, validation_opts={})
11
- lazy_default = validation_opts.delete(:lazy_default)
12
- coerce = validation_opts.delete(:coerce)
13
- if lazy_default || coerce
14
- define_method(attr_name) do |arg=nil|
15
- arg = instance_exec(arg, &coerce) if coerce && !arg.nil?
4
+ module Provisioning
5
+ module AWSDriver
6
+ class SuperLWRP < Chef::Resource::LWRPBase
7
+ #
8
+ # Add the :lazy_default and :coerce validation_opts to `attribute`
9
+ #
10
+ def self.attribute(attr_name, validation_opts={})
11
+ lazy_default = validation_opts.delete(:lazy_default)
12
+ coerce = validation_opts.delete(:coerce)
13
+ if lazy_default || coerce
14
+ define_method(attr_name) do |arg=nil|
15
+ arg = instance_exec(arg, &coerce) if coerce && !arg.nil?
16
16
 
17
- result = set_or_return(attr_name.to_sym, arg, validation_opts)
17
+ result = set_or_return(attr_name.to_sym, arg, validation_opts)
18
18
 
19
- if result.nil? && arg.nil?
20
- result = instance_eval(&lazy_default) if lazy_default
21
- end
19
+ if result.nil? && arg.nil?
20
+ result = instance_eval(&lazy_default) if lazy_default
21
+ end
22
22
 
23
- result
24
- end
25
- define_method(:"#{attr_name}=") do |arg|
26
- if arg.nil?
27
- remove_instance_variable(:"@#{arg}")
28
- else
29
- set_or_return(attr_name.to_sym, arg, validation_opts)
30
- end
31
- end
23
+ result
24
+ end
25
+ define_method(:"#{attr_name}=") do |arg|
26
+ if arg.nil?
27
+ remove_instance_variable(:"@#{arg}")
32
28
  else
33
- super
29
+ set_or_return(attr_name.to_sym, arg, validation_opts)
34
30
  end
35
31
  end
32
+ else
33
+ super
34
+ end
35
+ end
36
36
 
37
- # FUUUUUU cloning
38
- def load_prior_resource(*args)
39
- Chef::Log.debug "Overloading #{self.resource_name} load_prior_resource with NOOP"
40
- end
37
+ # FUUUUUU cloning - this works for Chef 11 or 12.1
38
+ def load_prior_resource(*args)
39
+ Chef::Log.debug "Overloading #{self.resource_name} load_prior_resource with NOOP"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
41
45
 
42
- end
46
+ module NoResourceCloning
47
+ def prior_resource
48
+ if resource_class.kind_of?(Chef::Provisioning::AWSDriver::SuperLWRP)
49
+ Chef::Log.debug "Canceling resource cloning for #{resource_class}"
50
+ nil
51
+ else
52
+ super
43
53
  end
44
54
  end
55
+ def emit_cloned_resource_warning; end
56
+ def emit_harmless_cloning_debug; end
57
+ end
58
+
59
+ # Chef 12.2 changed `load_prior_resource` logic to be in the Chef::ResourceBuilder class
60
+ # but that class only exists in 12.2 and up
61
+ if defined? Chef::ResourceBuilder
62
+ # Ruby 2.0.0 has prepend as a protected method
63
+ Chef::ResourceBuilder.send(:prepend, NoResourceCloning)
45
64
  end
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  module Provisioning
3
3
  module AWSDriver
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Ewart
@@ -73,7 +73,7 @@ dependencies:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '4.2'
76
- type: :runtime
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements: