Add support for xenial

Add a systemd unit file for the paste service instead of relying on
upstart.

Change-Id: I9f43ca88fba5fd41c9a8aaf2e14ffa3f6b307619
Depends-On: If25da754ec107b8dba2d9343f16b54b99cc88e01
This commit is contained in:
Colleen Murphy 2017-06-11 22:12:30 +02:00
parent 53cc271ba1
commit d685933033
2 changed files with 28 additions and 9 deletions

View File

@ -22,12 +22,22 @@ define lodgeit::site(
docroot => "/srv/www/${name}/"
}
file { "/etc/init/${name}-paste.conf":
ensure => present,
content => template('lodgeit/upstart.erb'),
replace => true,
require => Class['httpd'],
notify => Service["${name}-paste"],
if versioncmp($::operatingsystemmajrelease, '16.04') >= 0 {
file { "/etc/systemd/system/${name}-paste.service":
ensure => present,
content => template('lodgeit/systemd.erb'),
replace => true,
require => Class['httpd'],
notify => Service["${name}-paste"],
}
} else {
file { "/etc/init/${name}-paste.conf":
ensure => present,
content => template('lodgeit/upstart.erb'),
replace => true,
require => Class['httpd'],
notify => Service["${name}-paste"],
}
}
file { "/srv/lodgeit/${name}":
@ -83,8 +93,8 @@ define lodgeit::site(
}
service { "${name}-paste":
ensure => running,
provider => upstart,
require => Class['httpd'],
ensure => running,
enable => true,
require => Class['httpd'],
}
}

9
templates/systemd.erb Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description="<%= @name %> Lodgeit server"
# Author "Andrew Hutchings <andrew@linuxjedi.co.uk>"
[Service]
ExecStart=/usr/bin/python /srv/lodgeit/<%= @name %>/manage.py runserver -h 127.0.0.1 -p <%= @port %>
[Install]
WantedBy=multi-user.target