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

Merged
merged 1 commit into from Mar 20, 2015

Conversation

Projects
None yet
5 participants
@scalp42
Contributor

scalp42 commented Feb 19, 2015

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):

include_recipe 'chef-sugar'
include_recipe 'aws'

chef_gem patched code (compile_time is not set to anything to trigger the warning):

chef_gem 'aws-sdk' do
  version node['aws']['aws_sdk_version']
  if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
    compile_time
  end
  action :install
end

Here are my results:

Chef 12.1.0.dev.0, without specifying true, just compile_time to show the warning :

==> zs1: [2015-02-19T06:47:57+00:00] INFO: Forking chef instance to converge...
==> zs1: [2015-02-19T06:47:57+00:00] INFO: *** Chef 12.1.0.dev.0 ***
==> zs1: [2015-02-19T06:47:57+00:00] INFO: Chef-client pid: 14440
==> zs1: [2015-02-19T06:48:15+00:00] WARN: chef_gem[chef-sugar] chef_gem compile_time installation is deprecated
==> zs1: [2015-02-19T06:48:15+00:00] WARN: chef_gem[chef-sugar] Please set `compile_time false` on the resource to use the new behavior.
==> zs1: [2015-02-19T06:48:15+00:00] WARN: chef_gem[chef-sugar] or set `compile_time true` on the resource if compile_time behavior is required.
==> zs1: [2015-02-19T06:48:23+00:00] INFO: chef_gem[chef-sugar] installed chef-sugar at 2.5.0
==> zs1: [2015-02-19T06:48:23+00:00] WARN: chef_gem[aws-sdk] chef_gem compile_time installation is deprecated
==> zs1: [2015-02-19T06:48:23+00:00] WARN: chef_gem[aws-sdk] Please set `compile_time false` on the resource to use the new behavior.
==> zs1: [2015-02-19T06:48:23+00:00] WARN: chef_gem[aws-sdk] or set `compile_time true` on the resource if compile_time behavior is required.
==> zs1: [2015-02-19T06:48:31+00:00] INFO: chef_gem[aws-sdk] installed aws-sdk at ~> 2.0.22
==> zs1: [2015-02-19T06:48:32+00:00] INFO: Chef Run complete in 28.265871351 seconds

Chef 12.0.3, don't see any log, but both gems are installed:

==> zs1: [2015-02-19T06:53:56+00:00] INFO: *** Chef 12.0.3 ***
==> zs1: [2015-02-19T06:53:56+00:00] INFO: Chef-client pid: 14938
==> zs1: [2015-02-19T06:54:24+00:00] INFO: Chef Run complete in 20.955133524 seconds
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep chef
chef (12.0.3)
chef-sugar (2.5.0)
chef-zero (3.2.1)
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep aws
aws-sdk (2.0.26)
aws-sdk-core (2.0.26)
aws-sdk-resources (2.0.26)

Chef 11.16.4, don't see any log, but both gems are installed:

==> zs1: [2015-02-19T06:56:38+00:00] INFO: *** Chef 11.16.4 ***
==> zs1: [2015-02-19T06:56:38+00:00] INFO: Chef-client pid: 15433
==> zs1: /var/chef/cache/cookbooks/homebrew/libraries/homebrew_package.rb:26: warning: toplevel constant Homebrew referenced by Chef::Provider::Package::Homebrew
==> zs1: [2015-02-19T06:57:47+00:00] INFO: Chef Run complete in 25.402963436 seconds
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep chef
chef (11.16.4)
chef-sugar (2.5.0)
chef-zero (2.2)
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep aws
aws-sdk (2.0.26)
aws-sdk-core (2.0.26)
aws-sdk-resources (2.0.26)

Chef 11.18.6, don't see any log, but both gems are installed:

==> zs1: [2015-02-19T06:58:47+00:00] INFO: *** Chef 11.18.6 ***
==> zs1: [2015-02-19T06:58:47+00:00] INFO: Chef-client pid: 16297
==> zs1: /var/chef/cache/cookbooks/homebrew/libraries/homebrew_package.rb:26: warning: toplevel constant Homebrew referenced by Chef::Provider::Package::Homebrew
==> zs1: [2015-02-19T06:59:22+00:00] INFO: Chef Run complete in 27.925290915 seconds
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep chef
chef (11.18.6)
chef-sugar (2.5.0)
chef-zero (2.2.1)
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep aws
aws-sdk (2.0.26)
aws-sdk-core (2.0.26)
aws-sdk-resources (2.0.26)

I also tried with chef_12.2.0-alpha.0-1_amd64.deb (which does not support compile_time):

==> zs1: [2015-02-19T07:00:55+00:00] INFO: *** Chef 12.2.0.alpha.0 ***
==> zs1: [2015-02-19T07:00:55+00:00] INFO: Chef-client pid: 16759
==> zs1: [2015-02-19T07:01:41+00:00] INFO: Starting audit phase
==> zs1: [2015-02-19T07:01:42+00:00] INFO: Successfully executed all controls blocks and contained examples
==> zs1:
==> zs1: Finished in 0.00018 seconds (files took 0.35235 seconds to load)
==> zs1: 0 examples, 0 failures
==> zs1: [2015-02-19T07:01:42+00:00] INFO: Chef Run complete in 39.759534584 seconds
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep chef
chef (12.2.0.alpha.0)
chef-sugar (2.5.0)
chef-zero (3.2)
root@mesosphere-scalp-vagrant-vbox-1:~# /opt/chef/embedded/bin/gem list | grep aws
aws-sdk (2.0.26)
aws-sdk-core (2.0.26)
aws-sdk-resources (2.0.26)

I'm mostly breaking "something" as I don't see the resource being listed in the log but hopefully it helps.

@scalp42 scalp42 changed the title from compile_time works with Chef 11/12 including chef-sugar to [test me] compile_time works with Chef 11/12 including chef-sugar Feb 19, 2015

@@ -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)

This comment has been minimized.

@sethvargo

sethvargo Feb 19, 2015

Contributor

method_defined? is a better check here (and more efficient)

@sethvargo

sethvargo Feb 19, 2015

Contributor

method_defined? is a better check here (and more efficient)

This comment has been minimized.

@scalp42

scalp42 Feb 19, 2015

Contributor

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

scalp42 Feb 19, 2015

Contributor

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:
@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Feb 19, 2015

Contributor

@scalp42 you need to provide a value for compile_time I think

Contributor

sethvargo commented Feb 19, 2015

@scalp42 you need to provide a value for compile_time I think

@martinisoft

This comment has been minimized.

Show comment
Hide comment
@martinisoft

martinisoft Feb 24, 2015

@scalp42 as @sethvargo mentioned you need to provide true to compile_time as an argument there.

martinisoft commented Feb 24, 2015

@scalp42 as @sethvargo mentioned you need to provide true to compile_time as an argument there.

@jtimberman

This comment has been minimized.

Show comment
Hide comment
@jtimberman

jtimberman Mar 20, 2015

Member

This is essentially the same fix as chef-cookbooks/chef-vault@4739a65 - because I stole this for that one (thanks @scalp42!).

Member

jtimberman commented Mar 20, 2015

This is essentially the same fix as chef-cookbooks/chef-vault@4739a65 - because I stole this for that one (thanks @scalp42!).

jtimberman added a commit that referenced this pull request Mar 20, 2015

Merge pull request #110 from scalp42/fix_chef_12_compile_time
[test me] compile_time works with Chef 11/12 including chef-sugar

@jtimberman jtimberman merged commit 712bff8 into chef-cookbooks:master Mar 20, 2015

@sethvargo

This comment has been minimized.

Show comment
Hide comment
@sethvargo

sethvargo Mar 20, 2015

Contributor

For the record, I have renamed the function in Chef Sugar v3.0.1 to at_compile_time to avoid the conflict.

Contributor

sethvargo commented Mar 20, 2015

For the record, I have renamed the function in Chef Sugar v3.0.1 to at_compile_time to avoid the conflict.

@scalp42

This comment has been minimized.

Show comment
Hide comment
@scalp42

scalp42 Mar 20, 2015

Contributor

Thanks @sethvargo for reconsidering it.

Contributor

scalp42 commented Mar 20, 2015

Thanks @sethvargo for reconsidering it.

@scalp42 scalp42 deleted the scalp42:fix_chef_12_compile_time branch Nov 4, 2015

rxbynerd added a commit to rentify/letsencrypt that referenced this pull request Feb 11, 2016

backport for chef 11
not entirely sure what's going on here, but i've backported some code from chef-cookbooks/aws#110 and chef-cookbooks/xml#22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment