Selectively enable/disable kannel/esme

Note that a repo refresh of rccn will trigger and esme-restart
but if we are using kannel the link in /etc/service will not exist
so there will be no restart.
This commit is contained in:
Wile E. Coyote 2018-11-18 13:13:20 +00:00
parent 01908da55d
commit 0c8f78698a
2 changed files with 42 additions and 2 deletions

View file

@ -263,7 +263,8 @@ schedule { 'repo':
notify => [ Exec['locale-gen'], notify => [ Exec['locale-gen'],
Exec['notify-freeswitch'], Exec['notify-freeswitch'],
Exec['restart-rapi'], Exec['restart-rapi'],
Exec['restart-smpp'] ], Exec['restart-smpp'],
Exec['restart-esme'] ],
} }
vcsrepo { '/var/meas_web': vcsrepo { '/var/meas_web':
@ -351,6 +352,10 @@ schedule { 'repo':
refreshonly => true, refreshonly => true,
} }
exec { 'restart-esme':
command => '/usr/bin/sv restart esme',
refreshonly => true,
}
if $operatingsystem == 'Ubuntu' { if $operatingsystem == 'Ubuntu' {
file { '/var/lib/locales/supported.d/local': file { '/var/lib/locales/supported.d/local':

View file

@ -11,6 +11,9 @@
# Sample Usage: # Sample Usage:
# #
class rhizo_base::runit { class rhizo_base::runit {
$use_kannel = $rhizo_base::use_kannel
file { '/etc/sv': file { '/etc/sv':
ensure => directory, ensure => directory,
source => 'puppet:///modules/rhizo_base/etc/sv', source => 'puppet:///modules/rhizo_base/etc/sv',
@ -25,6 +28,12 @@ class rhizo_base::runit {
source => 'puppet:///modules/rhizo_base/osmo-nitb.run.kannel', source => 'puppet:///modules/rhizo_base/osmo-nitb.run.kannel',
require => File['/etc/sv'], require => File['/etc/sv'],
} }
service { 'kannel':
enable => true,
require => Package['kannel'],
notify => [ Exec['stop-esme'], Exec['start-kannel'] ],
}
} }
if $use_kannel == 'no' { if $use_kannel == 'no' {
@ -39,6 +48,13 @@ class rhizo_base::runit {
ensure => link, ensure => link,
target => '/etc/sv/esme', target => '/etc/sv/esme',
require => File['/etc/sv'], require => File['/etc/sv'],
notify => [ Exec['stop-kannel'], Exec['start-esme'] ],
}
exec { 'disable-kannel':
notify => Exec['stop-kannel'],
command => '/usr/sbin/update-rc.d kannel disable',
require => Package['kannel'],
} }
} }
@ -88,4 +104,23 @@ class rhizo_base::runit {
require => [ File['/etc/sv'], Package['websocketd'] ], require => [ File['/etc/sv'], Package['websocketd'] ],
} }
exec { 'start-esme':
command => '/usr/bin/sv start esme',
refreshonly => true,
}
exec { 'stop-esme':
command => '/usr/bin/sv stop esme',
refreshonly => true,
}
exec { 'start-kannel':
command => '/etc/init.d/kannel start',
refreshonly => true,
}
exec { 'stop-kannel':
command => '/etc/init.d/kannel stop',
refreshonly => true,
}
} }