Issues with chef-client daemon RHEL5

Hello,
I’m having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with no
errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource
service[testservice] with action restart, but service[testservice] cannot
be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.

Can you show us the service declaration and the template declaration?

Jeffrey Hulten
Principal Consultant at Automated Labs
jeffh@automatedlabs.com 206-853-5216
Skype: jeffhulten

On Jan 31, 2013, at 9:37 AM, Gabriel ss gabrielj6@gmail.com wrote:

Hello,
I'm having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with no errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource service[testservice] with action restart, but service[testservice] cannot be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.

you have a resources(template), that is setup to notify another
resource(service) which is not present. Now, notifications are only
triggered once the resource is changes, i.e. unless the template resource
is changed, the service restart notification wont be triggered. It seems
like for some reason your template is not changed in the first run, it
changes in the second run (which is a different issue). But also, you dont
have to service resource missing. Check your recipes, for a service
"testservice" resource, if its not there , then you might have to remove
the notification, or create that service resource. Also check if you are
supposed to include another recipe (if you find that the service is indeed
decalred in another recipe).

template "config.conf" do
. ..something..
notifies :restart ,"service[testservice]"
end

--- somewhere in your cookbook you should have--, if not, then create one
service "testservice" do
end

On Thu, Jan 31, 2013 at 9:37 AM, Gabriel ss gabrielj6@gmail.com wrote:

Hello,
I'm having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with
no errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource
service[testservice] with action restart, but service[testservice] cannot
be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.

if system "rpm -q testservice"

service "testservice" do
action [:enable]
end

allowed_groups=''

node[:cookbook][:cookbook_node][:test][:require_membership_of].each do
|member|
allowed_groups << "#{member}, "
end

template node[:cookbook][:cookbook_node][:test][:config] do
source "testservice.conf.erb"
owner "root"
group "root"
mode "0644"
variables ({
:allowed_groups => allowed_groups
})
notifies :restart, "service[testservice]"
end
end

I can run this manually over and over.

On Thu, Jan 31, 2013 at 12:49 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

you have a resources(template), that is setup to notify another
resource(service) which is not present. Now, notifications are only
triggered once the resource is changes, i.e. unless the template resource
is changed, the service restart notification wont be triggered. It seems
like for some reason your template is not changed in the first run, it
changes in the second run (which is a different issue). But also, you dont
have to service resource missing. Check your recipes, for a service
"testservice" resource, if its not there , then you might have to remove
the notification, or create that service resource. Also check if you are
supposed to include another recipe (if you find that the service is indeed
decalred in another recipe).

template "config.conf" do
. ..something..
notifies :restart ,"service[testservice]"
end

--- somewhere in your cookbook you should have--, if not, then create one
service "testservice" do
end

On Thu, Jan 31, 2013 at 9:37 AM, Gabriel ss gabrielj6@gmail.com wrote:

Hello,
I'm having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with
no errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource
service[testservice] with action restart, but service[testservice] cannot
be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.

Could you try upgrading to 10.18? There was a notifications bug in 10.12 I believe.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray


From: Gabriel ss [gabrielj6@gmail.com]
Sent: Thursday, January 31, 2013 11:37 AM
To: chef@lists.opscode.com
Subject: [chef] Issues with chef-client daemon RHEL5

Hello,
I’m having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with no errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource service[testservice] with action restart, but service[testservice] cannot be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.

I was just about to reply.
I just tried on 10.18.2 a few minutes ago - Same issue.

On Thu, Jan 31, 2013 at 1:47 PM, Matt Ray matt@opscode.com wrote:

Could you try upgrading to 10.18? There was a notifications bug in 10.12
I believe.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

From: Gabriel ss [gabrielj6@gmail.com]
Sent: Thursday, January 31, 2013 11:37 AM
To: chef@lists.opscode.com
Subject: [chef] Issues with chef-client daemon RHEL5

Hello,
I'm having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with
no errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource
service[testservice] with action restart, but service[testservice] cannot
be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.

On Thursday, January 31, 2013 at 9:37 AM, Gabriel ss wrote:

Hello,
I'm having the following issue, hoping someone might be able to help.

When running chef-client in daemon mode, the first run goes perfect with no errors. All runs after that, I get the following:
"Resource template[config.conf] is configured to notify resource service[testservice] with action restart, but service[testservice] cannot be found in the resource collection."
Any ideas?

Chef: 10.12.0 RHEL 2.6.18-308.1.1.el5

Thanks.
What does the code where the service[testservice] resource is defined look like?

Perhaps like this?

if condition
service "testservice" do
# …
end
end

--
Daniel DeLeo