Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Service resource is not working as expected not able to detect service status in why-run #8556
CHEF CLIENT BUG: Service resource giving invalid message in why-run mode and its not able to determine the status of the service:
In default recipe, we have called the service resource with attributes as shown below :
where, RHEL_7_OR_HIGHER is boolean value. RHEL_7_OR_HIGHER will be true if RHEL version is 7 or higher else it's false.
When executing policy in why-run mode, facing the below issue :
For action start & enable for crod service, we are getting warning/message as below and its not able to determine the service status :
** The service resource is not able to find the status of the 'currently sunning service', and showing the above failure message?**
Red Hat Enterprise Linux Server release 7.5 (Maipo)
replicate your problem by executing below resource
service 'crond' do
Service status on the system:
May 15 11:59:24 test123 systemd: Started Command Scheduler.
Even if the service status is active (running) i.e. '(up to date)'. Why we getting the below 2 warning/deviation messages, what is the purpose of adding it into the why-run only.
We are refering the below files, debugged the below files stacktrace output, got below mentioned logs by debugging below files:
/chef-12.12.13/lib/chef/provider/service/simple.rb ( We are getting the message from this file in method ‘shared_resource_requirements’ in why-run mode, not getting the purpose of adding this message )
I added some print statements in above file for debugging, Logs are as below
this line should be entirely unnecessary and may be the cause of some of the problem:
chef should be able to figure that out on its own. and generally injecting the