From cb77bc295f0657e858116a93b21e85658152caf0 Mon Sep 17 00:00:00 2001 From: Clayton O'Neill Date: Mon, 16 Nov 2015 02:55:39 +0000 Subject: [PATCH] Add hooks for external install & svc management This adds defined anchor points for external modules to hook into the software install, config and service dependency chain. This allows external modules to manage software installation (virtualenv, containers, etc) and service management (pacemaker) without needing rely on resources that may change or be renamed. Change-Id: I0b524e354b095f2642fd38a2f88536d15bcdf855 --- manifests/api.pp | 9 +- manifests/cells.pp | 1 + manifests/cert.pp | 1 + manifests/client.pp | 3 +- manifests/compute.pp | 4 +- manifests/compute/ironic.pp | 2 + manifests/compute/libvirt.pp | 11 ++- manifests/compute/neutron.pp | 1 + manifests/compute/rbd.pp | 7 +- manifests/compute/serial.pp | 1 + manifests/compute/spice.pp | 2 + manifests/compute/vmware.pp | 5 +- manifests/compute/xenserver.pp | 5 +- manifests/conductor.pp | 1 + manifests/config.pp | 2 + manifests/consoleauth.pp | 2 +- manifests/cron/archive_deleted_rows.pp | 4 +- manifests/db.pp | 3 +- manifests/db/mysql.pp | 6 +- manifests/db/postgresql.pp | 8 +- manifests/db/sync.pp | 16 ++-- manifests/deps.pp | 63 +++++++++++++ manifests/generic_service.pp | 18 +--- manifests/init.pp | 27 ++---- manifests/keystone/auth.pp | 2 + manifests/logging.pp | 2 + manifests/manage/cells.pp | 3 +- manifests/manage/floating.pp | 4 +- manifests/manage/network.pp | 3 +- manifests/migration/libvirt.pp | 94 ++++++++++--------- manifests/network.pp | 1 + manifests/network/bridge.pp | 1 + manifests/network/flat.pp | 2 + manifests/network/flatdhcp.pp | 7 +- manifests/network/neutron.pp | 2 + manifests/network/vlan.pp | 7 +- manifests/objectstore.pp | 2 +- manifests/policy.pp | 6 +- manifests/quota.pp | 1 + manifests/rabbitmq.pp | 7 +- manifests/scheduler.pp | 4 +- manifests/scheduler/filter.pp | 2 + manifests/serialproxy.pp | 1 + manifests/spicehtml5proxy.pp | 1 + manifests/vncproxy.pp | 2 + manifests/vncproxy/common.pp | 2 + spec/classes/nova_api_spec.rb | 3 +- spec/classes/nova_client_spec.rb | 2 +- spec/classes/nova_compute_libvirt_spec.rb | 69 ++++++++------ spec/classes/nova_compute_spec.rb | 5 +- .../nova_cron_archive_deleted_rows_spec.rb | 2 +- spec/classes/nova_db_spec.rb | 4 +- spec/classes/nova_init_spec.rb | 8 +- spec/classes/nova_network_spec.rb | 2 +- spec/defines/nova_generic_service_spec.rb | 7 +- spec/shared_examples.rb | 16 +++- 56 files changed, 291 insertions(+), 185 deletions(-) create mode 100644 manifests/deps.pp diff --git a/manifests/api.pp b/manifests/api.pp index e438cd957..6f6edc460 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -217,20 +217,13 @@ class nova::api( $conductor_workers = undef, ) { + include ::nova::deps include ::nova::db include ::nova::params include ::nova::policy require ::keystone::python include ::cinder::client - Package<| title == 'nova-common' |> -> Class['nova::api'] - Package<| title == 'nova-common' |> -> Class['nova::policy'] - - Nova_paste_api_ini<| |> ~> Exec['post-nova_config'] - - Nova_paste_api_ini<| |> ~> Service['nova-api'] - Class['nova::policy'] ~> Service['nova-api'] - if $conductor_workers { warning('The conductor_workers parameter is deprecated and has no effect. Use workers parameter of nova::conductor class instead.') } diff --git a/manifests/cells.pp b/manifests/cells.pp index b1f3d9207..0f4cc5ebe 100644 --- a/manifests/cells.pp +++ b/manifests/cells.pp @@ -172,6 +172,7 @@ class nova::cells ( $weight_scale = '1.0' ) { + include ::nova::deps include ::nova::params case $cell_type { diff --git a/manifests/cert.pp b/manifests/cert.pp index 1d3a6ff17..11657cab3 100644 --- a/manifests/cert.pp +++ b/manifests/cert.pp @@ -22,6 +22,7 @@ class nova::cert( $ensure_package = 'present' ) { + include ::nova::deps include ::nova::params nova::generic_service { 'cert': diff --git a/manifests/client.pp b/manifests/client.pp index 024dd300a..90152e671 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -11,10 +11,11 @@ class nova::client( $ensure = 'present' ) { + include ::nova::deps package { 'python-novaclient': ensure => $ensure, - tag => ['openstack'], + tag => ['openstack', 'nova-support-package'], } } diff --git a/manifests/compute.pp b/manifests/compute.pp index 8417d4a0d..6d1175a2a 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -150,6 +150,7 @@ class nova::compute ( $allow_resize_to_same_host = false, ) { + include ::nova::deps include ::nova::params nova_config { @@ -173,7 +174,7 @@ class nova::compute ( # Install bridge-utils if we use nova-network package { 'bridge-utils': ensure => present, - before => Nova::Generic_service['compute'], + tag => ['openstack', 'nova-support-package'], } } @@ -221,6 +222,7 @@ class nova::compute ( package { 'pm-utils': ensure => present, + tag => ['openstack', 'nova-support-package'], } nova_config { diff --git a/manifests/compute/ironic.pp b/manifests/compute/ironic.pp index ae5c8800f..ced522ca0 100644 --- a/manifests/compute/ironic.pp +++ b/manifests/compute/ironic.pp @@ -46,6 +46,8 @@ class nova::compute::ironic ( $compute_driver = 'ironic.IronicDriver' ) { + include ::nova::deps + if $admin_user { warning('The admin_user parameter is deprecated, use admin_username instead.') } diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 34d17cce6..c4594fa3e 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -106,6 +106,7 @@ class nova::compute::libvirt ( $compute_driver = 'libvirt.LibvirtDriver' ) inherits nova::params { + include ::nova::deps include ::nova::params Service['libvirt'] -> Service['nova-compute'] @@ -126,10 +127,8 @@ class nova::compute::libvirt ( if($::osfamily == 'Debian') { package { "nova-compute-${libvirt_virt_type}": - ensure => present, - before => Package['nova-compute'], - require => Package['nova-common'], - tag => ['openstack'], + ensure => present, + tag => ['openstack', 'nova-package'], } } @@ -156,6 +155,7 @@ class nova::compute::libvirt ( ensure => present, name => $::nova::params::libvirt_nwfilter_package_name, before => Service['libvirt'], + tag => ['openstack', 'nova-support-package'], } case $libvirt_virt_type { 'qemu': { @@ -172,6 +172,7 @@ class nova::compute::libvirt ( package { 'libvirt': ensure => present, name => $libvirt_package_name_real, + tag => ['openstack', 'nova-support-package'], } service { 'libvirt' : @@ -179,7 +180,7 @@ class nova::compute::libvirt ( enable => true, name => $libvirt_service_name, provider => $::nova::params::special_service_provider, - require => Package['libvirt'], + require => Anchor['nova::config::end'], } nova_config { diff --git a/manifests/compute/neutron.pp b/manifests/compute/neutron.pp index 91ee91cfc..43d6eeed9 100644 --- a/manifests/compute/neutron.pp +++ b/manifests/compute/neutron.pp @@ -19,6 +19,7 @@ class nova::compute::neutron ( $libvirt_vif_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver', $force_snat_range = '0.0.0.0/0', ) { + include ::nova::deps if $libvirt_vif_driver == 'nova.virt.libvirt.vif.LibvirtOpenVswitchDriver' { fail('nova.virt.libvirt.vif.LibvirtOpenVswitchDriver as vif_driver is removed from Icehouse') diff --git a/manifests/compute/rbd.pp b/manifests/compute/rbd.pp index 0d03f0cc7..25105026d 100644 --- a/manifests/compute/rbd.pp +++ b/manifests/compute/rbd.pp @@ -65,6 +65,7 @@ class nova::compute::rbd ( $ephemeral_storage = true, ) { + include ::nova::deps include ::nova::params nova_config { @@ -78,7 +79,7 @@ class nova::compute::rbd ( file { '/etc/nova/secret.xml': content => template('nova/secret.xml-compute.erb'), - require => Class['::nova'] + require => Anchor['nova::config::begin'], } exec { 'get-or-set virsh secret': @@ -95,9 +96,9 @@ class nova::compute::rbd ( exec { 'set-secret-value virsh': command => "/usr/bin/virsh secret-set-value --secret ${libvirt_rbd_secret_uuid} --base64 ${libvirt_key}", unless => "/usr/bin/virsh secret-get-value ${libvirt_rbd_secret_uuid}", - require => Exec['get-or-set virsh secret'] + require => Exec['get-or-set virsh secret'], + before => Achor['nova::config::end'], } - } if $ephemeral_storage { diff --git a/manifests/compute/serial.pp b/manifests/compute/serial.pp index f71db8546..3f5bb4e83 100644 --- a/manifests/compute/serial.pp +++ b/manifests/compute/serial.pp @@ -28,6 +28,7 @@ class nova::compute::serial( $proxyclient_address = '127.0.0.1', ) { + include ::nova::deps nova_config { 'serial_console/enabled': value => true; diff --git a/manifests/compute/spice.pp b/manifests/compute/spice.pp index b6cf09f0e..cdfc7397f 100644 --- a/manifests/compute/spice.pp +++ b/manifests/compute/spice.pp @@ -48,6 +48,8 @@ class nova::compute::spice( $proxy_path = '/spice_auto.html' ) { + include ::nova::deps + if $proxy_host { $html5proxy_base_url = "${proxy_protocol}://${proxy_host}:${proxy_port}${proxy_path}" nova_config { diff --git a/manifests/compute/vmware.pp b/manifests/compute/vmware.pp index 40b2d460d..e72f78046 100644 --- a/manifests/compute/vmware.pp +++ b/manifests/compute/vmware.pp @@ -60,6 +60,8 @@ class nova::compute::vmware( $compute_driver = 'vmwareapi.VMwareVCDriver' ) { + include ::nova::deps + nova_config { 'DEFAULT/compute_driver': value => $compute_driver; 'VMWARE/host_ip': value => $host_ip; @@ -79,6 +81,7 @@ class nova::compute::vmware( } package { 'python-suds': - ensure => present + ensure => present, + tag => ['openstack', 'nova-support-package'], } } diff --git a/manifests/compute/xenserver.pp b/manifests/compute/xenserver.pp index cebd6d23e..a57179a69 100644 --- a/manifests/compute/xenserver.pp +++ b/manifests/compute/xenserver.pp @@ -29,6 +29,8 @@ class nova::compute::xenserver( $xenapi_inject_image = undef, ) { + include ::nova::deps + if $xenapi_inject_image != undef { warning('The xenapi_inject_image parameter is deprecated and has no effect.') } @@ -44,7 +46,8 @@ class nova::compute::xenserver( package { 'xenapi': ensure => present, - provider => pip + provider => pip, + tag => ['openstack', 'nova-support-package'], } Package['python-pip'] -> Package['xenapi'] diff --git a/manifests/conductor.pp b/manifests/conductor.pp index c5a67c086..7a8c76549 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -32,6 +32,7 @@ class nova::conductor( $use_local = false, ) { + include ::nova::deps include ::nova::db include ::nova::params diff --git a/manifests/config.pp b/manifests/config.pp index e9d13ba2d..d138b3307 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -32,6 +32,8 @@ class nova::config ( $nova_paste_api_ini = {}, ) { + include ::nova::deps + validate_hash($nova_config) validate_hash($nova_paste_api_ini) diff --git a/manifests/consoleauth.pp b/manifests/consoleauth.pp index d5764873e..f5a3c7beb 100644 --- a/manifests/consoleauth.pp +++ b/manifests/consoleauth.pp @@ -25,6 +25,7 @@ class nova::consoleauth( $ensure_package = 'present' ) { + include ::nova::deps include ::nova::params nova::generic_service { 'consoleauth': @@ -33,7 +34,6 @@ class nova::consoleauth( package_name => $::nova::params::consoleauth_package_name, service_name => $::nova::params::consoleauth_service_name, ensure_package => $ensure_package, - require => Package['nova-common'], } } diff --git a/manifests/cron/archive_deleted_rows.pp b/manifests/cron/archive_deleted_rows.pp index 9574977f9..ccebeca39 100644 --- a/manifests/cron/archive_deleted_rows.pp +++ b/manifests/cron/archive_deleted_rows.pp @@ -60,6 +60,8 @@ class nova::cron::archive_deleted_rows ( $destination = '/var/log/nova/nova-rowsflush.log' ) { + include ::nova::deps + cron { 'nova-manage db archive_deleted_rows': command => "nova-manage db archive_deleted_rows --max_rows ${max_rows} >>${destination} 2>&1", environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh', @@ -69,6 +71,6 @@ class nova::cron::archive_deleted_rows ( monthday => $monthday, month => $month, weekday => $weekday, - require => Package['nova-common'], + require => Anchor['nova::dbsync::end'] } } diff --git a/manifests/db.pp b/manifests/db.pp index 6d15ffbf4..07fc8191c 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -65,6 +65,7 @@ class nova::db ( $database_max_overflow = $::os_service_default, ) { + include ::nova::deps include ::nova::params # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function @@ -109,7 +110,7 @@ class nova::db ( package {'nova-backend-package': ensure => present, name => $backend_package, - tag => 'openstack', + tag => ['openstack', 'nova-package'], } } diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index 1cd46e0ca..ee4652c3d 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -41,6 +41,8 @@ class nova::db::mysql( $allowed_hosts = undef, ) { + include ::nova::deps + ::openstacklib::db::mysql { 'nova': user => $user, password_hash => mysql_password($password), @@ -51,5 +53,7 @@ class nova::db::mysql( allowed_hosts => $allowed_hosts, } - ::Openstacklib::Db::Mysql['nova'] ~> Exec<| title == 'nova-db-sync' |> + Anchor['nova::db::begin'] + ~> Class['nova::db::mysql'] + ~> Anchor['nova::db::end'] } diff --git a/manifests/db/postgresql.pp b/manifests/db/postgresql.pp index 8eeb44a67..c037886f1 100644 --- a/manifests/db/postgresql.pp +++ b/manifests/db/postgresql.pp @@ -32,6 +32,8 @@ class nova::db::postgresql( $privileges = 'ALL', ) { + include ::nova::deps + ::openstacklib::db::postgresql { 'nova': password_hash => postgresql_password($user, $password), dbname => $dbname, @@ -40,7 +42,7 @@ class nova::db::postgresql( privileges => $privileges, } - ::Openstacklib::Db::Postgresql['nova'] ~> Exec<| title == 'nova-db-sync' |> - ::Openstacklib::Db::Postgresql['nova'] -> Anchor<| title == 'nova-start' |> - + Anchor['nova::db::begin'] + ~> Class['nova::db::postgresql'] + ~> Anchor['nova::db::end'] } diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 64b9d9c41..24dd40184 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -13,20 +13,18 @@ class nova::db::sync( $extra_params = undef, ) { + include ::nova::deps include ::nova::params - Package<| tag =='nova-package' |> ~> Exec['nova-db-sync'] - Exec['nova-db-sync'] ~> Service <| tag == 'nova-service' |> - - Nova_config <||> -> Exec['nova-db-sync'] - Nova_config <| title == 'database/connection' |> ~> Exec['nova-db-sync'] - - Exec<| title == 'post-nova_config' |> ~> Exec['nova-db-sync'] - exec { 'nova-db-sync': command => "/usr/bin/nova-manage ${extra_params} db sync", refreshonly => true, logoutput => on_failure, + subscribe => [ + Anchor['nova::install::end'], + Anchor['nova::config::end'], + Anchor['nova::dbsync::begin'] + ], + notify => Anchor['nova::dbsync::end'], } - } diff --git a/manifests/deps.pp b/manifests/deps.pp new file mode 100644 index 000000000..78c1fa3bb --- /dev/null +++ b/manifests/deps.pp @@ -0,0 +1,63 @@ +# == Class: nova::deps +# +# Nova anchors and dependency management +# +class nova::deps { + # Setup anchors for install, config and service phases of the module. These + # anchors allow external modules to hook the begin and end of any of these + # phases. Package or service management can also be replaced by ensuring the + # package is absent or turning off service management and having the + # replacement depend on the appropriate anchors. When applicable, end tags + # should be notified so that subscribers can determine if installation, + # config or service state changed and act on that if needed. + anchor { 'nova::install::begin': } + -> Package<| tag == 'nova-package'|> + ~> anchor { 'nova::install::end': } + -> anchor { 'nova::config::begin': } + -> Nova_config<||> + ~> anchor { 'nova::config::end': } + -> anchor { 'nova::db::begin': } + -> anchor { 'nova::db::end': } + ~> anchor { 'nova::dbsync::begin': } + -> anchor { 'nova::dbsync::end': } + ~> anchor { 'nova::service::begin': } + ~> Service<| tag == 'nova-service' |> + ~> anchor { 'nova::service::end': } + + # paste-api.ini config shold occur in the config block also. + Anchor['nova::config::begin'] + -> Nova_paste_api_ini<||> + ~> Anchor['nova::config::end'] + + # Support packages need to be installed in the install phase, but we don't + # put them in the chain above because we don't want any false dependencies + # between packages with the nova-package tag and the nova-support-package + # tag. Note: the package resources here will have a 'before' relationshop on + # the nova::install::end anchor. The line between nova-support-package and + # nova-package should be whether or not Nova services would need to be + # restarted if the package state was changed. + Anchor['nova::install::begin'] + -> Package<| tag == 'nova-support-package'|> + -> Anchor['nova::install::end'] + + # The following resourcs are managed by calling 'nova manage' and so the + # database must be provisioned before they can be applied. + Anchor['nova::dbsync::end'] + -> Nova_cells<||> + Anchor['nova::dbsync::end'] + -> Nova_floating<||> + Anchor['nova::dbsync::end'] + -> Nova_network<||> + + # Installation or config changes will always restart services. + Anchor['nova::install::end'] ~> Anchor['nova::service::begin'] + Anchor['nova::config::end'] ~> Anchor['nova::service::begin'] + + # This is here for backwards compatability for any external users of the + # nova-start anchor. This should be considered deprecated and removed in the + # N cycle + anchor { 'nova-start': + require => Anchor['nova::install::end'], + before => Anchor['nova::config::begin'], + } +} diff --git a/manifests/generic_service.pp b/manifests/generic_service.pp index c566acff1..1893ecb11 100644 --- a/manifests/generic_service.pp +++ b/manifests/generic_service.pp @@ -38,16 +38,10 @@ define nova::generic_service( $ensure_package = 'present' ) { + include ::nova::deps include ::nova::params $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 == 'nova-db-sync' |> ~> Service<| title == $nova_title |> - # I need to mark that ths package should be # installed before nova_config @@ -56,18 +50,9 @@ define nova::generic_service( package { $nova_title: ensure => $ensure_package, name => $package_name, - notify => Service[$nova_title], tag => ['openstack', 'nova-package'], } } - - if $service_name { - # Do the dependency relationship here in case the package - # has been defined elsewhere, either as Package[$nova_title] - # or Package[$package_name] - Package<| title == $nova_title |> -> Service[$nova_title] - Package<| title == $package_name |> -> Service[$nova_title] - } } if $service_name { @@ -84,7 +69,6 @@ define nova::generic_service( name => $service_name, enable => $enabled, hasstatus => true, - require => [Package['nova-common']], tag => 'nova-service', } } diff --git a/manifests/init.pp b/manifests/init.pp index fa9dfcb66..d59d44a26 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -409,6 +409,8 @@ class nova( $qpid_tcp_nodelay = undef, ) inherits nova::params { + include ::nova::deps + # maintain backward compatibility include ::nova::db include ::nova::logging @@ -446,7 +448,8 @@ class nova( mode => '0700', owner => 'nova', group => 'nova', - require => Package['nova-common'], + require => Anchor['nova::config::begin'], + before => Anchor['nova::config::end'], } if $nova_public_key { @@ -484,37 +487,27 @@ class nova( mode => '0600', owner => 'nova', group => 'nova', - require => [ File['/var/lib/nova/.ssh'], Package['nova-common'] ], + require => File['/var/lib/nova/.ssh'], } } } - Nova_config<| |> ~> Exec['post-nova_config'] - if $install_utilities { class { '::nova::utilities': } } - # this anchor is used to simplify the graph between nova components by - # allowing a resource to serve as a point where the configuration of nova begins - anchor { 'nova-start': } - package { 'python-nova': ensure => $ensure_package, - tag => ['openstack'], + tag => ['openstack', 'nova-package'], } package { 'nova-common': ensure => $ensure_package, name => $::nova::params::common_package_name, - require => [Package['python-nova'], Anchor['nova-start']], + require => Package['python-nova'], tag => ['openstack', 'nova-package'], } - file { '/etc/nova/nova.conf': - require => Package['nova-common'], - } - # used by debian/ubuntu in nova::network_bridge to refresh # interfaces based on /etc/network/interfaces exec { 'networking-refresh': @@ -781,10 +774,4 @@ class nova( nova_config { 'DEFAULT/os_region_name': ensure => absent; } - - exec { 'post-nova_config': - command => '/bin/echo "Nova config has changed"', - refreshonly => true, - } - } diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 25f7d2f11..85953e83d 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -188,6 +188,8 @@ class nova::keystone::auth( $internal_address = undef, ) { + include ::nova::deps + if $compute_version { warning('The compute_version parameter is deprecated, use public_url, internal_url and admin_url instead.') } diff --git a/manifests/logging.pp b/manifests/logging.pp index 0379f7336..f50443598 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -110,6 +110,8 @@ class nova::logging( $log_date_format = $::os_service_default, ) { + include ::nova::deps + # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function # to use nova:: first then nova::logging::. $use_syslog_real = pick($::nova::use_syslog,$use_syslog) diff --git a/manifests/manage/cells.pp b/manifests/manage/cells.pp index b51455275..c2bad4a95 100644 --- a/manifests/manage/cells.pp +++ b/manifests/manage/cells.pp @@ -71,8 +71,7 @@ define nova::manage::cells ( $weight_scale = '1.0' ) { - File['/etc/nova/nova.conf'] -> Nova_cells[$name] - Exec<| title == 'nova-db-sync' |> -> Nova_cells[$name] + include ::nova::deps nova_cells { $name: ensure => present, diff --git a/manifests/manage/floating.pp b/manifests/manage/floating.pp index 5268430cd..a9421b0f4 100644 --- a/manifests/manage/floating.pp +++ b/manifests/manage/floating.pp @@ -7,13 +7,11 @@ # define nova::manage::floating ( $network ) { - File['/etc/nova/nova.conf'] -> Nova_floating[$name] - Exec<| title == 'nova-db-sync' |> -> Nova_floating[$name] + include ::nova::deps nova_floating { $name: ensure => present, network => $network, provider => 'nova_manage', } - } diff --git a/manifests/manage/network.pp b/manifests/manage/network.pp index 4f3afac3b..cb66686b3 100644 --- a/manifests/manage/network.pp +++ b/manifests/manage/network.pp @@ -52,8 +52,7 @@ define nova::manage::network ( $dns2 = undef ) { - File['/etc/nova/nova.conf'] -> Nova_network[$name] - Exec<| title == 'nova-db-sync' |> -> Nova_network[$name] + include ::nova::deps nova_network { $name: ensure => present, diff --git a/manifests/migration/libvirt.pp b/manifests/migration/libvirt.pp index ff9e6d27c..e47c8c04b 100644 --- a/manifests/migration/libvirt.pp +++ b/manifests/migration/libvirt.pp @@ -27,6 +27,9 @@ class nova::migration::libvirt( $live_migration_flag = undef, $block_migration_flag = undef, ){ + + include ::nova::deps + if $use_tls { $listen_tls = '1' $listen_tcp = '0' @@ -52,89 +55,90 @@ class nova::migration::libvirt( validate_re($auth, [ '^sasl$', '^none$' ], 'Valid options for auth are none and sasl.') - Package['libvirt'] -> File_line<| path == '/etc/libvirt/libvirtd.conf' |> + Anchor['nova::config::begin'] + -> File_line<| tag == 'libvirt-file_line'|> + -> Anchor['nova::config::end'] + + File_line<| tag == 'libvirt-file_line' |> + ~> Service['libvirt'] case $::osfamily { 'RedHat': { file_line { '/etc/libvirt/libvirtd.conf listen_tls': - path => '/etc/libvirt/libvirtd.conf', - line => "listen_tls = ${listen_tls}", - match => 'listen_tls =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "listen_tls = ${listen_tls}", + match => 'listen_tls =', + tag => 'libvirt-file_line', } file_line { '/etc/libvirt/libvirtd.conf listen_tcp': - path => '/etc/libvirt/libvirtd.conf', - line => "listen_tcp = ${listen_tcp}", - match => 'listen_tcp =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "listen_tcp = ${listen_tcp}", + match => 'listen_tcp =', + tag => 'libvirt-file_line', } if $use_tls { file_line { '/etc/libvirt/libvirtd.conf auth_tls': - path => '/etc/libvirt/libvirtd.conf', - line => "auth_tls = \"${auth}\"", - match => 'auth_tls =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "auth_tls = \"${auth}\"", + match => 'auth_tls =', + tag => 'libvirt-file_line', } } else { file_line { '/etc/libvirt/libvirtd.conf auth_tcp': - path => '/etc/libvirt/libvirtd.conf', - line => "auth_tcp = \"${auth}\"", - match => 'auth_tcp =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "auth_tcp = \"${auth}\"", + match => 'auth_tcp =', + tag => 'libvirt-file_line', } } file_line { '/etc/sysconfig/libvirtd libvirtd args': - path => '/etc/sysconfig/libvirtd', - line => 'LIBVIRTD_ARGS="--listen"', - match => 'LIBVIRTD_ARGS=', - notify => Service['libvirt'], + path => '/etc/sysconfig/libvirtd', + line => 'LIBVIRTD_ARGS="--listen"', + match => 'LIBVIRTD_ARGS=', + tag => 'libvirt-file_line', } - - Package['libvirt'] -> File_line<| path == '/etc/sysconfig/libvirtd' |> } 'Debian': { file_line { '/etc/libvirt/libvirtd.conf listen_tls': - path => '/etc/libvirt/libvirtd.conf', - line => "listen_tls = ${listen_tls}", - match => 'listen_tls =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "listen_tls = ${listen_tls}", + match => 'listen_tls =', + tag => 'libvirt-file_line', } file_line { '/etc/libvirt/libvirtd.conf listen_tcp': - path => '/etc/libvirt/libvirtd.conf', - line => "listen_tcp = ${listen_tcp}", - match => 'listen_tcp =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "listen_tcp = ${listen_tcp}", + match => 'listen_tcp =', + tag => 'libvirt-file_line', } if $use_tls { file_line { '/etc/libvirt/libvirtd.conf auth_tls': - path => '/etc/libvirt/libvirtd.conf', - line => "auth_tls = \"${auth}\"", - match => 'auth_tls =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "auth_tls = \"${auth}\"", + match => 'auth_tls =', + tag => 'libvirt-file_line', } } else { file_line { '/etc/libvirt/libvirtd.conf auth_tcp': - path => '/etc/libvirt/libvirtd.conf', - line => "auth_tcp = \"${auth}\"", - match => 'auth_tcp =', - notify => Service['libvirt'], + path => '/etc/libvirt/libvirtd.conf', + line => "auth_tcp = \"${auth}\"", + match => 'auth_tcp =', + tag => 'libvirt-file_line', } } file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts": - path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}", - line => 'libvirtd_opts="-d -l"', - match => 'libvirtd_opts=', - notify => Service['libvirt'], + path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}", + line => 'libvirtd_opts="-d -l"', + match => 'libvirtd_opts=', + tag => 'libvirt-file_line', } - - Package['libvirt'] -> File_line<| path == "/etc/default/${::nova::compute::libvirt::libvirt_service_name}" |> } default: { diff --git a/manifests/network.pp b/manifests/network.pp index b1ccbb0f4..16e891779 100644 --- a/manifests/network.pp +++ b/manifests/network.pp @@ -105,6 +105,7 @@ class nova::network( $auto_assign_floating_ip = false, ) { + include ::nova::deps include ::nova::params # forward all ipv4 traffic diff --git a/manifests/network/bridge.pp b/manifests/network/bridge.pp index 885ee1b93..f01b17221 100644 --- a/manifests/network/bridge.pp +++ b/manifests/network/bridge.pp @@ -13,6 +13,7 @@ define nova::network::bridge ( $ip, $netmask = '255.255.255.0' ) { + include ::nova::deps case $::osfamily { diff --git a/manifests/network/flat.pp b/manifests/network/flat.pp index 6bbebdc01..ad2870e14 100644 --- a/manifests/network/flat.pp +++ b/manifests/network/flat.pp @@ -26,6 +26,8 @@ class nova::network::flat ( $flat_network_bridge = 'br100' ) { + include ::nova::deps + if $public_interface { nova_config { 'DEFAULT/public_interface': value => $public_interface } } diff --git a/manifests/network/flatdhcp.pp b/manifests/network/flatdhcp.pp index 76869007f..73d89d76a 100644 --- a/manifests/network/flatdhcp.pp +++ b/manifests/network/flatdhcp.pp @@ -51,8 +51,13 @@ class nova::network::flatdhcp ( $dhcpbridge_flagfile = '/etc/nova/nova.conf' ) { + include ::nova::deps + if $::osfamily == 'RedHat' and $::operatingsystem != 'Fedora' { - package { 'dnsmasq-utils': ensure => present } + package { 'dnsmasq-utils': + ensure => present, + tag => ['openstack', 'nova-support-package'], + } } if $public_interface { diff --git a/manifests/network/neutron.pp b/manifests/network/neutron.pp index 031b7f4e7..6dfed9717 100644 --- a/manifests/network/neutron.pp +++ b/manifests/network/neutron.pp @@ -112,6 +112,8 @@ class nova::network::neutron ( $dhcp_domain = 'novalocal', ) { + include ::nova::deps + nova_config { 'DEFAULT/dhcp_domain': value => $dhcp_domain; 'DEFAULT/firewall_driver': value => $firewall_driver; diff --git a/manifests/network/vlan.pp b/manifests/network/vlan.pp index 2328488a4..f3261b8b8 100644 --- a/manifests/network/vlan.pp +++ b/manifests/network/vlan.pp @@ -45,8 +45,13 @@ class nova::network::vlan ( $dhcpbridge_flagfile = '/etc/nova/nova.conf' ) { + include ::nova::deps + if $::osfamily == 'RedHat' and $::operatingsystem != 'Fedora' { - package { 'dnsmasq-utils': ensure => present } + package { 'dnsmasq-utils': + ensure => present, + tag => ['openstack', 'nova-support-package'], + } } if $public_interface { diff --git a/manifests/objectstore.pp b/manifests/objectstore.pp index 78077688d..03a46731a 100644 --- a/manifests/objectstore.pp +++ b/manifests/objectstore.pp @@ -27,6 +27,7 @@ class nova::objectstore( $bind_address = '0.0.0.0' ) { + include ::nova::deps include ::nova::params nova::generic_service { 'objectstore': @@ -35,7 +36,6 @@ class nova::objectstore( package_name => $::nova::params::objectstore_package_name, service_name => $::nova::params::objectstore_service_name, ensure_package => $ensure_package, - require => Package['nova-common'], } nova_config { diff --git a/manifests/policy.pp b/manifests/policy.pp index 40934028c..c82ad6253 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -30,7 +30,11 @@ class nova::policy ( validate_hash($policies) - $policy_defaults = { 'file_path' => $policy_path } + $policy_defaults = { + 'file_path' => $policy_path, + 'require' => Anchor['nova::config::begin'], + 'notify' => Anchor['nova::config::end'], + } create_resources('openstacklib::policy::base', $policies, $policy_defaults) diff --git a/manifests/quota.pp b/manifests/quota.pp index 8e14395c2..ec623b6ec 100644 --- a/manifests/quota.pp +++ b/manifests/quota.pp @@ -127,6 +127,7 @@ class nova::quota( $quota_max_injected_file_content_bytes = undef, $quota_max_injected_file_path_bytes = undef ) { + include ::nova::deps if $quota_volumes { warning('The quota_volumes parameter is deprecated and has no effect.') diff --git a/manifests/rabbitmq.pp b/manifests/rabbitmq.pp index 2b53013f0..f6e291b44 100644 --- a/manifests/rabbitmq.pp +++ b/manifests/rabbitmq.pp @@ -43,6 +43,8 @@ class nova::rabbitmq( $port ='5672', ) { + include ::nova::deps + if ($enabled) { if $userid == 'guest' { $delete_guest_user = false @@ -59,10 +61,13 @@ class nova::rabbitmq( write_permission => '.*', read_permission => '.*', provider => 'rabbitmqctl', - }->Anchor<| title == 'nova-start' |> + } } rabbitmq_vhost { $virtual_host: provider => 'rabbitmqctl', } } + + # Only start Nova after the queue is up + Class['nova::rabbitmq'] -> Anchor['nova::service::end'] } diff --git a/manifests/scheduler.pp b/manifests/scheduler.pp index 329eca0c3..64f66006d 100644 --- a/manifests/scheduler.pp +++ b/manifests/scheduler.pp @@ -27,6 +27,7 @@ class nova::scheduler( $scheduler_driver = 'nova.scheduler.filter_scheduler.FilterScheduler', ) { + include ::nova::deps include ::nova::db include ::nova::params @@ -41,7 +42,4 @@ class nova::scheduler( nova_config { 'DEFAULT/scheduler_driver': value => $scheduler_driver; } - - Nova_config['DEFAULT/scheduler_driver'] ~> Service <| title == 'nova-scheduler' |> - } diff --git a/manifests/scheduler/filter.pp b/manifests/scheduler/filter.pp index 03338d56b..061ee4f7d 100644 --- a/manifests/scheduler/filter.pp +++ b/manifests/scheduler/filter.pp @@ -82,6 +82,8 @@ class nova::scheduler::filter ( $scheduler_use_baremetal_filters = false, ) { + include ::nova::deps + nova_config { 'DEFAULT/scheduler_host_manager': value => $scheduler_host_manager; 'DEFAULT/scheduler_max_attempts': value => $scheduler_max_attempts; diff --git a/manifests/serialproxy.pp b/manifests/serialproxy.pp index 7e237ddc6..5df372876 100644 --- a/manifests/serialproxy.pp +++ b/manifests/serialproxy.pp @@ -32,6 +32,7 @@ class nova::serialproxy( $ensure_package = 'present' ) { + include ::nova::deps include ::nova::params nova_config { diff --git a/manifests/spicehtml5proxy.pp b/manifests/spicehtml5proxy.pp index 6960a25cc..0156e5d16 100644 --- a/manifests/spicehtml5proxy.pp +++ b/manifests/spicehtml5proxy.pp @@ -36,6 +36,7 @@ class nova::spicehtml5proxy( $ensure_package = 'present' ) { + include ::nova::deps include ::nova::params nova_config { diff --git a/manifests/vncproxy.pp b/manifests/vncproxy.pp index d70e33225..161253963 100644 --- a/manifests/vncproxy.pp +++ b/manifests/vncproxy.pp @@ -43,6 +43,7 @@ class nova::vncproxy( $ensure_package = 'present' ) { + include ::nova::deps include ::nova::params # See http://nova.openstack.org/runnova/vncconsole.html for more details. @@ -58,6 +59,7 @@ class nova::vncproxy( package { 'python-numpy': ensure => present, name => $::nova::params::numpy_package_name, + tag => ['openstack', 'nova-support-package'], } } nova::generic_service { 'vncproxy': diff --git a/manifests/vncproxy/common.pp b/manifests/vncproxy/common.pp index 15b46330d..bf3bc1a05 100644 --- a/manifests/vncproxy/common.pp +++ b/manifests/vncproxy/common.pp @@ -23,6 +23,8 @@ class nova::vncproxy::common ( $vncproxy_path = undef, ) { + include ::nova::deps + $vncproxy_host_real = pick( $vncproxy_host, $::nova::compute::vncproxy_host, diff --git a/spec/classes/nova_api_spec.rb b/spec/classes/nova_api_spec.rb index b0cdd8383..07c04e678 100644 --- a/spec/classes/nova_api_spec.rb +++ b/spec/classes/nova_api_spec.rb @@ -31,7 +31,8 @@ describe 'nova::api' do :ensure => 'present', :tag => ['openstack', 'nova-package'], ) - is_expected.to contain_package('nova-api').that_notifies('Service[nova-api]') + is_expected.to contain_package('nova-api').that_requires('Anchor[nova::install::begin]') + is_expected.to contain_package('nova-api').that_notifies('Anchor[nova::install::end]') is_expected.to_not contain_exec('validate_nova_api') end diff --git a/spec/classes/nova_client_spec.rb b/spec/classes/nova_client_spec.rb index 101cfe730..2db0be9b6 100644 --- a/spec/classes/nova_client_spec.rb +++ b/spec/classes/nova_client_spec.rb @@ -6,7 +6,7 @@ describe 'nova::client' do it { is_expected.to contain_package('python-novaclient').with( :ensure => 'present', - :tag => ['openstack'] + :tag => ['openstack', 'nova-support-package'] ) } end diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 030757336..403dd5f79 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -10,25 +10,34 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_class('nova::params')} - it { is_expected.to contain_package('nova-compute-kvm').with( - :ensure => 'present', - :before => 'Package[nova-compute]', - :tag => ['openstack'] - ) } + it { + is_expected.to contain_package('nova-compute-kvm').with( + :ensure => 'present', + :tag => ['openstack', 'nova-package'] + ) + is_expected.to contain_package('nova-compute-kvm').that_requires('Anchor[nova::install::begin]') + is_expected.to contain_package('nova-compute-kvm').that_notifies('Anchor[nova::install::end]') + } - it { is_expected.to contain_package('libvirt').with( - :name => 'libvirt-bin', - :ensure => 'present' - ) } + it { + is_expected.to contain_package('libvirt').with( + :name => 'libvirt-bin', + :ensure => 'present' + ) + is_expected.to contain_package('libvirt').that_requires('Anchor[nova::install::begin]') + is_expected.to contain_package('libvirt').that_comes_before('Anchor[nova::install::end]') + } - it { is_expected.to contain_service('libvirt').with( - :name => 'libvirt-bin', - :enable => true, - :ensure => 'running', - :provider => 'upstart', - :require => 'Package[libvirt]', - :before => ['Service[nova-compute]'] - )} + it { + is_expected.to contain_service('libvirt').with( + :name => 'libvirt-bin', + :enable => true, + :ensure => 'running', + :provider => 'upstart', + ) + + is_expected.to contain_service('libvirt').that_requires('Anchor[nova::config::end]') + } it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')} it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('kvm')} @@ -71,13 +80,15 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)} it { is_expected.to contain_nova_config('libvirt/remove_unused_kernels').with_value(true)} it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)} - it { is_expected.to contain_service('libvirt').with( - :name => 'custom_service', - :enable => true, - :ensure => 'running', - :require => 'Package[libvirt]', - :before => ['Service[nova-compute]'] - )} + it { + is_expected.to contain_service('libvirt').with( + :name => 'custom_service', + :enable => true, + :ensure => 'running', + :before => ['Service[nova-compute]'] + ) + is_expected.to contain_service('libvirt').that_requires('Anchor[nova::config::end]') + } end describe 'with custom cpu_mode' do @@ -164,7 +175,7 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_package('libvirt-nwfilter').with( :name => 'libvirt-daemon-config-nwfilter', :ensure => 'present', - :before => 'Service[libvirt]', + :before => ['Service[libvirt]', 'Anchor[nova::install::end]'], ) } it { is_expected.to contain_service('libvirt').with( @@ -172,8 +183,8 @@ describe 'nova::compute::libvirt' do :enable => true, :ensure => 'running', :provider => 'init', - :require => 'Package[libvirt]', - :before => ['Service[nova-compute]'] + :require => 'Anchor[nova::config::end]', + :before => ['Service[nova-compute]'], )} it { is_expected.to contain_service('messagebus').with( :ensure => 'running', @@ -294,7 +305,7 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_package('libvirt-nwfilter').with( :name => 'libvirt-daemon-config-nwfilter', :ensure => 'present', - :before => 'Service[libvirt]', + :before => ['Service[libvirt]', 'Anchor[nova::install::end]'], ) } it { is_expected.to contain_service('libvirt').with( @@ -302,7 +313,7 @@ describe 'nova::compute::libvirt' do :enable => true, :ensure => 'running', :provider => nil, - :require => 'Package[libvirt]', + :require => 'Anchor[nova::config::end]', :before => ['Service[nova-compute]'] )} diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index 0ac68669c..dc4afe17e 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -31,7 +31,6 @@ describe 'nova::compute' do it { is_expected.to_not contain_package('bridge-utils').with( :ensure => 'present', - :before => 'Nova::Generic_service[compute]' ) } it { is_expected.to contain_package('pm-utils').with( @@ -126,8 +125,9 @@ describe 'nova::compute' do it 'installs bridge-utils package for nova-network' do is_expected.to contain_package('bridge-utils').with( :ensure => 'present', - :before => 'Nova::Generic_service[compute]' ) + is_expected.to contain_package('bridge-utils').that_requires('Anchor[nova::install::begin]') + is_expected.to contain_package('bridge-utils').that_comes_before('Anchor[nova::install::end]') end end @@ -140,7 +140,6 @@ describe 'nova::compute' do it 'does not install bridge-utils package for nova-network' do is_expected.to_not contain_package('bridge-utils').with( :ensure => 'present', - :before => 'Nova::Generic_service[compute]' ) end diff --git a/spec/classes/nova_cron_archive_deleted_rows_spec.rb b/spec/classes/nova_cron_archive_deleted_rows_spec.rb index a615c51f6..fd6823921 100644 --- a/spec/classes/nova_cron_archive_deleted_rows_spec.rb +++ b/spec/classes/nova_cron_archive_deleted_rows_spec.rb @@ -27,7 +27,7 @@ describe 'nova::cron::archive_deleted_rows' do :monthday => params[:monthday], :month => params[:month], :weekday => params[:weekday], - :require => 'Package[nova-common]', + :require => 'Anchor[nova::dbsync::end]', ) end end diff --git a/spec/classes/nova_db_spec.rb b/spec/classes/nova_db_spec.rb index 62bc602bb..de74c4ccc 100644 --- a/spec/classes/nova_db_spec.rb +++ b/spec/classes/nova_db_spec.rb @@ -89,7 +89,7 @@ describe 'nova::db' do is_expected.to contain_package('nova-backend-package').with( :ensure => 'present', :name => 'python-pymysql', - :tag => 'openstack' + :tag => ['openstack', 'nova-package'], ) end end @@ -103,7 +103,7 @@ describe 'nova::db' do is_expected.to contain_package('nova-backend-package').with( :ensure => 'present', :name => 'python-pysqlite2', - :tag => 'openstack' + :tag => ['openstack', 'nova-package'], ) end diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 384d55702..dd98db699 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -13,7 +13,7 @@ describe 'nova' do it 'installs packages' do is_expected.to contain_package('python-nova').with( :ensure => 'present', - :tag => ['openstack'] + :tag => ['openstack', 'nova-package'] ) is_expected.to contain_package('nova-common').with( :name => platform_params[:nova_common_package], @@ -22,12 +22,6 @@ describe 'nova' do ) end - it 'creates various files and folders' do - is_expected.to contain_file('/etc/nova/nova.conf').with( - :require => 'Package[nova-common]' - ) - end - it 'configures rootwrap' do is_expected.to contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf') end diff --git a/spec/classes/nova_network_spec.rb b/spec/classes/nova_network_spec.rb index 44c9ee836..2224c229d 100644 --- a/spec/classes/nova_network_spec.rb +++ b/spec/classes/nova_network_spec.rb @@ -30,7 +30,7 @@ describe 'nova::network' do it { is_expected.to contain_package('nova-network').with( 'name' => 'nova-network', 'ensure' => 'present', - 'notify' => 'Service[nova-network]' + 'notify' => ['Anchor[nova::install::end]'], ) } describe 'with enabled as true' do diff --git a/spec/defines/nova_generic_service_spec.rb b/spec/defines/nova_generic_service_spec.rb index e66d1e783..c5ce7ce38 100644 --- a/spec/defines/nova_generic_service_spec.rb +++ b/spec/defines/nova_generic_service_spec.rb @@ -27,8 +27,11 @@ describe 'nova::generic_service' do 'enable' => true )} - it { is_expected.to contain_service('nova-foo').that_requires( - ['Package[nova-common]', 'Package[nova-foo]'] + it { is_expected.to contain_service('nova-foo').that_subscribes_to( + 'Anchor[nova::service::begin]', + )} + it { is_expected.to contain_service('nova-foo').that_notifies( + 'Anchor[nova::service::end]', )} end end diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb index d4a8e85c2..75e292156 100644 --- a/spec/shared_examples.rb +++ b/spec/shared_examples.rb @@ -9,11 +9,12 @@ shared_examples 'generic nova service' do |service| context 'with default parameters' do it 'installs package and service' do is_expected.to contain_package(service[:name]).with({ - :name => service[:package_name], - :ensure => 'present', - :notify => "Service[#{service[:name]}]", - :tag => ['openstack', 'nova-package'], + :name => service[:package_name], + :ensure => 'present', + :tag => ['openstack', 'nova-package'], }) + is_expected.to contain_package(service[:name]).that_requires('Anchor[nova::install::begin]') + is_expected.to contain_package(service[:name]).that_notifies('Anchor[nova::install::end]') is_expected.to contain_service(service[:name]).with({ :name => service[:service_name], :ensure => 'running', @@ -21,6 +22,8 @@ shared_examples 'generic nova service' do |service| :enable => true, :tag => 'nova-service', }) + is_expected.to contain_service(service[:name]).that_subscribes_to('Anchor[nova::service::begin]') + is_expected.to contain_service(service[:name]).that_notifies('Anchor[nova::service::end]') end end @@ -34,9 +37,10 @@ shared_examples 'generic nova service' do |service| is_expected.to contain_package(service[:name]).with({ :name => service[:package_name], :ensure => '2012.1-2', - :notify => "Service[#{service[:name]}]", :tag => ['openstack', 'nova-package'], }) + is_expected.to contain_package(service[:name]).that_requires('Anchor[nova::install::begin]') + is_expected.to contain_package(service[:name]).that_notifies('Anchor[nova::install::end]') is_expected.to contain_service(service[:name]).with({ :name => service[:service_name], :ensure => 'stopped', @@ -44,6 +48,8 @@ shared_examples 'generic nova service' do |service| :enable => false, :tag => 'nova-service', }) + is_expected.to contain_service(service[:name]).that_subscribes_to('Anchor[nova::service::begin]') + is_expected.to contain_service(service[:name]).that_notifies('Anchor[nova::service::end]') end end