I'm trying to get a server up and running via knife bootstrap via this command:
knife bootstrap "<ip-address>"
-x ec2-user
-r recipe[connector],recipe[all-servers]
-N "serv-name"
-E staging
-i "~/.chef/mycert.pem"
--sudo
--no-host-key-verify
The all-servers recipe includes dependencies for windows that are broken in chef 13+:
(TLDRS, full stack traces are at the bottom)
13: undefined method “kernel” (outdated 7-zip cookbook dependency 3.0 instead of 2.0)
14: cannot load such file -- chef/mixin/language (windows cookbook dependency, 3.0 + for windows cookbook would fix this)
15: manual license acceptance required and cannot load such file -- chef/mixin/language error (windows cookbook dependency, 3.0 + for windows cookbook would fix this)
The big problem is that a bunch of under-maintained services use the older versions and upgrading any of them is likely to cause multitudes of problems throughout the chef org, so I want to have just this server use a newer version of either the windows or 7-zip cookbook.
What I tried to do to solve for this was created a new cookbook "all-servers-dev" and created dev versions of all the cookbooks in the dependency tree all the way down to "windows" where I downloaded the updated windows cookbook and replaced it at the bottom of the dependency tree. This didn't work however because chef keeps trying to sync all cookbooks even the windows one even though it's not included anywhere in the dependency tree that I can find.
I even tried removing the all-servers recipe and just installing the connector recipe whose only dependency is yum-epel whose only dependency is "compat_resource" which has no dependencies.
13.12.14
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/seven_zip/attributes/default.rb
================================================================================
NoMethodError
-------------
undefined method `kernel' for #<Chef::Node::Attribute:xxxxxxxxxxxxxxxxx>
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/seven_zip/attributes/default.rb:21:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/seven_zip/attributes/default.rb:
14: # Unless required by applicable law or agreed to in writing, software
15: # distributed under the License is distributed on an "AS IS" BASIS,
16: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: # See the License for the specific language governing permissions and
18: # limitations under the License.
19: #
20:
21>> if kernel['machine'] =~ /x86_64/
22: default['seven_zip']['url'] = 'http://www.7-zip.org/a/7z1514-x64.msi'
23: default['seven_zip']['checksum'] = 'xxxxxxxxxx'
24: default['seven_zip']['package_name'] = '7-Zip 15.14 (x64 edition)'
25: else
26: default['seven_zip']['url'] = 'http://www.7-zip.org/a/7z1514.msi'
27: default['seven_zip']['checksum'] = 'xxxxxxxxxx'
28: default['seven_zip']['package_name'] = '7-Zip 15.14'
29: end
30:
System Info:
------------
chef_version=13.12.14
platform=amazon
platform_version=2017.03
ruby=ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]
program_name=chef-client worker: ppid=3493;start=17:29:14;
executable=/opt/chef/bin/chef-client
Running handlers:
[2019-12-04T17:29:32+00:00] ERROR: Running exception handlers
Running handlers complete
[2019-12-04T17:29:32+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 17 seconds
[2019-12-04T17:29:32+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2019-12-04T17:29:32+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-12-04T17:29:32+00:00] ERROR: undefined method `kernel' for #<Chef::Node::Attribute:xxxxxxxxxx>
[2019-12-04T17:29:32+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
14.14.29
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/windows/libraries/windows_package.rb
================================================================================
LoadError
---------
cannot load such file -- chef/mixin/language
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/windows/libraries/windows_package.rb:7:in `<top (required)>'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/windows/libraries/windows_package.rb:
1: require 'chef/resource/lwrp_base'
2: require 'chef/provider/lwrp_base'
3:
4: require 'win32/registry' if RUBY_PLATFORM =~ /mswin|mingw32|windows/
5:
6: require 'chef/mixin/shell_out'
7>> require 'chef/mixin/language'
8: class Chef
9: class Provider
10: class WindowsCookbookPackage < Chef::Provider::LWRPBase
11: include Chef::Mixin::ShellOut
12: include Windows::Helper
13:
14: # the logic in all action methods mirror that of
15: # the Chef::Provider::Package which will make
16: # refactoring into core chef easy
System Info:
------------
chef_version=14.14.29
platform=amazon
platform_version=2017.03
ruby=ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef/bin/chef-client
Running handlers:
[2019-12-04T18:06:28+00:00] ERROR: Running exception handlers
Running handlers complete
[2019-12-04T18:06:28+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 35 seconds
[2019-12-04T18:06:28+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2019-12-04T18:06:28+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-12-04T18:06:28+00:00] FATAL: LoadError: cannot load such file -- chef/mixin/language
15.5.17 Chef has a new prompt that’s unhandled by knife bootstrap:
Do you accept the 2 product licenses (yes/no)?
You can’t accept these from the bootstrap CLI, so you have to ssh to the server and run chef manually which then results in the same error as 14:
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/windows/libraries/windows_package.rb
================================================================================
LoadError
---------
cannot load such file -- chef/mixin/language
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/windows/libraries/windows_package.rb:7:in `<top (required)>'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/windows/libraries/windows_package.rb:
1: require 'chef/resource/lwrp_base'
2: require 'chef/provider/lwrp_base'
3:
4: require 'win32/registry' if RUBY_PLATFORM =~ /mswin|mingw32|windows/
5:
6: require 'chef/mixin/shell_out'
7>> require 'chef/mixin/language'
8: class Chef
9: class Provider
10: class WindowsCookbookPackage < Chef::Provider::LWRPBase
11: include Chef::Mixin::ShellOut
12: include Windows::Helper
13:
14: # the logic in all action methods mirror that of
15: # the Chef::Provider::Package which will make
16: # refactoring into core chef easy
System Info:
------------
chef_version=15.5.17
platform=amazon
platform_version=2017.03
ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef/bin/chef-client
Running handlers:
[2019-12-04T18:14:03+00:00] ERROR: Running exception handlers
Running handlers complete
[2019-12-04T18:14:03+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 18 seconds
[2019-12-04T18:14:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2019-12-04T18:14:03+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-12-04T18:14:03+00:00] FATAL: LoadError: cannot load such file -- chef/mixin/language
15.5.17 Chef has a new prompt that’s unhandled by knife bootstrap:
Do you accept the 2 product licenses (yes/no)?
You can’t accept these from the bootstrap CLI, so you have to ssh to the server and run chef manually
that is incorrect, you can use --chef-license accept
when you bootstrap the node to accept the chef license
if i understood your right, you wish to pin the different versions of the same cookbooks collection. if that is the case, you can acheive it by using environment:
Cookbook versions can be pinned in each environment, which allows you to control the rollout of new cookbook releases through successive testing environments before releasing new cookbook versions into production environments. See the environment format examples below for the cookbook pinning syntax.
so just remember to associate your nodes with specific chef environment, such that each environment has its own cookbook collection.