Fix resources for latest puppet

Running the unit tests under the latest puppet fails because of
undefined resources. This change updates the references to use
collectors if they are optional or change the definitions in the files
for resources that are defined in the existing class.

Change-Id: Ic91a8d577675fd1f2fb21543320426bfe49b1a2e
Closes-Bug: #1702964
This commit is contained in:
Alex Schultz 2017-08-01 13:45:30 -06:00
parent a46b8f4827
commit ca1bdcfd7b
4 changed files with 19 additions and 17 deletions

View File

@ -31,18 +31,6 @@ class nova::compute::libvirt::services (
include ::nova::params
if $libvirt_service_name {
# messagebus
if($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora') {
service { 'messagebus':
ensure => running,
enable => true,
name => $::nova::params::messagebus_service_name,
provider => $::nova::params::special_service_provider,
}
Package['libvirt'] -> Service['messagebus'] -> Service['libvirt']
}
# libvirt-nwfilter
if $::osfamily == 'RedHat' {
package { 'libvirt-nwfilter':
@ -80,6 +68,17 @@ class nova::compute::libvirt::services (
require => Package['libvirt'],
}
# messagebus
if($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora') {
service { 'messagebus':
ensure => running,
enable => true,
name => $::nova::params::messagebus_service_name,
provider => $::nova::params::special_service_provider,
}
Package['libvirt'] -> Service['messagebus'] -> Service['libvirt']
}
# when nova-compute & libvirt run together
Service['libvirt'] -> Service<| title == 'nova-compute'|>
}
@ -91,8 +90,8 @@ class nova::compute::libvirt::services (
enable => true,
name => $virtlock_service_name,
provider => $::nova::params::special_service_provider,
require => Package['libvirt']
}
Package<| name == 'libvirt' |> -> Service['virtlockd']
}
if $virtlog_service_name {
@ -101,8 +100,8 @@ class nova::compute::libvirt::services (
enable => true,
name => $virtlog_service_name,
provider => $::nova::params::special_service_provider,
require => Package['libvirt']
}
Package<| name == 'libvirt' |> -> Service['virtlogd']
}
}

View File

@ -108,8 +108,9 @@ class nova::compute::rbd (
exec { 'get-or-set virsh secret':
command => $cm,
unless => "/usr/bin/virsh secret-list | grep -i ${libvirt_rbd_secret_uuid}",
require => [File['/etc/nova/secret.xml'], Service['libvirt']],
require => File['/etc/nova/secret.xml'],
}
Service<| title == 'libvirt' |> -> Exec['get-or-set virsh secret']
if $libvirt_rbd_secret_key {
$libvirt_key = $libvirt_rbd_secret_key

View File

@ -28,6 +28,8 @@ class nova::policy (
$policy_path = '/etc/nova/policy.json',
) {
include ::nova::deps
validate_hash($policies)
$policy_defaults = {

View File

@ -90,7 +90,7 @@ describe 'nova::compute::rbd' do
is_expected.to contain_exec('get-or-set virsh secret').with(
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
:unless => '/usr/bin/virsh secret-list | grep -i UUID',
:require => ['File[/etc/nova/secret.xml]', 'Service[libvirt]'],
:require => 'File[/etc/nova/secret.xml]',
)
is_expected.to contain_exec('set-secret-value virsh').with(
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
@ -141,7 +141,7 @@ describe 'nova::compute::rbd' do
is_expected.to contain_exec('get-or-set virsh secret').with(
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
:unless => '/usr/bin/virsh secret-list | grep -i UUID',
:require => ['File[/etc/nova/secret.xml]', 'Service[libvirt]'],
:require => 'File[/etc/nova/secret.xml]',
)
is_expected.to contain_exec('set-secret-value virsh').with(
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"