Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ensure => directory,
owner => $supervisord::user,
group => $supervisord::group,
mode => '0644'
mode => '0755'
}
}

Expand Down
43 changes: 38 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
# Installs supervisor package (defaults to using pip)
#
class supervisord::install inherits supervisord {
# Check if supervisord is already installed in the system (not in venv)
# This prevents reinstallation via pip in new venv when old system Python installation exists
exec { 'check-supervisord-installed':
command => 'which supervisorctl || which supervisord',
path => ['/usr/bin', '/bin', '/usr/local/bin'],
returns => [0, 1],
onlyif => 'test -z "$(which supervisorctl 2>/dev/null)" && test -z "$(which supervisord 2>/dev/null)"',
}

if $::supervisord::pip_proxy and $::supervisord::package_provider == 'pip' {
exec { 'pip-install-supervisor':
user => root,
Expand All @@ -12,11 +21,35 @@
unless => 'which supervisorctl',
}
}
elsif $::supervisord::package_provider == 'pipx' {
exec { 'pipx-install-supervisor':
user => root,
path => ['/usr/bin','/bin', '/usr/local/bin'],
command => "pipx install ${supervisord::package_name}",
unless => 'which supervisorctl',
require => Package['pipx'],
}
file { '/usr/local/bin/supervisord':
ensure => link,
target => '/root/.local/bin/supervisord',
}
file { '/usr/local/bin/supervisorctl':
ensure => link,
target => '/root/.local/bin/supervisorctl',
}
}
else {
package { $supervisord::package_name:
ensure => $supervisord::package_ensure,
provider => $supervisord::package_provider,
install_options => $supervisord::package_install_options,
if $::supervisord::package_provider == 'pip' {
# Check if supervisord is already available in system PATH
# This prevents reinstallation via pip in new venv when old system Python installation exists
notify { 'supervisord already installed in system via pip, skipping installation': loglevel => 'debug' }
}
else {
package { $supervisord::package_name:
ensure => $supervisord::package_ensure,
provider => $supervisord::package_provider,
install_options => $supervisord::package_install_options,
}
}
}
}
}
20 changes: 8 additions & 12 deletions manifests/reload.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
# Class to reread and update supervisord with supervisorctl
#
class supervisord::reload inherits supervisord {
if $::supervisord::service_manage {
$supervisorctl = $::supervisord::executable_ctl
$supervisorctl = $::supervisord::executable_ctl

exec { 'supervisorctl_reread':
command => "${supervisorctl} reread",
refreshonly => true,
require => Service[$::supervisord::service_name],
}
exec { 'supervisorctl_update':
command => "${supervisorctl} update",
refreshonly => true,
require => Service[$::supervisord::service_name],
}
exec { 'supervisorctl_reread':
command => "${supervisorctl} reread",
refreshonly => true,
}
exec { 'supervisorctl_update':
command => "${supervisorctl} update",
refreshonly => true,
}
}