New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test me] compile_time works with Chef 11/12 including chef-sugar #110
[test me] compile_time works with Chef 11/12 including chef-sugar #110
Conversation
@@ -18,6 +18,7 @@ | |||
# | |||
chef_gem 'aws-sdk' do | |||
version node['aws']['aws_sdk_version'] | |||
compile_time true if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method_defined?
is a better check here (and more efficient)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work with method_defined?
.
Chef 11.18.6
==> zs1: ================================================================================
==> zs1: Recipe Compile Error in /var/chef/cache/cookbooks/mesosphere/recipes/test.rb
==> zs1: ================================================================================
==> zs1:
==> zs1:
==> zs1: ArgumentError
==> zs1: -------------
==> zs1: block not supplied
==> zs1:
==> zs1:
==> zs1: Cookbook Trace:
==> zs1: ---------------
==> zs1: /var/chef/cache/cookbooks/aws/recipes/default.rb:22:in `block in from_file'
==> zs1:
==> zs1: /var/chef/cache/cookbooks/aws/recipes/default.rb:19:in `from_file'
==> zs1:
==> zs1: /var/chef/cache/cookbooks/mesosphere/recipes/test.rb:3:in `from_file'
==> zs1:
==> zs1:
==> zs1: Relevant File Content:
==> zs1: ----------------------
==> zs1: /var/chef/cache/cookbooks/aws/recipes/default.rb:
==> zs1:
==> zs1: 15: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
==> zs1: 16: # See the License for the specific language governing permissions and
==> zs1: 17: # limitations under the License.
==> zs1: 18: #
==> zs1: 19: chef_gem 'aws-sdk' do
==> zs1: 20: version node['aws']['aws_sdk_version']
==> zs1: 21: if Chef::Resource::ChefGem.method_defined?(:compile_time)
==> zs1: 22>> compile_time
==> zs1: 23: end
==> zs1: 24: action :install
==> zs1: 25: end
==> zs1: 26:
==> zs1: 27: require 'aws-sdk'
==> zs1: 28:
==> zs1:
@scalp42 you need to provide a value for |
@scalp42 as @sethvargo mentioned you need to provide |
This is essentially the same fix as chef-boneyard/chef-vault@4739a65 - because I stole this for that one (thanks @scalp42!). |
[test me] compile_time works with Chef 11/12 including chef-sugar
For the record, I have renamed the function in Chef Sugar v3.0.1 to |
Thanks @sethvargo for reconsidering it. |
not entirely sure what's going on here, but i've backported some code from sous-chefs/aws#110 and chef-cookbooks/xml#22
The test recipe is the following (please note that this is the patched aws from this PR, with a little difference to trigger warning, see below):
chef_gem
patched code (compile_time
is not set to anything to trigger the warning):Here are my results:
Chef 12.1.0.dev.0, without specifying
true
, justcompile_time
to show the warning :Chef 12.0.3, don't see any log, but both gems are installed:
Chef 11.16.4, don't see any log, but both gems are installed:
Chef 11.18.6, don't see any log, but both gems are installed:
I also tried with
chef_12.2.0-alpha.0-1_amd64.deb
(which does not supportcompile_time
):I'm mostly breaking "something" as I don't see the resource being listed in the log but hopefully it helps.