chef-cookbooks / chef-ingredient Goto Github PK
View Code? Open in Web Editor NEWPrimitives for managing Chef products and packages
Home Page: https://supermarket.chef.io/cookbooks/chef-ingredient
License: Apache License 2.0
Primitives for managing Chef products and packages
Home Page: https://supermarket.chef.io/cookbooks/chef-ingredient
License: Apache License 2.0
I would like to execute an inspec profile preflight install test before installing each product.
Add a 'preflight profile repo' attribute to chef-ingredient to run an inspec profile to run before we install to all a product?
The package name for debian/ubuntu variants is 'push-jobs-client' in packagecloud, and the chef-ingredient helper looks for 'opscode-push-jobs-client'. This breaks the install of the push-jobs cookbook as well.
$ apt-cache policy push-jobs-client
push-jobs-client:
Installed: (none)
Candidate: 1.3.3-1
Version table:
1.3.3-1 0
500 https://packagecloud.io/chef/stable/ubuntu/ trusty/main amd64 Packages
$ apt-cache policy opscode-push-jobs-client
opscode-push-jobs-client:
Installed: (none)
Candidate: (none)
Version table:
This is the result from the push-client cookbook:
* apt_package[push-client] action install
================================================================================
Error executing action `install` on resource 'apt_package[push-client]'
================================================================================
Chef::Exceptions::Package
-------------------------
opscode-push-jobs-client has no candidate in the apt-cache
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/chef-ingredient/libraries/debian_handler.rb
66: package new_resource.product_name do # ~FC009
67: action action_name
68: package_name ingredient_package_name
69: options new_resource.options
70: timeout new_resource.timeout
71:
72: # If the user specifies "0.0.0", :latest or "latest" as version,
73: # we should not give any version to the package resource.
74: if Mixlib::Versioning.parse(version_string(new_resource.version)) > '0.0.0'
75: version version_for_package_resource
76: end
77:
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/chef-ingredient/libraries/debian_handler.rb:66:in `configure_package'
apt_package("push-client") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "opscode-push-jobs-client"
timeout 900
declared_type :package
cookbook_name "push-jobs"
end
Render configuration files, use the config
property from the ingredients:
chef_ingredient "chef-server" do
config api_fqdn: node['fqdn']
action [:install, :reconfigure]
end
ingredient_config "chef-server" do
notifies :reconfigure, "chef_ingredient[chef-server-core]"
end
There are some bugs on the actual code that I will try to debug and repair but one example is this line:
Where package_name
does not even exist on the resource
😭
================================================================================
Error executing action `reconfigure` on resource 'chef_ingredient[manage]'
================================================================================
NoMethodError
-------------
undefined method `package_name' for Chef::Resource::ChefIngredient
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:88:in `block in <class:ChefIngredient>'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/chef-server-12/libraries/default.rb
24: chef_ingredient plugin
25:
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/chef-server-12/libraries/default.rb:24:in `install_plugin'
chef_ingredient("manage") do
action [:install]
updated true
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chef_ingredient
cookbook_name "chef-server-12"
recipe_name "default"
product_name "manage"
channel :stable
version :latest
end
I'm trying to run the cookbook push-jobs (2.6.4) that depends on this chef-ingredient.
But, I'm running on a RedHat without Internet access. So, even setting the gem_url attribute to a local repo with the GEM package, it is trying to install gems from RubyGems.org repository.
chef-client log:
[2016-04-04T19:09:58-03:00] INFO: Processing chef_gem[mixlib-install] action install (dynamically defined)
[2016-04-04T19:12:05-03:00] WARN: failed to find gem mixlib-install (= 0.8.0.alpha.6) from [https://rubygems.org/]
[2016-04-04T19:16:18-03:00] INFO: Running queued delayed notifications before re-raising exception
[2016-04-04T19:16:18-03:00] ERROR: Running exception handlers
[2016-04-04T19:16:18-03:00] ERROR: Exception handlers complete
[2016-04-04T19:16:18-03:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-04-04T19:16:18-03:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-04-04T19:16:18-03:00] ERROR: chef_ingredient[push-client] (push-jobs::linux line 47) had an error: Mixlib::ShellOut::ShellCommandFailed: chef_gem[mixlib-install] (dynamically defined) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of /opt/chef/embedded/bin/gem install mixlib-install -q --no-rdoc --no-ri -v "0.8.0.alpha.6" ----
STDOUT:
STDERR: ERROR: Could not find a valid gem 'mixlib-install' (= 0.8.0.alpha.6), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Connection timed out - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/specs.4.8.gz)
---- End output of /opt/chef/embedded/bin/gem install mixlib-install -q --no-rdoc --no-ri -v "0.8.0.alpha.6" ----
Ran /opt/chef/embedded/bin/gem install mixlib-install -q --no-rdoc --no-ri -v "0.8.0.alpha.6" returned 2
[2016-04-04T19:16:18-03:00] ERROR: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
And even with the gem installed locally, it continues to trying to install the gem:
# /opt/chef/embedded/bin/gem list mixlib-install
*** LOCAL GEMS ***
mixlib-install (0.8.0.alpha.8)
Am I doing something wrong?
Thanks very much.
Hi,
When I try to install chef-server using chefdk 0.10.0, the execution failed with the following log :
install
on resource 'chef_gem[mixlib-install]'Broken pipe @ io_write -
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:120:in install_gem_from_rubygems' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:104:in
ensure_mixlib_install_gem_installed!'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:40:in ingredient_package_name' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:67:in
block in configure_package'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:65:in configure_package' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:21:in
handle_install'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:54:in `block in class:ChefIngredient'
chef_gem("mixlib-install") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "mixlib-install"
version "0.8.0.alpha.2"
gem_binary "/opt/chefdk/embedded/bin/gem"
end
install
on resource 'chef_ingredient[chef-server]'chef_gem[mixlib-install](dynamically defined) had an error: Errno::EPIPE: Broken pipe @ io_write -
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:120:in install_gem_from_rubygems' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:104:in
ensure_mixlib_install_gem_installed!'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:40:in ingredient_package_name' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:67:in
block in configure_package'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:65:in configure_package' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:21:in
handle_install'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:54:in `block in class:ChefIngredient'
26: chef_ingredient 'chef-server' do
27: extend ChefServerCookbook::Helpers
28: version node['chef-server']['version']
29: package_source node['chef-server']['package_source']
30: config <<-EOS
31: topology "#{node['chef-server']['topology']}"
32: #{"api_fqdn "#{node['chef-server']['api_fqdn']}"" if api_fqdn_available?}
33: #{node['chef-server']['configuration']}
34: EOS
35: action :install
36: end
37:
chef_ingredient("chef-server") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chef_ingredient
cookbook_name :"chef-server"
recipe_name "default"
config "topology "standalone"\napi_fqdn "mo-78d3593f9.mo.sap.corp"\n\n"
product_name "chef-server"
end
[2016-02-19T13:48:58+00:00] INFO: Running queued delayed notifications before re-raising exception
[2016-02-19T13:48:58+00:00] DEBUG: Re-raising exception: Errno::EPIPE - chef_ingredient[chef-server](chef-server::default line 26) had an error: Errno::EPIPE: chef_gem[mixlib-install](dynamically defined) had an error: Errno::EPIPE: Broken pipe @ io_write -
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1168:in write' /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1168:in
warn'
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1168:in reset' /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:882:in
dirs='
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:297:in gem_specification' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:90:in
installed_versions'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:454:in matching_installed_versions' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:437:in
current_version'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:470:in load_current_resource' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider.rb:127:in
run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource.rb:588:in run_action' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:120:in
install_gem_from_rubygems'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:104:in ensure_mixlib_install_gem_installed!' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:40:in
ingredient_package_name'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource.rb:1577:in method_missing' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:67:in
block in configure_package'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_builder.rb:77:in instance_eval' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_builder.rb:77:in
build'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/recipe.rb:108:in build_resource' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/recipe.rb:69:in
declare_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/resources.rb:15:in package' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:65:in
configure_package'
/var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:21:in handle_install' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:54:in
block in class:ChefIngredient'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider.rb:362:in action_install' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider.rb:144:in
run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource.rb:588:in run_action' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:53:in
run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:85:in block (2 levels) in converge' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:85:in
each'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:85:in block in converge' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/resource_list.rb:83:in
block in execute_each_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:116:in call' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:85:in step' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:104:in
iterate'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/resource_list.rb:81:in
execute_each_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:84:in converge' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:653:in
block in converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:648:in catch' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:648:in
converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:687:in converge_and_save' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:269:in
run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:270:in block in fork_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:258:in
fork'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:258:in fork_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:224:in
block in run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/local_mode.rb:44:in with_server_connectivity' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:212:in
run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/solo.rb:280:in block in interval_run_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/solo.rb:269:in
loop'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/solo.rb:269:in interval_run_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/solo.rb:247:in
run_application'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:60:in run' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/bin/chef-solo:25:in
<top (required)>'
/opt/chefdk/bin/chef-solo:54:in load' /opt/chefdk/bin/chef-solo:54:in
write' /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1168:in
warn'reset' /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:882:in
dirs='gem_specification' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:90:in
installed_versions'matching_installed_versions' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider/package/rubygems.rb:437:in
current_version'load_current_resource' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider.rb:127:in
run_action'run_action' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:120:in
install_gem_from_rubygems'ensure_mixlib_install_gem_installed!' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/helpers.rb:40:in
ingredient_package_name'method_missing' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:67:in
block in configure_package'instance_eval' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_builder.rb:77:in
build'build_resource' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/dsl/recipe.rb:69:in
declare_resource'package' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/rhel_handler.rb:65:in
configure_package'handle_install' /var/lib/monsoon/repos/devops_automation/manu_chef_server/chef/site-cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:54:in
block in class:ChefIngredient'action_install' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/provider.rb:144:in
run_action'run_action' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:53:in
run_action'block (2 levels) in converge' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/runner.rb:85:in
each'block in converge' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/resource_list.rb:83:in
block in execute_each_resource'call' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block'step' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/stepable_iterator.rb:104:in
iterate'each_with_index' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/resource_collection/resource_list.rb:81:in
execute_each_resource'converge' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:653:in
block in converge'catch' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:648:in
converge'converge_and_save' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/client.rb:269:in
run'block in fork_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:258:in
fork'fork_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:224:in
block in run_chef_client'with_server_connectivity' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application.rb:212:in
run_chef_client'block in interval_run_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/solo.rb:269:in
loop'interval_run_chef_client' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/application/solo.rb:247:in
run_application'run' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/bin/chef-solo:25:in
<top (required)>'load' /opt/chefdk/bin/chef-solo:54:in
'When I try using chef-client 12.5.1 from the official package, it works correctly.
Any idea anyone ?
Scenario:
chef_ingredient 'reporting' do
notifies :reconfigure, 'chef_ingredient[reporting]'
end
Actual:
Expected:
Given Supermarket e rather used as a repository for Chef Cookbooks, it will be good we have some implementation examples for it. I browsed on the tests and specs directories, and I didn't find nothing about it.
We should allow the user to specify :latest
or 'latest'
as the version. We should also remove the 'package_name'
property from the chef_ingredient
resource.
1.0.0
12.18
Ubuntu 16.04
The following warning is thrown for Chef 13 that needs to be resolves prior to the release:
Compiling Cookbooks...
[2017-02-19T03:27:41+00:00] ERROR: An attempt was made to change version from :latest to nil by calling version(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. (CHEF-5)/tmp/kitchen/cache/cookbooks/test/recipes/repo.rb:3:in `block in from_file'.
Please see https://docs.chef.io/deprecations_custom_resource_cleanups.html for further details and information on how to correct this problem. at /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/formatters/doc.rb:419:in `deprecation'
================================================================================
Recipe Compile Error in /tmp/kitchen/cache/cookbooks/test/recipes/repo.rb
================================================================================
Chef::Exceptions::DeprecatedFeatureError
----------------------------------------
"An attempt was made to change version from :latest to nil by calling version(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. (CHEF-5)/tmp/kitchen/cache/cookbooks/test/recipes/repo.rb:3:in `block in from_file'.\nPlease see https://docs.chef.io/deprecations_custom_resource_cleanups.html for further details and information on how to correct this problem. at /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/formatters/doc.rb:419:in `deprecation'"
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/test/recipes/repo.rb:3:in `block in from_file'
/tmp/kitchen/cache/cookbooks/test/recipes/repo.rb:2:in `from_file'
Relevant File Content:
----------------------
/tmp/kitchen/cache/cookbooks/test/recipes/repo.rb:
1: # Chef Server Core
2: chef_ingredient 'chef-server' do
3>> version node['test']['chef-server-core']['version']
4: config <<-EOS
5: api_fqdn "#{node['fqdn']}"
6: ip_version "ipv6"
7: notification_email "#{node['chef_admin']}"
8: nginx["ssl_protocols"] = "TLSv1 TLSv1.1 TLSv1.2"
9: EOS
10: action :install
11: end
12:
Platform:
---------
x86_64-linux
Running handlers:
[2017-02-19T03:27:41+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-02-19T03:27:41+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 02 seconds
[2017-02-19T03:27:41+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2017-02-19T03:27:41+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-02-19T03:27:41+00:00] ERROR: "An attempt was made to change version from :latest to nil by calling version(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. (CHEF-5)/tmp/kitchen/cache/cookbooks/test/recipes/repo.rb:3:in `block in from_file'.\nPlease see https://docs.chef.io/deprecations_custom_resource_cleanups.html for further details and information on how to correct this problem. at /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/formatters/doc.rb:419:in `deprecation'"
[2017-02-19T03:27:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Converge failed on instance <default-ubuntu-1604>. Please see .kitchen/logs/default-ubuntu-1604.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
It causes issues when people upgrade and old gems are left in /opt/chef.
Doing this in the packaging violates the principle that the package should manage files outside of its packaged files.
So, the upgrade tool (chef_ingredient) must be responsible for this.
Because of the issues it can cause this should be enabled by default (but should be disable-able, in some cases its almost a feature since in most cases it makes upgrading faster since you don't have to reinstall all your chef_gems -- it just bites you on edge cases occasionally).
opscode-push-jobs-server versions 1.1.5 and 1.1.6 diverged from previous naming conventions, whereby the filename does not contain the platform designation, such as el6 for Redhat 6. This divergence breaks chef_ingredient's ability to fetch the package for installation on a target node.
Gist of the resulting error during a chef run is here: https://gist.github.com/haidangwa/ce81d027cc6d81b3ec23812f8c5cc08a
The recipe uses the chef_ingredient resource, like so:
chef_ingredient 'push-jobs-server' do
version node['twdc_chef']['push-jobs-server']['package_version']
notifies :reconfigure, "chef_ingredient[#{node.run_state['ha_ingredient']}]", :delayed
notifies :reconfigure, 'chef_ingredient[push-jobs-server]', :delayed
end
In the recipe, node['twdc_chef']['push-jobs-server']['package_version']
evaluates to 1.1.6.
12.11.18
RHEL 6 x86_64
0.18.5
2.0.0
12.19.36
CentOS 7.2
I'm trying to configure chef server ha cluster based on last https://docs.chef.io/install_server_ha.html.
The leader node I'm configuring with chef_ingredient 'chef-backend'
and it starts as I need.
The question is how can I join the second node to the leader? Of course, I can do it with execute
like
execute 'chef-backend-ctl join-cluster IP --accept-license --yes --verbose'
but may exist some other more native way, based on chef-ingredient? Please advice.
Bring the code over from the chef-server cookbook.
Hi ,
I am getting error
undefined method `property' for Chef::Resource::ChefIngredientIngredientConfig:Class
The full stack trace is here
==> chef-server: ================================================================================
==> chef-server: Recipe Compile Error in /var/chef/cache/cookbooks/chef-ingredient/resources/ingredient_config.rb
==> chef-server: ================================================================================
==> chef-server: NoMethodError
==> chef-server: -------------
==> chef-server: undefined method `property' for Chef::Resource::ChefIngredientIngredientConfig:Class
==> chef-server: Cookbook Trace:
==> chef-server: ---------------
==> chef-server: /var/chef/cache/cookbooks/chef-ingredient/resources/ingredient_config.rb:26:in `class_from_file'
==> chef-server: Relevant File Content:
==> chef-server: ----------------------
==> chef-server: /var/chef/cache/cookbooks/chef-ingredient/resources/ingredient_config.rb:
==> chef-server: 19: include ChefIngredientCookbook::Helpers
==> chef-server: 20:
==> chef-server: 21: resource_name :ingredient_config
==> chef-server: 22:
==> chef-server: 23: actions :render, :add
==> chef-server: 24: default_action :render
==> chef-server: 25:
==> chef-server: 26>> property :product_name, String, name_property: true
==> chef-server: 27: property :sensitive, [TrueClass, FalseClass], default: false
==> chef-server: 28: property :config, String, default: nil
==> chef-server: 29:
==> chef-server: 30: action :render do
==> chef-server: 31: target_config = ingredient_config_file
==> chef-server: 32: return if target_config.nil?
==> chef-server: 33:
==> chef-server: 34: directory ::File.dirname(target_config) do
==> chef-server: 35: recursive true
==> chef-server: Running handlers:
Does any one know how to fix this ?
(edited to make stacktrace and error more readable)
Currently chef-ingredient will download packages regardless of whether or not they're up to date.
* chef_gem[mixlib-install] action install (up to date)
- Download chef-server package from https://packages.chef.io/stable/el/7/chef-server-core-12.5.0-1.el7.x86_64.rpm
* ruby_block[stop chef run] action nothing (skipped due to action :nothing)
* remote_file[/var/opt/chef-marketplace/embedded/cookbooks/cache/chef-server-core-12.5.0-1.el7.x86_64.rpm] action create
- create new file /var/opt/chef-marketplace/embedded/cookbooks/cache/chef-server-core-12.5.0-1.el7.x86_64.rpm
- update content in file /var/opt/chef-marketplace/embedded/cookbooks/cache/chef-server-core-12.5.0-1.el7.x86_64.rpm from none to 67c17c
(file sizes exceed 10000000 bytes, diff output suppressed)
- change mode from '' to '0644'
* yum_package[chef-server] action upgrade (up to date)
It would be nice to validate the current version and only download the package if it's going to update it.
When chef-client
is updated there is a non-optional ruby_block executed that raises a Chef::Application.fatal!
. This stops the convergence, but -- in newer Chef versions under systemd -- does not actually kill the service. The next scheduled Chef run proceeds with the old client version, resulting in problems.
In contrast the chef-client cookbook simply uses a service restart, which does work as expected.
Run stopped by ruby_block:
[2016-06-23T19:00:44+00:00] FATAL: Chef version has changed during the run. Stopping the current Chef run. Please run chef again.
Next run (here manually triggered with USR1 signal to avoid time delay):
[2016-06-23T19:01:17+00:00] INFO: SIGUSR1 received, waking up
[2016-06-23T19:01:17+00:00] INFO: Forking chef instance to converge...
[2016-06-23T19:01:17+00:00] INFO: *** Chef 12.8.1 ***
[2016-06-23T19:01:17+00:00] INFO: Chef-client pid: 25947
[2016-06-23T19:01:17+00:00] ERROR: Running exception handlers
[2016-06-23T19:01:17+00:00] ERROR: Exception handlers complete
[2016-06-23T19:01:17+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-06-23T19:01:17+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-06-23T19:01:17+00:00] ERROR: Unable to determine node name: configure node_name or configure the system's hostname and fqdn
[2016-06-23T19:01:17+00:00] ERROR: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
But a systemctl restart chef-client
loads the new version and succeeds:
[2016-06-23T19:12:18+00:00] FATAL: SIGTERM received, stopping
[2016-06-23T19:12:35+00:00] INFO: SIGUSR1 received, waking up
[2016-06-23T19:12:35+00:00] INFO: Forking chef instance to converge...
[2016-06-23T19:12:35+00:00] INFO: *** Chef 12.10.24 ***
[2016-06-23T19:12:35+00:00] INFO: Platform: x86_64-linux
[2016-06-23T19:12:35+00:00] INFO: Chef-client pid: 30513
We have a lot of the same test coverage in the centos and ubuntu specs. Those should be broken out to ./spec/unit/recipes/test_local_spec.rb
and ./spec/unit/recipes/test_repo_spec.rb
respectively. We'll want to ensure we're only testing:
.el6
version designation is appended on rhel family (centos)We may need to also update the server spec tests as appropriate.
As a user I would like to use chef_ingredient
and setup my supermarket server passing my configuration through the config
attribute so I don't have to use other methods like a template
or file
resources to lay down my configuration.
Proposal Solution
Modify the product_matrix
pointing to the right config-file
that is /etc/supermarket/supermarket.json
chef-ingredient (0.21.3)
chef-client 12.15.19 and 12.18.31
Oracle Linux Server release 6.8
Attempted with chef-server 12.8.0 and 12.12.0
chef-server-ctl reconfigure fails to execute
chef-enterprise cookbook depends on chef-ingredient
recipe server contains the chef-ingredient resource:
chef_ingredient 'chef-server' do
action :reconfigure
end
Attempted with both chef-solo and chef-client -z.
Expecting 'chef-server-ctl reconfigure' to execute without error
[2017-02-17T15:49:02+00:00] ERROR: chef_ingredient[chef-server] (chef-enterprise::server line 54) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[chef-server-core-reconfigure] (/root/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb line 105) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of chef-server-ctl reconfigure ----
STDOUT: [2017-02-17T15:49:02+00:00] FATAL: Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
STDERR:
---- End output of chef-server-ctl reconfigure ----
chef-stacktrace.out
https://gist.github.com/pcbear/1c6f89e17e81f7c401edf27cc3460a22
chef-client run
https://gist.github.com/pcbear/46d3d3111c004217cbee1b74e71c6fa3
The current setup of the cookbook is throwing deprecation warnings for cookbooks that use the resources. This is a simple fix and should get corrected.
Default value nil is invalid for property config of resource ingredient_config. Possible fixes: 1. Remove 'default: nil' if nil means 'undefined'. 2. Set a valid default value if there is a reasonable one. 3. Allow nil as a valid value of your property (for example, 'property :config, [ String, nil ], default: nil'). Error: Property config must be one of: String! You passed nil. at 1 location:
- /tmp/kitchen/cache/cookbooks/chef-ingredient/resources/ingredient_config.rb:28:in `class_from_file'
An attempt was made to change version from :latest to nil by calling version(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. at 1 location:
Found this issue while trying to install a private supermarket with supermarket-omnibus-cookbook.
In chef-ingredient/libraries/helpers.rb is the code
69 def ensure_mixlib_versioning_gem_installed!
70 node.run_state[:mixlib_versioning_gem_installed] ||= begin # ~FC001
71 install_gem_from_rubygems('mixlib-versioning', '1.1.0')
72
73 require 'mixlib/versioning'
74 true
75 end
I've noticed in my own recipes that if the version you specify with a gem is the latest version it will fail to find it on rubygems.org.
Only reason I haven't done a pull request myself is because I'm unsure of how to lock to version 1.1.0 when it's the latest version of the gem.
See http://jtimberman.housepub.org/blog/2015/03/20/chef-gem-compile-time-compatibility/
================================================================================
Error executing action `install` on resource 'chef_ingredient[chef-server]'
================================================================================
NoMethodError
-------------
undefined method `compile_time' for Chef::Resource::ChefGem
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/helpers.rb:61:in `block in install_mixlib_versioning'
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/helpers.rb:59:in `install_mixlib_versioning'
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:37:in `block in <class:ChefIngredient>'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/cms_chef_server/recipes/install.rb
76: chef_ingredient 'chef-server' do
77: package_source chef_server_pkg
78: action :install
79: end
80: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/cms_chef_server/recipes/install.rb:76:in `from_file'
chef_ingredient("chef-server") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chef_ingredient
cookbook_name "cms_chef_server"
recipe_name "install"
package_source "/sup/Chef/server/chef-server-core-12.1.2-1.el6.x86_64.rpm"
product_name "chef-server"
end
Running handlers:
[2015-08-06T14:32:32+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-08-06T14:32:32+00:00] ERROR: Exception handlers complete
[2015-08-06T14:32:32+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 18 resources updated in 800.068389056 seconds
[2015-08-06T14:32:32+00:00] ERROR: chef_ingredient[chef-server] (cms_chef_server::install line 76) had an error: NoMethodError: undefined method `compile_time' for Chef::Resource::ChefGem
[2015-08-06T14:32:33+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
==> /var/log/opscode/oc_id/current <==
2016-03-04_23:18:58.68460 I, [2016-03-04T15:18:58.684495 #19133] INFO -- : Started GET "/id/assets/icons/all.svg" for 17.131.239.16 at 2016-03-04 15:18:58 -0800
2016-03-04_23:18:58.68668 F, [2016-03-04T15:18:58.686625 #19133] FATAL -- :
2016-03-04_23:18:58.68670 ActionController::RoutingError (No route matches [GET] "/id/assets/icons/all.svg"):
2016-03-04_23:18:58.68671 actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2016-03-04_23:18:58.68671 actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2016-03-04_23:18:58.68671 railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app'
2016-03-04_23:18:58.68672 railties (4.2.5.1) lib/rails/rack/logger.rb:22:in `call'
2016-03-04_23:18:58.68672 actionpack (4.2.5.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
2016-03-04_23:18:58.68672 rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
2016-03-04_23:18:58.68672 rack (1.6.4) lib/rack/runtime.rb:18:in `call'
2016-03-04_23:18:58.68673 activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2016-03-04_23:18:58.68675 actionpack (4.2.5.1) lib/action_dispatch/middleware/static.rb:116:in `call'
2016-03-04_23:18:58.68676 rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
2016-03-04_23:18:58.68677 sentry-raven (0.12.3) lib/raven/integrations/rack.rb:61:in `call'
2016-03-04_23:18:58.68677 railties (4.2.5.1) lib/rails/engine.rb:518:in `call'
2016-03-04_23:18:58.68678 railties (4.2.5.1) lib/rails/application.rb:165:in `call'
2016-03-04_23:18:58.68679 rack (1.6.4) lib/rack/content_length.rb:15:in `call'
2016-03-04_23:18:58.68680 unicorn (4.8.3) lib/unicorn/http_server.rb:576:in `process_client'
2016-03-04_23:18:58.68680 unicorn (4.8.3) lib/unicorn/http_server.rb:670:in `worker_loop'
2016-03-04_23:18:58.68681 unicorn (4.8.3) lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
2016-03-04_23:18:58.68681 unicorn (4.8.3) lib/unicorn/http_server.rb:140:in `start'
2016-03-04_23:18:58.68681 unicorn-rails (1.1.0) lib/unicorn/rails.rb:24:in `run'
2016-03-04_23:18:58.68681 rack (1.6.4) lib/rack/server.rb:286:in `start'
2016-03-04_23:18:58.68682 railties (4.2.5.1) lib/rails/commands/server.rb:80:in `start'
2016-03-04_23:18:58.68682 railties (4.2.5.1) lib/rails/commands/commands_tasks.rb:80:in `block in server'
2016-03-04_23:18:58.68682 railties (4.2.5.1) lib/rails/commands/commands_tasks.rb:75:in `tap'
2016-03-04_23:18:58.68682 railties (4.2.5.1) lib/rails/commands/commands_tasks.rb:75:in `server'
2016-03-04_23:18:58.68683 railties (4.2.5.1) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2016-03-04_23:18:58.68683 railties (4.2.5.1) lib/rails/commands.rb:17:in `<top (required)>'
2016-03-04_23:18:58.68683 bin/rails:8:in `require'
2016-03-04_23:18:58.68684 bin/rails:8:in `<main>'
2016-03-04_23:18:58.68684
2016-03-04_23:18:58.68684
This was originally reported by @stephenlauck:
In chef-ingredient are we saving cached packages and can we limit the number of packages stored in
/var/chef/cache
? The Delivery server in Acceptance drive filled up and we don’t need to store all those deb backups.
As a user I expect to be able to have multiple chef_ingredient
resources in the same recipe without failing because the chef-stable
repo is disabled, otherwise I need to re-run multiple times or modify the repo manually to enable it.
Problem Description
With PR chef/chef-server#500 when you run reconfigure
it automatically disable the chef-stable
repo. Then the next time we try to install a ingredient it fails.
Proposal Solution
Pass options --enable-repo chef-stable
to chef_ingredient
resource by default.
Uploading chef-server [4.0.0]
Uploading chef-ingredient [0.8.1]
FATAL: Cookbook file libraries/omnibus_service_resource.rb has a ruby syntax error:
FATAL: /etc/chef/itu/chef-ingredient/libraries/omnibus_service_resource.rb:22: unknown type of %string
FATAL: actions %i(start stop restart hup int kill graceful_kill once)
FATAL: ^
FATAL: /etc/chef/itu/chef-ingredient/libraries/omnibus_service_resource.rb:22: syntax error, unexpected $end, expecting keyword_end
FATAL: actions %i(start stop restart hup int kill graceful_kill once)
FATAL: ^
chef-ingredient supports some of the non-standard product names which were finalized in chef/mixlib-install#77. We need to add deprecation messages for them and remove them in the next major bump of chef-ingredient.
This needs to support mixlib-install and omnitruck for non-ubuntu/non-centos installs of the client. The way this should be implemented should not require any knowledge on the part of the user to override the provider based on the platform they are on. In other words, requiring the user to pass a provider argument with a ruby class would be failure.
The difficulty here is that this is written as a single resource where the type of thing to be managed is in the name argument of the resource. If this was implemented as chef_client_ingredient we could use the provider resolver to trivially switch that label between chef_client_ingredient_packagecloud and chef_client_ingredient_omnitruck resources+providers.
What we probably needs to happen is that the chef_ingredient provider needs to select a handler for either packagecloud or omnitruck based on the name it is passed and the platform_family of the box it is running on. Then it needs to delegate its actions to that handler class (the handler class should likely not inherit from Chef::Provider, it should use composition correctly).
There's other ways to do this, using a base class and inheritance, but the service provider in core chef shows how bad of a road that is to follow.
Technically the provider resolver also passes the resource in through the #supports?
method call so you could switch on the name of the resource there and only pick the client installs in the omnitruck install provider, but that is going to be way messy into the internals of the provider resolver. I wouldn't recommend it.
Sketch of how the provider code should look:
class Chef::Provider::ChefIngredient < Chef::Provider
extend Forwardable
def_delegators @handler, :action_install, :action_upgrade, :action_uninstall, :action_remove
def initialize(new_resource, run_context)
if new_resource.name == "client" && !%w{debian, rhel}.includes?(node[:platform_family])
@handler = ChefIngredient::Handler::MixlibInstall.new(new_resource)
else
@handler = ChefIngredient::Handler::PackageCloud.new(new_resource)
end
end
end
Something like that.
Consistently getting this error:
W: GPG error: https://packagecloud.io trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 37BBEE3F7AD95B3F
When trying to install chef-server using chef-ingredient.
For the client 'latest' doing major version upgrades is literally fucking awful. People will see that and assume its a good idea and then will get hosed when Chef 13 comes out.
We need to steer people towards where 'latest' does only minor version upgrades and we have some kind of 'latest_with_major_upgrade' for times when you want to upgrade to the latest major version, or when you just really want to live yolo.
For upgrades of the client this should probably be done via just pulling the Chef::VERSION.to_i out of the running process, although I could see the case for having a different chef-solo/chef-zero that managed an omnibus chef-client install where you might want to poke /opt/chef/embedded/bin/chef-client --version
. For server and other packages, I guess you have to poke the ctl command or something?
Along with that omnitruck supports basically the '>' operator via partial versions like "12" meaning "> 12.0" and "12.4" meaning "~> 12.4.0". We should figure out how to support that with the packages from packagecloud. Its possible that the core chef package providers for yum and deb already do this (I seem to recall some issues about this but I wouldn't be too surprised if they were provider-specific and weren't remotely consistently implemented -- we should fix core chef if we have to in order to make this work right).
We should also make this work the same for both packagecloud and for mixlib-install.
This is so we can write:
chef_run.chef_ingredient('chef-server')
In a spec.
Starting with 1.3.3 the push jobs client package was renamed from:
opscode-push-jobs-client -> push-jobs-client
https://downloads.chef.io/push-jobs-client/redhat/
cookbook still calls it by it's original name.
https://github.com/chef-cookbooks/chef-ingredient/blob/master/libraries/helpers.rb#L117
When behind a proxy, using chef_ingredient "chef-server"
for a platform that ends up using the omnitruck handler (not the default mixlib-install one) will fail.
@stephenlauck ran into this in the wild, feel free to add any information!
chef-client 12.8.1
Windows 2012 R2
When using the push-jobs cookbook on an IIS windows server, you get the following deprecation warning.
- c:/chef/cache/cookbooks/iis/resources/pool.rb:78:in `class_from_file'
Default value nil is invalid for property config of resource ingredient_config. Possible fixes: 1. Remove 'default: ni
l' if nil means 'undefined'. 2. Set a valid default value if there is a reasonable one. 3. Allow nil as a valid value of
your property (for example, 'property :config, [ String, nil ], default: nil'). Error: Property config must be one of:
String! You passed nil. at 1 location:
- c:/chef/cache/cookbooks/chef-ingredient/resources/ingredient_config.rb:28:in `class_from_file'�
Configuration may include sensitive details, such as AWS credentials. It would be great to be able to pass the "sensitive" flag into ingredient_config and have file output suppressed, or make this the default.
all the chef-ingredient examples make use of the self-notifying resource so that ingredient_config's can be stacked and only a single reconfigure fired at the end of them; however, when that happens the chef-server.rb that is generated has no newlines, and is not valid. The only workaround I could figure out was to append a semi-colon to the end of each, so that each configuration line is evaluated separately
chef_ingredient 'chef-server' do
package_source node['jakes-chef-server']['packages']['chef_server']
notifies :reconfigure, 'chef_ingredient[chef-server]'
end
conf = Array.new
node['jakes-chef-server']['config'].each { |k,v| conf << "#{k} '#{v}'" }
auth = "https://#{node['jakes-chef-server']['addons']['supermarket']['url']}" \
'/auth/chef_oauth2/callback'
ingredient_config 'chef-server' do
config conf.join("\n")
action [:add, :render]
notifies :reconfigure, 'chef_ingredient[chef-server]'
end
ingredient_config 'chef-server' do
config <<-EOH.gsub(/\s+/, ' ').strip!
oc_id['applications'] = {
supermarket: {
redirect_uri: '#{auth}'
}
}
EOH
only_if { node['jakes-chef-server']['addons']['supermarket']['enable'] }
action [:add, :render]
notifies :reconfigure, 'chef_ingredient[chef-server]', :immediately
notifies :run, 'ruby_block[get_supermarket_creds]'
end
api_fqdn 'chef.vagrantup.com'oc_id['applications'] = { supermarket: { redirect_uri: 'https://supermarket.vagrantup.com/auth/chef_oauth2/callback' } }[vagrant@chef opscode]$ cat chef-server.rb
In libraries/helpers.rb there are two methods (ensure_mixlib_install_gem_installed!
and install_gem_from_rubygems
) that assume a user would want to grab the mixlib-install
gem from Rubygems.org.
We need to provide an alternative method for Enterprise customers who's firewall access is highly restrictive or who attempt to use our services in Internet-isolated environments.
Some ideas:
install_gem_from_rubygems
(this forces customers to run a Rubygems mirror-like thing)chef-ingredient
to grab a tarball of the mixlib-install
source from somewhere, build and install locallyUsing master(0.18.2) chef-ingredient, chef_ingredient("compliance")
can't find the package to download. See kitchen output below:
$ kitchen converge ubuntu14
-----> Starting Kitchen (v1.6.0)
-----> Converging <sweet-ubuntu1404>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 4.3.2...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (12.7.2)
Transferring files to <sweet-ubuntu1404>
Starting Chef Client, version 12.7.2
resolving cookbooks for run list: ["kitchen-omnibus-cc::default", "kitchen-omnibus-cc::setup_ciscat", "kitchen-omnibus-cc::run_ciscat_inspec"]
Synchronizing Cookbooks:
- git (4.4.1)
- build-essential (3.2.0)
- kitchen-omnibus-cc (0.4.0)
- yum-epel (0.6.6)
- yum (3.10.0)
- chef_handler (1.3.0)
- windows (1.39.2)
- chef-ingredient (0.18.2)
- apt (3.0.0)
- dmg (2.3.0)
- seven_zip (2.0.0)
Compiling Cookbooks...
Recipe: apt::default
* bash[apt-get-update at compile time] action run
- execute "bash" "/tmp/chef-script20160418-1911-1q9529x"
[2016-04-18T17:57:33+00:00] WARN: *** action=install, package_version=1.1.1, channel=unstable
Converging 28 resources
* file[/var/lib/apt/periodic/update-success-stamp] action nothing (skipped due to action :nothing)
* bash[apt-get-update at compile time] action nothing (skipped due to action :nothing)
* directory[/etc/apt/apt.conf.d] action create (up to date)
* cookbook_file[/etc/apt/apt.conf.d/15update-stamp] action create
- create new file /etc/apt/apt.conf.d/15update-stamp
- update content in file /etc/apt/apt.conf.d/15update-stamp from none to 174cdb
--- /etc/apt/apt.conf.d/15update-stamp 2016-04-18 17:57:33.224796293 +0000
+++ /etc/apt/apt.conf.d/.15update-stamp20160418-1911-5vciaq 2016-04-18 17:57:33.224796293 +0000
@@ -1 +1,2 @@
+APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};
* execute[apt-get update] action nothing (skipped due to action :nothing)
* execute[apt-get autoremove] action nothing (skipped due to action :nothing)
* execute[apt-get autoclean] action nothing (skipped due to action :nothing)
* execute[apt-get-update-periodic] action run
- execute apt-get update
* file[/var/lib/apt/periodic/update-success-stamp] action touch
- update utime on file /var/lib/apt/periodic/update-success-stamp
* directory[/var/cache/local] action create
- create new directory /var/cache/local
- change mode from '' to '0755'
- change owner from '' to 'root'
- change group from '' to 'root'
* directory[/var/cache/local/preseeding] action create
- create new directory /var/cache/local/preseeding
- change mode from '' to '0755'
- change owner from '' to 'root'
- change group from '' to 'root'
* template[/etc/apt/apt.conf.d/10recommends] action create
- create new file /etc/apt/apt.conf.d/10recommends
- update content in file /etc/apt/apt.conf.d/10recommends from none to f41e1d
--- /etc/apt/apt.conf.d/10recommends 2016-04-18 17:57:40.472418509 +0000
+++ /etc/apt/apt.conf.d/.10recommends20160418-1911-cd1132 2016-04-18 17:57:40.472418509 +0000
@@ -1 +1,4 @@
+# Managed by Chef
+APT::Install-Recommends "1";
+APT::Install-Suggests "0";
- change mode from '' to '0644'
- change owner from '' to 'root'
- change group from '' to 'root'
* apt_package[apt-transport-https] action install (up to date)
Recipe: git::package
* git_client[default] action install
* apt_package[default :create git] action install
- install version 1:1.9.1-1ubuntu0.3 of package git
Recipe: kitchen-omnibus-cc::setup_compliance
* chef_ingredient[compliance] action install
Recipe: <Dynamically Defined Resource>
* chef_gem[mixlib-install] action install
- install version ~> 1.0 of package mixlib-install
================================================================================
Error executing action `install` on resource 'chef_ingredient[compliance]'
================================================================================
RuntimeError
------------
No package found for 'compliance' with version '1.1.1' for current platform in 'unstable' channel.
Check that the package exists.
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/default_handler.rb:95:in `configure_from_channel'
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/default_handler.rb:46:in `configure_package'
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/default_handler.rb:23:in `handle_install'
/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:54:in `block in <class:ChefIngredient>'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/kitchen-omnibus-cc/recipes/setup_compliance.rb
35: chef_ingredient 'compliance' do
36: channel json['channel'].to_sym
37: version json['package_version']
38: ctl_command '/opt/chef-compliance/bin/chef-compliance-ctl'
39: notifies :run, "execute[adduser]"
40: config <<-EOH
41: verify_tls false
42: core.licensed_node_count 77
43: EOH
44: action actions_array
45: end
46:
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/kitchen-omnibus-cc/recipes/setup_compliance.rb:35:in `from_file'
chef_ingredient("compliance") do
action [:install, :reconfigure]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chef_ingredient
cookbook_name "kitchen-omnibus-cc"
recipe_name "setup_compliance"
channel :unstable
version "1.1.1"
ctl_command "/opt/chef-compliance/bin/chef-compliance-ctl"
config "verify_tls false\ncore.licensed_node_count 77\n"
product_name "compliance"
end
Running handlers:
[2016-04-18T17:57:58+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-04-18T17:57:58+00:00] ERROR: Exception handlers complete
Chef Client failed. 10 resources updated in 34 seconds
[2016-04-18T17:57:58+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2016-04-18T17:57:58+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-04-18T17:57:58+00:00] ERROR: chef_ingredient[compliance] (kitchen-omnibus-cc::setup_compliance line 35) had an error: RuntimeError: No package found for 'compliance' with version '1.1.1' for current platform in 'unstable' channel.
Check that the package exists.
[2016-04-18T17:58:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I'm trying to take a stab at contributing a failing test case for delivery-cli
on CentOS 6.6 due to an unsigned package, but I can't run any of the current or new kitchen suites to execute due to the following error:
Compiling Cookbooks...
================================================================================
Recipe Compile Error
================================================================================
Chef::Exceptions::RecipeNotFound
--------------------------------
could not find recipe default for cookbook chef-ingredient
I noted that you cannot have an empty run_list
in a Policyfile. What's the best approach to correct this and move forward?
These warnings are annoying, and we get them with all the resources. Just run rspec spec
on the repository and see the glory of the WARN spam.
[2015-06-30T19:50:33+00:00] WARN: Class Chef::Provider::ChefIngredient does not declare 'resource_name :chef_ingredient'.
[2015-06-30T19:50:33+00:00] WARN: This will no longer work in Chef 13: you must use 'resource_name' to provide DSL.
This only affects Chef 12.4.0. We should determine if there's something we need to do in the library code in the cookbook to handle this in a cross-version way. It is preferable to not use chef version comparison though.
2.0.1
12.19.36 attempting to downgrade to 12.13.37
CentOS 7.2, Vagrant Bento Box
Attempting to test chef_ingredient install for Chef-HA, and downgrading the Agent on Vagrant test machine to match current production.
Include the desired version of Chef-Client in the version
attribute for chef_ingredient. Run chef exec kitchen test
successful converge
https://gist.github.com/predatorian3/acb12c35ccb6b79f762830a60082dc53
2.0.0
12.12.13
Ubuntu 12.04 in EC2
Attempt to converge a recipe that uses a chef_ingredient
resource
A recipe like:
chef_ingredient "automate"
The ingredient is installed
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/chef-ingredient/resources/chef_ingredient.rb
================================================================================
NameError
---------
uninitialized constant Chef::Resource::ChefIngredient::DefaultHandler
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/chef-ingredient/resources/chef_ingredient.rb:59:in `block in class_from_file'
/var/chef/cache/cookbooks/chef-ingredient/resources/chef_ingredient.rb:54:in `class_from_file'
/var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb:50:in `build_from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/chef-ingredient/resources/chef_ingredient.rb:
52: platform_family = node['platform_family']
53:
54: action_class do
55: include ChefIngredientCookbook::Helpers
56:
57: case platform_family
58: when 'debian', 'rhel', 'suse', 'windows'
59>> include ChefIngredient::DefaultHandler
60: else
61: # OmnitruckHandler is used for Solaris, AIX, FreeBSD, etc.
62: # Eventually, we would like to support all platforms with the DefaultHandler
63: include ChefIngredient::OmnitruckHandler
64: end
65: end
66:
67: action :install do
68: check_deprecated_properties
Platform:
---------
x86_64-linux
[2017-03-24T19:37:56+00:00] ERROR: Running exception handlers
[2017-03-24T19:37:56+00:00] ERROR: Exception handlers complete
[2017-03-24T19:37:56+00:00] INFO: Sending resource update report (run-id: 55c3c257-f209-4498-a000-c2bf8f614fdf)
[2017-03-24T19:37:56+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2017-03-24T19:37:56+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-03-24T19:37:56+00:00] ERROR: uninitialized constant Chef::Resource::ChefIngredient::DefaultHandler
[2017-03-24T19:37:57+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
the following code block ends up hanging in air-gapped environment w/o access to internet.
def install_gem_from_rubygems(gem_name, gem_version)
Chef::Log.debug("Installing #{gem_name} v#{gem_version} from Rubygems.org")
chefgem = Chef::Resource::ChefGem.new(gem_name, run_context)
chefgem.version(gem_version)
chefgem.run_action(:install)
end
I am working to run chef-server-cluster using updated code to point to chef-ingredient instead of chef-server-ingredient. However, it looks like package cloud does not have a package named opscode-reporting
. That or I am doing something wrong here.
* yum_repository[chef-stable] action create
* template[/etc/yum.repos.d/chef-stable.repo] action create
- create new file /etc/yum.repos.d/chef-stable.repo
- update content in file /etc/yum.repos.d/chef-stable.repo from none to 4d6a78
--- /etc/yum.repos.d/chef-stable.repo 2015-06-25 20:37:25.574881600 +0000
+++ /tmp/chef-rendered-template20150625-1282-1wqf0uy 2015-06-25 20:37:25.573881579 +0000
@@ -1 +1,12 @@
+# This file was generated by Chef
+# Do NOT modify this file by hand.
+
+[chef-stable]
+name=Chef chef-stable repository
+baseurl=https://packagecloud.io/chef/stable/el/7/$basearch
+enabled=1
+gpgcheck=1
+gpgkey=https://downloads.chef.io/packages-chef-io-public.key
+sslcacert=/etc/pki/tls/certs/ca-bundle.crt
+sslverify=true
- change mode from '' to '0644'
- restore selinux security context
* yum_package[reporting] action install
* No candidate version available for opscode-reporting
================================================================================
Error executing action `install` on resource 'yum_package[reporting]'
================================================================================
Chef::Exceptions::Package
-------------------------
No candidate version available for opscode-reporting
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/chef-ingredient/libraries/helpers.rb
46: declare_resource presource, new_resource.product_name do
47: package_name ingredient_package_name
48: options new_resource.options
49: version install_version if Mixlib::Versioning.parse(version_string(new_resource.version)) > '0.0.0'
50: source new_resource.package_source
51: timeout new_resource.timeout
52: action ingredient_action
53: end
54: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/chef-ingredient/libraries/helpers.rb:46:in `package_resource'
yum_package("reporting") do
action :install
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "opscode-reporting"
flush_cache {:before=>false, :after=>false}
declared_type :package
cookbook_name "chef-server-cluster"
end
As a user I would like to avoid running ctl-reconfigure
command every time I converge my recipe, I would expect it to run whenever I really need it so I can avoid confusions and don't waste time re-running it always.
Problem Description
Currently the ingredient_config
provider has a directory
resource that always sets the owner and mode. (https://github.com/chef-cookbooks/chef-ingredient/blob/master/libraries/ingredient_config_provider.rb#L35-L37) But when se run the ctl-reconfigure
command it sets that up to opscode
and 0775
and that causes the provider to trigger/notifies other resources.
Proposal Solution
Put an not_if
guard that will ensure the directory
resource will not run if it exist.
* chef_ingredient[chef-server] action reconfigure
(up to date)
* chef_gem[chef-server-mixlib-versioning] action install (up to date)
* execute[chef-server-core-reconfigure] action run
================================================================================
Error executing action `run` on resource 'execute[chef-server-core-reconfigure]'
================================================================================
Errno::ENOENT
-------------
No such file or directory - chef-server-ctl
Resource Declaration:
# In /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb
69: execute "#{ingredient_package_name}-reconfigure" do
70: command "#{ctl_command} reconfigure"
71: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb:69:in `block in <class:ChefIngredient>'
execute("chef-server-core-reconfigure") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :execute
command "chef-server-ctl reconfigure"
backup 5
returns 0
declared_type :execute
cookbook_name "chef-server-cluster"
end
Error executing action `reconfigure` on resource 'chef_ingredient[chef-server]'
================================================================================
Errno::ENOENT
-------------
execute[chef-server-core-reconfigure] (/tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/chef_ingredient_provider.rb line 69) had an error: Errno::ENOENT: No such file or directory - chef-server-ctl
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/chef-server-cluster/recipes/server.rb
17: chef_ingredient 'chef-server' do
18: package_source 'https://repos.derp/chef_stable/chef-12.4.1-1.el6.x86_64.rpm'
19: notifies :reconfigure, 'chef_ingredient[chef-server]'
20: end
21:
Compiled Resource:
------------------
chef_ingredient("chef-server") do
action [:install]
updated true
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chef_ingredient
cookbook_name "chef-server-cluster"
recipe_name "server"
package_source "https://repo.derp/chef_stable/chef-12.4.1-1.el6.x86_64.rpm"
product_name "chef-server"
version :latest
end
Starting audit phase
Finished in 0.00029 seconds (files took 0.18702 seconds to load)
0 examples, 0 failures
Auditing complete
No support here for fedora from a repo perspective. I know you aren't pushing packages to packagecloud for fedora, but I think you cold use el7 for fedora20-22 just fine.
Edit: I noticed in delivery-cluster repo that it's vendoring the old chef-server-ingredient. Same problem exists trying to provision on on fedora regardless I think.
Chef-ingredient assumes that the host it is running on is connected to the internet and configures/depends on the yum-chef/apt-chef.
https://github.com/chef-cookbooks/chef-ingredient/blob/master/libraries/rhel_handler.rb#L57
https://github.com/chef-cookbooks/chef-ingredient/blob/master/libraries/rhel_handler.rb#L64
Not all installs have direct access to the interwebs, even if they do, should this cookbook really assume that people want to pull directly from there? They could have the packages mirrored internally using satellite/katello/spacewalk/artifactory, etc. and do so for good reason audit/compliance/blah/blah
While it is nice having the cookbook that works soup-to-nuts, perhaps provide the capability to say "i'll provide my own toys" and install the package w/out all the assumptions.
Chef end-users don't care about our history of naming things poorly. We should rename the chef_ingredient
resource's package_name
attribute to product
and perform mappings for them.
Here is a canonical list of products and associated keys/packages.
Product | Product Key | Package Name |
---|---|---|
Chef Client | chef | chef |
Chef Development Kit | chefdk | chefdk |
Enterprise Chef (legacy) | private-chef | private-chef |
Chef Server | chef-server | chef-server (versions < 12.0.0) chef-server-core (versions >= 12.0.0) |
Chef Server High Availability addon | chef-ha | chef-ha |
Chef Server Replication addon | chef-sync | chef-sync |
Chef Server Reporting addon | reporting | opscode-reporting |
Management Console | manage | opscode-manage (versions < 2.0.0) chef-manage (versions >= 2.0.0) |
Push Jobs Server | push-jobs-server | opscode-push-jobs-server |
Push Jobs Client | push-jobs-client | opscode-push-jobs-client (versions < 2.0.0) push-jobs-client (versions >= 2.0.0) |
Analytics Platform | analytics | opscode-analytics |
Delivery | delivery | delivery |
Delivery CLI | delivery-cli | delivery-cli |
Supermarket | supermarket | supermarket |
Additionally the chef_ingredient
resource should validate the product
attribute and raise a friendly error if an invalid product key is provided.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.