I'm trying to configure a Chef server configuration to run as a client of hosted chef. I've uploaded my data bags and configured the recipe. All goes well until I hit this block:
execute 'add org validator key' do
command "chef-server-ctl add-client-key #{client} #{client}-validator #{key_file} --key-name populator"
only_if pub_key
not_if "chef-server-ctl list-client-keys #{client} #{client}-validator | grep '^key_name: populator$'"
end
The problem appears to be that chef tries to execute a command with the same name as the value of the pub_key attribute, so I'm thinking this check needs changing. This is the error (with the public key changed to for brevity:
[2015-04-22T23:42:36+00:00] INFO: Processing execute[Guard resource] action run (dynamically defined)
================================================================================
Error executing action `run` on resource 'execute[add org validator key]'
================================================================================
Errno::ENOENT
-------------
execute[Guard resource] (dynamically defined) had an error: Errno::ENOENT: No such file or directory - <pub_key string>
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/chef-server-populator/recipes/client.rb
79: execute 'add org validator key' do
80: command "chef-server-ctl add-client-key #{client} #{client}-validator #{key_file} --key-name populator"
81: only_if pub_key
82: not_if "chef-server-ctl list-client-keys #{client} #{client}-validator | grep '^key_name: populator$'"
83: end
84: execute 'remove org default validator key' do
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/chef-server-populator/recipes/client.rb:79:in `block in from_file'
execute("add org validator key") do
action "run"
retries 0
retry_delay 2
default_guard_interpreter :execute
command "chef-server-ctl add-client-key indochino indochino-validator /var/chef/cache/indochino.pub --key-name populator"
backup 5
returns 0
declared_type :execute
cookbook_name "chef-server-populator"
recipe_name "client"
not_if "chef-server-ctl list-client-keys indochino indochino-validator | grep '^key_name: populator$'"
only_if "<pub_key string>"
end
[2015-04-22T23:42:36+00:00] INFO: Running queued delayed notifications before re-raising exception
[2015-04-22T23:42:36+00:00] INFO: execute[nxensite default] sending reload action to servicenginx
Recipe: nginx::default
Hi,
I'm trying to configure a Chef server configuration to run as a client of hosted chef. I've uploaded my data bags and configured the recipe. All goes well until I hit this block: execute 'add org validator key' do command "chef-server-ctl add-client-key #{client} #{client}-validator #{key_file} --key-name populator" only_if pub_key not_if "chef-server-ctl list-client-keys #{client} #{client}-validator | grep '^key_name: populator$'" end The problem appears to be that chef tries to execute a command with the same name as the value of the pub_key attribute, so I'm thinking this check needs changing. This is the error (with the public key changed to for brevity:
[2015-04-22T23:42:36+00:00] INFO: Processing execute[Guard resource] action run (dynamically defined)
[2015-04-22T23:42:36+00:00] INFO: Running queued delayed notifications before re-raising exception [2015-04-22T23:42:36+00:00] INFO: execute[nxensite default] sending reload action to servicenginx Recipe: nginx::default
Running handlers: [2015-04-22T23:42:37+00:00] ERROR: Running exception handlers Running handlers complete [2015-04-22T23:42:37+00:00] ERROR: Exception handlers complete [2015-04-22T23:42:37+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out Chef Client failed. 8 resources updated in 92.805395909 seconds [2015-04-22T23:42:37+00:00] INFO: Sending resource update report (run-id: c3796f02-9907-43ad-930b-2fd50ce398d9) [2015-04-22T23:42:37+00:00] ERROR: execute[add org validator key](chef-server-populator::client line 79) had an error: Errno::ENOENT: execute[Guard resource](dynamically defined) had an error: Errno::ENOENT: No such file or directory -
Chef client version is 12.2.1