Files
puppet-nova/manifests/generic_service.pp
Dan Bode 6c9cb5159b Improve db sync dependencies
This commit adds a couple of dependencies related to db sync.

Previously, it was possible that the nova-scheduler could be started
before the db was synced. This would result in the service failing.
This could only happen if none of the nova::manage::* defines were used.

This commit adds a few extra dependencies to ensure that the initial
db sync occurs before any services are started and also that the nova-db-sync
call is only made after the nova-command package is installed and nova
is configured to connect to the db.
2012-05-09 16:50:34 -07:00

58 lines
1.4 KiB
Puppet

#
# This class implements basic nova services.
# It is introduced to attempt to consolidate
# common code.
#
# It also allows users to specify ad-hoc services
# as needed
#
#
# This define creates a service resource with title nova-${name} and
# conditionally creates a package resource with title nova-${name}
#
define nova::generic_service(
$package_name,
$service_name,
$enabled = false,
$ensure_package = 'present'
) {
include nova::params
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
$nova_title = "nova-${name}"
# ensure that the service is only started after
# all nova config entries have been set
Exec['post-nova_config'] ~> Service<| title == $nova_title |>
# ensure that the service has only been started
# after the initial db sync
Exec<| title == 'initial-db-sync' |> ~> Service<| title == $nova_title |>
Exec['nova-db-sync'] ~> Service<| title == $nova_title |>
# I need to mark that ths package should be
# installed before nova_config
if ($package_name) {
package { $nova_title:
name => $package_name,
ensure => $ensure_package,
notify => Service[$nova_title],
}
}
if ($service_name) {
service { $nova_title:
name => $service_name,
ensure => $service_ensure,
enable => $enabled,
require => Package['nova-common'],
}
}
}