Opscode-reporting-ctl reconfigure keeps failing when running it through daemonized chef-client


#1

Hi, I am using chef server 12.5.0(with reporting addon), chef-client 12.8.1 and running chef-server cookbook 4.1.0 to manage this server and its addons.
Recently, we found that chef client run kept failing with the error like below.

execute[opscode-reporting-reconfigure] (/var/chef/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 opscode-reporting-ctl reconfigure ----
STDOUT: [2016-06-10T23:37:30+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /opt/opscode-reporting/embedded
  One version per cookbook
(...)
e[0m[2016-06-10T23:37:52+00:00] INFO: Running queued delayed notifications before re-raising exception
[2016-06-10T23:37:52+00:00] ERROR: Running exception handlers
[2016-06-10T23:37:52+00:00] ERROR: Exception handlers complete
[2016-06-10T23:37:52+00:00] FATAL: Stacktrace dumped to /opt/opscode-reporting/embedded/cookbooks/cache/chef-stacktrace.out
[2016-06-10T23:37:52+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-06-10T23:37:52+00:00] ERROR: execute[/opt/opscode/embedded/bin/rabbitmqctl add_user runs 3409a53d549c007c42370a16746b960acdfbf72bc12dc2e08c4e8264ec7ba7e06e37e98532eadd2a4a7ffc163019909632e5] (opscode-reporting::rabbitmq line 29) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/opscode/embedded/bin/rabbitmqctl add_user runs 3409a53d549c007c42370a16746b960acdfbf72bc12dc2e08c4e8264ec7ba7e06e37e98532eadd2a4a7ffc163019909632e5 ----
STDOUT: 
STDERR: erlexec: HOME must be set
---- End output of /opt/opscode/embedded/bin/rabbitmqctl add_user runs 3409a53d549c007c42370a16746b960acdfbf72bc12dc2e08c4e8264ec7ba7e06e37e98532eadd2a4a7ffc163019909632e5 ----
Ran /opt/opscode/embedded/bin/rabbitmqctl add_user runs 3409a53d549c007c42370a16746b960acdfbf72bc12dc2e08c4e8264ec7ba7e06e37e98532eadd2a4a7ffc163019909632e5 returned 1
[2016-06-10T23:37:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
STDERR: 
---- End output of opscode-reporting-ctl reconfigure ----
Ran opscode-reporting-ctl reconfigure returned 1

After some research, I’ve found this is because chef-client daemon is not passing HOME env variable when executing opscode-reporting-ctl through chef-ingredient cookbook.
As a workaround, I have put HOME env setting in /etc/init.d/chef-client script but I am not sure if this is an ideal solution.
probably opscode-reporting-ctl should pick up HOME env even when it’s kicked through a daemon? or chef-client daemon should pass HOME env variable?

Please advise me where I should ask for the permanent solution.