Knife zero plugin doesn't work on chef 12.x


#1

Hi Chefs,

I’m trying knife zero plugin.

But it doesn’t work on chef 12.x but it works on chef 11.x.

Can I use knife zero plugin on chef 12.x?
or Anything wrong with my procedure?

Knife zero’s author seems to remove the dependency on purpose.

Case A : chef 12.x


chef generate repo test cd test
mkdir .chef vi Gemfile
bundle install echo “local_mode true” >> .chef/knife.rb
$ bundle exec knife zero bootstrap test_ubuntu -x vagrant --sudo
Connecting to test_ubuntu
ERROR: knife encountered an unexpected error
This may be a bug in the ‘zero bootstrap’ knife command or plugin
Please collect the output of this command with the -VV option before
filing a bug report.
Exception: NameError: undefined local variable or method `chef_version’ for
#Chef::Knife::Core::BootstrapContext:0x007fe716eab550

http://tcotav.github.io/chefdk_getting_started.html

—Gemfile
gem "chef"
gem "knife-zero"
gem “berkshelf”

—Gemfile.lock
:
chef (12.0.3)
chef-zero (~> 3.2)
:

CaseB : chef 11.x

I changed Gemfile. Like this.

—Gemfile
gem “chef”, "11.16.4"
gem "knife-zero"
gem “berkshelf”

Then it works.

rm Gemfile.lock bundle install
$ bundle exec knife zero bootstrap test_ubuntu -x vagrant --sudo
ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly
Connecting to test_ubuntu
test_ubuntu Starting first Chef Client run…
test_ubuntu Starting Chef Client, version 11.8.2
test_ubuntu resolving cookbooks for run list: []
test_ubuntu Synchronizing Cookbooks:
test_ubuntu Compiling Cookbooks…
test_ubuntu [2014-12-24T05:08:50+00:00] WARN: Node vagrant-ubuntu-trusty-64
has an empty run list.
test_ubuntu Converging 0 resources
test_ubuntu Chef Client finished, 0 resources updated

—Gemfile.lock
:
chef (11.16.4)
chef-zero (~> 2.1, >= 2.1.4)
:

Regards,

Tsuyoshi


#2

Hi Chefs,

This problem was quickly fixed by the author of knife zero.

Now it has been updated and no problem.

Thanks.

On 24 December 2014 at 14:28, Tsuyoshi Ushio ushio@simplearchitect.com
wrote:

Hi Chefs,

I’m trying knife zero plugin.

But it doesn’t work on chef 12.x but it works on chef 11.x.

Can I use knife zero plugin on chef 12.x?
or Anything wrong with my procedure?

Knife zero’s author seems to remove the dependency on purpose.

https://github.com/higanworks/knife-zero/commit/927edbd6c281f3e7448a4e210949f1fa5e71557d

Case A : chef 12.x


chef generate repo test cd test
mkdir .chef vi Gemfile
bundle install echo “local_mode true” >> .chef/knife.rb
$ bundle exec knife zero bootstrap test_ubuntu -x vagrant --sudo
Connecting to test_ubuntu
ERROR: knife encountered an unexpected error
This may be a bug in the ‘zero bootstrap’ knife command or plugin
Please collect the output of this command with the -VV option before
filing a bug report.
Exception: NameError: undefined local variable or method `chef_version’
for #Chef::Knife::Core::BootstrapContext:0x007fe716eab550

http://tcotav.github.io/chefdk_getting_started.html

—Gemfile
gem "chef"
gem "knife-zero"
gem “berkshelf”

—Gemfile.lock
:
chef (12.0.3)
chef-zero (~> 3.2)
:

CaseB : chef 11.x

I changed Gemfile. Like this.

—Gemfile
gem “chef”, "11.16.4"
gem "knife-zero"
gem “berkshelf”

Then it works.

rm Gemfile.lock bundle install
$ bundle exec knife zero bootstrap test_ubuntu -x vagrant --sudo
ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped
shortly
Connecting to test_ubuntu
test_ubuntu Starting first Chef Client run…
test_ubuntu Starting Chef Client, version 11.8.2
test_ubuntu resolving cookbooks for run list: []
test_ubuntu Synchronizing Cookbooks:
test_ubuntu Compiling Cookbooks…
test_ubuntu [2014-12-24T05:08:50+00:00] WARN: Node
vagrant-ubuntu-trusty-64 has an empty run list.
test_ubuntu Converging 0 resources
test_ubuntu Chef Client finished, 0 resources updated

—Gemfile.lock
:
chef (11.16.4)
chef-zero (~> 2.1, >= 2.1.4)
:

Regards,

Tsuyoshi


#3

Hi guys, I have configured chef-client (windows platform) on my nodes to be run as a service. Using chef-service-manager util from CMD. Now I would like to change run interval from 1800 seconds to 900 ro any other value. I downloaded chef-client cookbook and created recipe as follow: node.default[“chef_client”][“interval”] = ‘900’ node.default[“chef_client”][“splay”] = ‘100’ I included chef-client cookbook in my cookbooks’s metadata.rb file as follow: Depends ‘chef-client’ Just for changing those values. But it doesn’t seem to take any affect. What I am doing wrong? Thank you in advance for your advises.
Regards, Taras.


#4

Hi guys, I have configured chef-client (windows platform) on my nodes to be run as a service. Using chef-service-manager util from CMD. Now I would like to change run interval from 1800 seconds to 900 ro any other value. I downloaded chef-client cookbook and created recipe as follow: node.default[“chef_client”][“interval”] = ‘900’ node.default[“chef_client”][“splay”] = ‘100’ I included chef-client cookbook in my cookbooks’s metadata.rb file as follow: Depends ‘chef-client’ Just for changing those values. But it doesn’t seem to take any affect. What I am doing wrong? Thank you in advance for your advises.
Regards, Taras.


#5

On 12/25/2014 8:48 AM, klum_tz@ukr.net wrote:

Hi guys,

I have configured chef-client (windows platform) on my nodes to be
run as a service.

Using chef-service-manager util from CMD.

Now I would like to change run interval from 1800 seconds to 900 ro
any other value.

I downloaded chef-client cookbook and created recipe as follow:

node.default["chef_client"]["interval"] = '900'

node.default["chef_client"]["splay"] = '100'

I included chef-client cookbook in my cookbooks’s metadata.rb file
as follow:

Depends ‘chef-client’

Just for changing those values.

But it doesn’t seem to take any affect.

What I am doing wrong?

The ‘depend’ line is 1 step of 2. You need to also call the appropriate
chef-client cookbook recipe from your cookbook. Just a ‘depend’ in the
metadata of your cookbook does not trigger any action on the node.


Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02