From 1a768d4d017d1a44de3a3e5400b2ec6405544f09 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 1 Nov 2023 12:17:16 +0900 Subject: [PATCH] Debian/Ubuntu: Fix missing nova-compute-ironic This package should be installed to use ironic virt driver. Closes-Bug: #2042383 Change-Id: I3b7ac19b347f3a5deb68d724de32246bb8dc1075 --- manifests/compute/ironic.pp | 14 ++++++++++- .../notes/bug-2042383-76b5bd1579f9310d.yaml | 5 ++++ spec/classes/nova_compute_ironic_spec.rb | 25 +++++++++++-------- 3 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/bug-2042383-76b5bd1579f9310d.yaml diff --git a/manifests/compute/ironic.pp b/manifests/compute/ironic.pp index 8094ac3ca..654d9c75f 100644 --- a/manifests/compute/ironic.pp +++ b/manifests/compute/ironic.pp @@ -4,18 +4,30 @@ # # === Parameters: # +# [*ensure_package*] +# (optional) The state of nova packages +# Defaults to 'present' +# # [*compute_driver*] # (optional) Compute driver. # Defaults to 'ironic.IronicDriver' # class nova::compute::ironic ( - $compute_driver = 'ironic.IronicDriver', + $ensure_package = 'present', + $compute_driver = 'ironic.IronicDriver', ) { include nova::deps require nova::ironic::common include ironic::client + if($facts['os']['family'] == 'Debian') { + package { 'nova-compute-ironic': + ensure => $ensure_package, + tag => ['openstack', 'nova-package'], + } + } + nova_config { 'DEFAULT/compute_driver': value => $compute_driver; } diff --git a/releasenotes/notes/bug-2042383-76b5bd1579f9310d.yaml b/releasenotes/notes/bug-2042383-76b5bd1579f9310d.yaml new file mode 100644 index 000000000..485d17a22 --- /dev/null +++ b/releasenotes/notes/bug-2042383-76b5bd1579f9310d.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Now the ``nova::compute::ironic`` class installs + the ``nova-compute-ironic`` package in Debian or Ubuntu. diff --git a/spec/classes/nova_compute_ironic_spec.rb b/spec/classes/nova_compute_ironic_spec.rb index f4786994a..54015535c 100644 --- a/spec/classes/nova_compute_ironic_spec.rb +++ b/spec/classes/nova_compute_ironic_spec.rb @@ -2,8 +2,7 @@ require 'spec_helper' describe 'nova::compute::ironic' do - shared_examples_for 'nova-compute-ironic' do - + shared_examples_for 'nova::compute::ironic' do context 'with default parameters' do it 'configures ironic in nova.conf' do is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('ironic.IronicDriver') @@ -30,6 +29,17 @@ describe 'nova::compute::ironic' do end end + shared_examples_for 'nova::compute::ironic in Debian' do + context 'with default parameters' do + it 'installs nova-compute-ironic' do + is_expected.to contain_package('nova-compute-ironic').with( + :ensure => 'present', + :tag => ['openstack', 'nova-package'], + ) + end + end + end + on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| @@ -38,15 +48,10 @@ describe 'nova::compute::ironic' do facts.merge!(OSDefaults.get_facts()) end - let(:platform_params) do - case facts[:os]['family'] - when 'Debian' - {} - when 'RedHat' - {} - end + it_configures 'nova::compute::ironic' + if facts[:os]['family'] == 'Debian' + it_configures 'nova::compute::ironic in Debian' end - it_configures 'nova-compute-ironic' end end end