Puppet 3.6.2

First, I understand that Execs try not to run multiple times if called many 
times by many resources and typically wait until they've all been 
"collected" from all resources, but I have a specific case where I need 
different Execs to run in a particular order based on a set of resources 
that change.   

The basic pattern is:
1.  Install/update Configuration file (configuration gets updated on all 
version changes)
2.  Stop Exec script subscribes to Configuration file
3.  Package Install/update notifies Start Exec script
4.  Package requires Configuration file

The basic resource ordering in the manifest looks like:

  require foo::config  # This contains the File['Config'] resource

  #This might be redundant, but trying to force this relationship
  File['Config'] -> Package["foo"]

  package { ["foo"]:
    ensure  => "${version}-${release}",
    notify  => Exec['start']
  }

  # Start, stop, restart functions for ads server
  file {"/usr/local/sbin/control.sh":
    source => "puppet:///modules/foo/control.sh",
    ensure => present,
    owner  => root,
    group  => root,
    mode   => 0744,
  }

  exec { "stop":
    path        => 
"/usr/local/sbin/:/usr/local/jdk/bin:/bin:/sbin:/usr/sbin:/usr/bin",
    command     => '/usr/local/sbin/control.sh stop',
    refreshonly => true,
    logoutput   => true,
    subscribe   => File['Config'],
    require     => File['/usr/local/sbin/control.sh']
  }

  exec { "start":
    path        => 
"/usr/local/sbin/:/usr/local/jdk/bin:/bin:/sbin:/usr/sbin:/usr/bin",
    command     => '/usr/local/sbin/control.sh start',
    refreshonly => true,
    logoutput   => true,
    require     => File['/usr/local/sbin/control.sh']
  }


However, when puppet apply runs this is what happens:

1.  Configuration file is installed/updated, schedules a refresh of Stop 
Exec
2.  Package is installed, schedules refresh of Start Exec
3.  Start Exec runs
4.  Stop Exec runs

There's probably a better way of doing this (possibly with run stages), I'm 
just curious why this plan does not work.   I'm very open to improvements.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b892a4d6-4356-40ab-95a2-ab8ca218e2d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to