diff --git a/manifests/site.pp b/manifests/site.pp index e8fec3f..16f0f9f 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -1,106 +1,106 @@ # == Defined Type: uwsgi::site # # uwsgi::site defines a site for uwsgi. # # === Parameters # # [*ensure*] # Whether the site should be enabled, present (but disabled) or absent. # # [*settings*] # a hash of settings for the given site. Keys with dashes in the # config are added with underscores. # # === Examples # # uwsgi::site {'foo': # ensure => enabled, # settings => { # plugin => 'python3', # protocol => $uwsgi_protocol, # socket => $uwsgi_listen_address, # workers => $uwsgi_workers, # max_requests => $uwsgi_max_requests, # max_requests_delta => $uwsgi_max_requests_delta, # worker_reload_mercy => $uwsgi_reload_mercy, # reload_mercy => $uwsgi_reload_mercy, # uid => $user, # gid => $user, # module => 'swh.storage.api.server', # callable => 'run_from_webserver', # } # } # # === Authors # # Nicolas Dandrimont # # === Copyright # # Copyright 2015 The Software Heritage developers # define uwsgi::site ( $ensure = 'enabled', $settings = {} ){ $uwsgi_config = "/etc/uwsgi/apps-available/${name}.ini" $uwsgi_link = "/etc/uwsgi/apps-enabled/${name}.ini" $uwsgi_pidfile = "/var/run/uwsgi/app/${name}/pid" case $ensure { default: { err("Unknown value ensure => ${ensure}.") } 'enabled', 'present': { file {$uwsgi_config: ensure => present, owner => 'root', group => 'root', mode => '0644', content => template('uwsgi/uwsgi.ini.erb'), require => Package['uwsgi'], } } 'absent': { file {$uwsgi_config: ensure => absent, } } } case $ensure { default: { err("Unknown value ensure => ${ensure}.") } 'enabled': { file {$uwsgi_link: ensure => link, target => $uwsgi_config, require => File[$uwsgi_config], } File[$uwsgi_config] ~> Exec["uwsgi reload ${name}"] service {"uwsgi@${name}": ensure => running, enable => true, } } 'present', 'absent': { file {$uwsgi_link: ensure => absent, notify => Exec["uwsgi stop ${name}"], } service {"uwsgi@${name}": enable => false, } } } exec {"uwsgi reload ${name}": - command => "/usr/bin/systemctl reload uwsgi@${name}", + command => "/bin/systemctl reload uwsgi@${name}", refreshonly => true, } exec {"uwsgi stop ${name}": - command => "/usr/bin/systemctl stop uwsgi@${name}", + command => "/bin/systemctl stop uwsgi@${name}", refreshonly => true, } }