FAQ
Hi readers,

I had this idea. I am deploying a configuration file of a service with
puppet, and I want to restart the service if the file changes.

so I had this idea that the file definition contains a require=> and a
notify=> for the service.
that does not work, because Puppet does assume cyclic dependencies then.

And I have no clue whatsoever why. both statements go from file to service
(or from service to file, however you like to put it), but I really don't
see a cyclic dependency here.


can anyone help me out?
thanks in advance,
axel.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7y8HA_Nt0g4J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • R.I.Pienaar at Sep 5, 2012 at 8:49 am

    ----- Original Message -----
    From: "Axel Bock" <axel.bock@arbeitsagentur.de>
    To: puppet-users@googlegroups.com
    Sent: Wednesday, September 5, 2012 9:47:03 AM
    Subject: [Puppet Users] notify vs. require of services

    Hi readers,

    I had this idea. I am deploying a configuration file of a service
    with puppet, and I want to restart the service if the file changes.

    so I had this idea that the file definition contains a require=> and
    a notify=> for the service. that does not work, because Puppet does
    assume cyclic dependencies then.

    And I have no clue whatsoever why. both statements go from file to
    service (or from service to file, however you like to put it), but I
    really don't see a cyclic dependency here.
    file{"x": require => Service["y"], notify => Service["y"]}

    The require says 'do the service before the file' while the notify says
    'once the file changed, restart the service'.

    You cant manage the service both before and after a file so there's a
    conflict.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Axel Bock at Sep 5, 2012 at 9:18 am
    hm, I still don't see the logic.

    I think this is a common scenario (please tell me I'm wrong) that you
    ensure presence of a service generally, and then deploy a config file, and
    on changes you want - of course - the service to be restarted. or ... not?!

    is there a puppet pattern on how to do this maybe?


    Thanks,
    Axel.




    Am Mittwoch, 5. September 2012 10:47:04 UTC+2 schrieb Axel Bock:
    Hi readers,

    I had this idea. I am deploying a configuration file of a service with
    puppet, and I want to restart the service if the file changes.

    so I had this idea that the file definition contains a require=> and a
    notify=> for the service.
    that does not work, because Puppet does assume cyclic dependencies then.

    And I have no clue whatsoever why. both statements go from file to service
    (or from service to file, however you like to put it), but I really don't
    see a cyclic dependency here.


    can anyone help me out?
    thanks in advance,
    axel.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/5UpZmaf6vyMJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • R.I.Pienaar at Sep 5, 2012 at 9:31 am

    ----- Original Message -----
    From: "Axel Bock" <axel.bock@arbeitsagentur.de>
    To: puppet-users@googlegroups.com
    Sent: Wednesday, September 5, 2012 10:18:31 AM
    Subject: [Puppet Users] Re: notify vs. require of services

    hm, I still don't see the logic.

    I think this is a common scenario (please tell me I'm wrong) that you
    ensure presence of a service generally, and then deploy a config
    file, and on changes you want - of course - the service to be
    restarted. or ... not?!
    why would you start a service before the config file is deployed?
    surely you want to configure the service before starting it?

    Puppet only manage any resource once during the process of applying
    the catalog, so the common pattern is:

    package{"something": ...}
    file{"/etc/something/config": require => Package["something"], notify => Service["something"]}
    service{"something":...}

    this way it installs, then configures and then starts the service.

    In future any change to the config file will restart the service.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Axel Bock at Sep 5, 2012 at 9:34 am

    Am Mittwoch, 5. September 2012 11:25:51 UTC+2 schrieb R.I. Pienaar:
    why would you start a service before the config file is deployed?
    surely you want to configure the service before starting it?
    sure :) . that's what I meant, basically.

    so the common pattern is:

    package{"something": ...}
    file{"/etc/something/config": require => Package["something"], notify =>
    Service["something"]}
    service{"something":...}
    duh! thanks for that. obvious of course.

    thanks again!
    Axel.


    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Y-mptuQCG50J.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jcbollinger at Sep 5, 2012 at 2:14 pm

    On Wednesday, September 5, 2012 3:47:04 AM UTC-5, Axel Bock wrote:
    Hi readers,

    I had this idea. I am deploying a configuration file of a service with
    puppet, and I want to restart the service if the file changes.

    so I had this idea that the file definition contains a require=> and a
    notify=> for the service.
    that does not work, because Puppet does assume cyclic dependencies then.

    And I have no clue whatsoever why. both statements go from file to service
    (or from service to file, however you like to put it), but I really don't
    see a cyclic dependency here.

    I see that RIP gave you something you can use, but it's not clear whether
    you figured out your underlying misunderstanding about relationships. In
    particular, you seem to have been missing the point that relationships are
    directional, or perhaps you mistook the direction of the 'notify'
    relationship. The 'notify' relationships have directionality as 'before'
    relationships, opposite to that of 'require', and in fact 'notify' is best
    viewed as a specialization of 'before'. That is why you had a cycle.

    Moreover, no resource ever needs to declare more than one type of
    relationship with the same other resource. 'notify' is a specialization of
    'before', so you don't need both or those, 'subscribe' is a specialization
    of 'require', so you don't need both of those, and all the other mixed
    pairs represent cycles.


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/rj32woVGkmAJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Eric Sorenson at Sep 5, 2012 at 11:47 pm

    On Wednesday, September 5, 2012 7:13:53 AM UTC-7, jcbollinger wrote:

    'notify' is a specialization of 'before', so you don't need both or
    those, 'subscribe' is a specialization of 'require', so you don't need both
    of those, and all the other mixed pairs represent cycles.
    John -- this is a wonderfully succinct way of describing the relationships
    between these parameters. I'd never really thought about them (nor seen it
    put) quite that way. Thanks!

    -=Eric

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/u55mKM7uSA4J.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Axel Bock at Sep 10, 2012 at 12:39 pm

    Am Mittwoch, 5. September 2012 16:13:53 UTC+2 schrieb jcbollinger:
    perhaps you mistook the direction of the 'notify' relationship.

    this is it :) . thank you very much for this precise explanation :)

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-NLzJ-buLwAJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedSep 5, '12 at 8:47a
activeSep 10, '12 at 12:39p
posts8
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase