Skip to content

Instantly share code, notes, and snippets.

@nathenharvey
Created March 19, 2018 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathenharvey/60f028d5e85d01a459a4cc36e3c0e771 to your computer and use it in GitHub Desktop.
Save nathenharvey/60f028d5e85d01a459a4cc36e3c0e771 to your computer and use it in GitHub Desktop.
Sensitive property on execute resource
$ chef-client -z sensitive.rb -l debug
[2018-03-19T13:54:21-04:00] DEBUG: Sleeping for 0 seconds
[2018-03-19T13:54:21-04:00] INFO: Started chef-zero at chefzero://localhost:1 with repository at /Users/nathenharvey
One version per cookbook
[2018-03-19T13:54:21-04:00] DEBUG: Running Ohai with the following configuration: {}
[2018-03-19T13:54:21-04:00] INFO: Forking chef instance to converge...
[2018-03-19T13:54:21-04:00] DEBUG: Fork successful. Waiting for new chef pid: 15310
[2018-03-19T13:54:21-04:00] DEBUG: Forked instance now converging
Starting Chef Client, version 13.6.4^[[0m
[2018-03-19T13:54:21-04:00] INFO: *** Chef 13.6.4 ***
[2018-03-19T13:54:21-04:00] INFO: Platform: x86_64-darwin14
[2018-03-19T13:54:21-04:00] INFO: Chef-client pid: 15310
[2018-03-19T13:54:21-04:00] DEBUG: Chef-client request_id: c1303f14-ddf0-4e26-aede-b4f5aadada79
...
>>>> Caused by Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of echi 'secret goodbye' ----
STDOUT:
STDERR: sh: echi: command not found
---- End output of echi 'secret goodbye' ----
Ran echi 'secret goodbye' returned 127
...
$ chef-client -z sensitive.rb
[2018-03-19T13:56:09-04:00] INFO: Started chef-zero at chefzero://localhost:1 with repository at /Users/nathenharvey
One version per cookbook
[2018-03-19T13:56:09-04:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 13.6.4
[2018-03-19T13:56:10-04:00] INFO: *** Chef 13.6.4 ***
[2018-03-19T13:56:10-04:00] INFO: Platform: x86_64-darwin14
[2018-03-19T13:56:10-04:00] INFO: Chef-client pid: 15440
[2018-03-19T13:56:10-04:00] INFO: The plugin path /etc/chef/ohai/plugins does not exist. Skipping...
[2018-03-19T13:56:49-04:00] INFO: Run List is []
[2018-03-19T13:56:49-04:00] INFO: Run List expands to []
[2018-03-19T13:56:49-04:00] INFO: Starting Chef Run for nathenharvey
[2018-03-19T13:56:49-04:00] INFO: Running start handlers
[2018-03-19T13:56:49-04:00] INFO: Start handlers complete.
resolving cookbooks for run list: []
[2018-03-19T13:56:49-04:00] INFO: Loading cookbooks []
Synchronizing Cookbooks:
Installing Cookbook Gems:
Compiling Cookbooks...
[2018-03-19T13:56:49-04:00] WARN: Node nathenharvey has an empty run list.
Converging 3 resources
Recipe: @recipe_files::/Users/nathenharvey/tmp/sensitive.rb
* execute[echo something sensitive] action run[2018-03-19T13:56:49-04:00] INFO: Processing execute[echo something sensitive] action run (@recipe_files::/Users/nathenharvey/tmp/sensitive.rb line 1)
[2018-03-19T13:56:49-04:00] INFO: execute[echo something sensitive] ran successfully
- execute sensitive resource
 * execute[echo something insensitive] action run[2018-03-19T13:56:49-04:00] INFO: Processing execute[echo something insensitive] action run (@recipe_files::/Users/nathenharvey/tmp/sensitive.rb line 6)
[execute] goodbye
[2018-03-19T13:56:49-04:00] INFO: execute[echo something insensitive] ran successfully
- execute echo 'goodbye'
 * execute[echo something sensitive and fail] action run[2018-03-19T13:56:49-04:00] INFO: Processing execute[echo something sensitive and fail] action run (@recipe_files::/Users/nathenharvey/tmp/sensitive.rb line 10)

================================================================================
Error executing action `run` on resource 'execute[echo something sensitive and fail]'
================================================================================
 Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Command execution failed. STDOUT/STDERR suppressed for sensitive resource
 Resource Declaration:
---------------------
suppressed sensitive resource output
 Compiled Resource:
------------------
suppressed sensitive resource output
 System Info:
------------
chef_version=13.6.4
 platform=mac_os_x
 platform_version=10.13.3
 ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin14]
 program_name=chef-client worker: ppid=15436;start=13:56:09;
 executable=/opt/chefdk/bin/chef-client
[2018-03-19T13:56:49-04:00] INFO: Running queued delayed notifications before re-raising exception

Running handlers:
[2018-03-19T13:56:49-04:00] ERROR: Running exception handlers
Running handlers complete
[2018-03-19T13:56:49-04:00] ERROR: Exception handlers complete
Chef Client failed. 2 resources updated in 39 seconds
[2018-03-19T13:56:49-04:00] FATAL: Stacktrace dumped to /Users/nathenharvey/.chef/local-mode-cache/cache/chef-stacktrace.out
[2018-03-19T13:56:49-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-03-19T13:56:49-04:00] ERROR: execute[echo something sensitive and fail] (@recipe_files::/Users/nathenharvey/tmp/sensitive.rb line 10) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
[2018-03-19T13:56:49-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
execute 'echo something sensitive' do
command "echo 'secret goodbye'"
sensitive true
end
execute 'echo something insensitive' do
command "echo 'goodbye'"
end
execute 'echo something sensitive and fail' do
command "echi 'secret goodbye'"
sensitive true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment