Ask Your Question

notification in defined type causes multiple refresh

asked 2015-08-26 07:17:40 -0500

Hi there,

I'm currently facing an weird behavior of notification:

I have a defined type containing some file_line ressources:

service { "solr5-${name}" :
      ensure    => running,
      enable    => true,
      hasstatus => $servicehasstatus,
      status    => $servicestatus,
      subscribe => File["${solrhome}/${name}/solr5-${name}"],
  File_Line <| tag == 'solrconfig' |> ~> Service["solr5-${name}"]

I force the notification on tags because i have multiple file_line and subscription on File did not work for me (it's another issue :) ).

The problem:

when i modify only one file on a particular instance of the defined type, it refreshes all instances' service:

Notice: Compiled catalog for localhost in environment production in 5.48 seconds
Notice: /Stage[main]/Main/Exec[refreshyum]/returns: executed successfully
Notice: /Stage[main]/Main/Solr5::Instance[third]/File_line[zk_host-third]/ensure: created
Notice: /Stage[main]/Main/Solr5::Instance[second]/Service[solr5-second]: Triggered 'refresh' from 1 events
Notice: /Stage[main]/Main/Solr5::Instance[first]/Service[solr5-first]: Triggered 'refresh' from 1 events
Notice: /Stage[main]/Main/Solr5::Instance[third]/Service[solr5-third]: Triggered 'refresh' from 1 events
Notice: Finished catalog run in 204.84 seconds

I want to restart the service when i update a configuration file, so restarting all services is not a good option for me. Any idea of how to do that ? did someone have already seen that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-26 11:38:39 -0500

GregLarkin gravatar image

From the looks of it, your file_line resources are tagged too broadly, and if any of them change, they will potentially cause a refresh of all of your services. It's hard to tell without seeing all of you code, but I expect you might achieve what you want if your code changed like so:

File_Line <| tag == "solrconfig-${name}" |> ~> Service["solr5-${name}"]

Of course, your file_line resource tags will have to be updated to follow the naming convention above.

edit flag offensive delete link more


Thanks a lot Greg !! You are right for the solution, I must respect tag uniqueness by instance to ensure that only the service with the modified configuration file will restart. However, i keep my mistake as a global refresh solution if needed ;)

egouraud gravatar imageegouraud ( 2015-08-26 14:18:44 -0500 )edit

Glad to help!

GregLarkin gravatar imageGregLarkin ( 2015-08-26 19:52:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-08-26 07:17:40 -0500

Seen: 317 times

Last updated: Aug 26 '15