From ae48810911030cc510db95df82ddb638f65cb604 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 30 Apr 2020 01:17:23 +0900 Subject: [PATCH] Refactor management of ironic-inspector-dnsmasq package Change-Id: I114e55d97043140596cbc187aa6d31e3e14c306b --- manifests/inspector.pp | 11 ++++++++++- manifests/params.pp | 4 +++- spec/classes/ironic_inspector_spec.rb | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/manifests/inspector.pp b/manifests/inspector.pp index a215a9a0..369dcb54 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -424,8 +424,17 @@ Use ironic::inspector::ironic::endpoint_override instead.') # Install package if $::ironic::params::inspector_package { - package { $::ironic::params::inspector_package: + package { 'ironic-inspector': ensure => $package_ensure, + name => $::ironic::params::inspector_package, + tag => ['openstack', 'ironic-inspector-package'], + } + } + + if $::ironic::params::inspector_dnsmasq_package { + package { 'ironic-inspector-dnsmasq': + ensure => $package_ensure, + name => $::ironic::params::inspector_dnsmasq_package, tag => ['openstack', 'ironic-inspector-package'], } } diff --git a/manifests/params.pp b/manifests/params.pp index be50d022..eb2b3d2a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -53,7 +53,8 @@ class ironic::params { $api_service = 'openstack-ironic-api' $conductor_package = 'openstack-ironic-conductor' $conductor_service = 'openstack-ironic-conductor' - $inspector_package = ['openstack-ironic-inspector', 'openstack-ironic-inspector-dnsmasq'] + $inspector_package = 'openstack-ironic-inspector' + $inspector_dnsmasq_package = 'openstack-ironic-inspector-dnsmasq' $inspector_service = 'openstack-ironic-inspector' $inspector_dnsmasq_service = 'openstack-ironic-inspector-dnsmasq' $staging_drivers_package = 'openstack-ironic-staging-drivers' @@ -78,6 +79,7 @@ class ironic::params { $conductor_service = 'ironic-conductor' $conductor_package = 'ironic-conductor' $inspector_package = 'ironic-inspector' + $inspector_dnsmasq_package = false $inspector_service = 'ironic-inspector' # it seems like there is not currently a builtin dnsmasq in the debian packaging # https://packages.debian.org/source/experimental/ironic-inspector diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index 8a757147..9d2f3743 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -85,11 +85,22 @@ describe 'ironic::inspector' do if platform_params.has_key?(:inspector_package) is_expected.to contain_package('ironic-inspector').with( :ensure => p[:package_ensure], + :name => platform_params[:inspector_package], :tag => ['openstack', 'ironic-inspector-package'], ) is_expected.to contain_package('ironic-inspector').that_requires('Anchor[ironic-inspector::install::begin]') is_expected.to contain_package('ironic-inspector').that_notifies('Anchor[ironic-inspector::install::end]') end + + if platform_params.has_key?(:inspector_dnsmasq_package) + is_expected.to contain_package('ironic-inspector-dnsmasq').with( + :ensure => p[:package_ensure], + :name => platform_params[:inspector_dnsmasq_package], + :tag => ['openstack', 'ironic-inspector-package'], + ) + is_expected.to contain_package('ironic-inspector-dnsmasq').that_requires('Anchor[ironic-inspector::install::begin]') + is_expected.to contain_package('ironic-inspector-dnsmasq').that_notifies('Anchor[ironic-inspector::install::end]') + end end it 'ensure ironic inspector service is running' do @@ -361,7 +372,9 @@ describe 'ironic::inspector' do { :inspector_package => 'ironic-inspector', :inspector_service => 'ironic-inspector' } when 'RedHat' - { :inspector_service => 'ironic-inspector' } + { :inspector_package => 'openstack-ironic-inspector', + :inspector_dnsmasq_package => 'openstack-ironic-inspector-dnsmasq', + :inspector_service => 'ironic-inspector' } end end