ajcrowe / puppet-supervisord

Puppet Module to install and configure applications under supervisord
MIT License
37 stars 104 forks source link

Program ignores refreshing #101

Open ov7a opened 8 years ago

ov7a commented 8 years ago

For example, I need some supervisor service. I declare a manifest for config file and a manifest for supervisor::program. Then I add "subscribe" parameter to latter. I expect that when config changes, puppet notifies supervisor::program with refresh event and it should restart service. But this does not happen. I see only refresh of Exec[supervisorctl_command_start_<program>]. So just start signal is sent, not restart. This behavior should be fixed.

ov7a commented 8 years ago

Possible fix (program.pp):

  ...
  case $ensure_process {
    'stopped': {
      supervisord::supervisorctl { "stop_${name}":
        command => 'stop',
        process => $name
      }
    }
    'removed': {
      supervisord::supervisorctl { "remove_${name}":
        command => 'remove',
        process => $name
      }
    }
    'running': {
      supervisord::supervisorctl { "start_${name}":
        command => 'start',
        process => $name,
        unless  => 'running'
      }

      supervisord::supervisorctl { "restart_${name}":
        command => 'restart',
        process => $name,
        refreshonly => true
      }
    }
    default: { }
  }