Ensure iscsi-initiator-utils installed

We attempt to use iscsi-iname in an exec for our nova compute profile
but we do not ensure that the package providing this command is
installed. This change adds the package definition for
iscsi-initiator-utils to ensure it is installed before trying to use
iscsi-iname.

Change-Id: I1bfdb68170931fd05a09859cf8eefb50ed20915d
Closes-Bug: #1675462
(cherry picked from commit 2102a610c1)
This commit is contained in:
Alex Schultz 2017-03-23 09:58:34 -06:00 committed by Emilien Macchi
parent 00e4ad0bf0
commit 413a6947bf
2 changed files with 5 additions and 0 deletions

View File

@ -48,10 +48,12 @@ class tripleo::profile::base::nova::compute (
# When utilising images for deployment, we need to reset the iSCSI initiator name to make it unique
# https://bugzilla.redhat.com/show_bug.cgi?id=1244328
ensure_resource('package', 'iscsi-initiator-utils', { ensure => 'present' })
exec { 'reset-iscsi-initiator-name':
command => '/bin/echo InitiatorName=$(/usr/sbin/iscsi-iname) > /etc/iscsi/initiatorname.iscsi',
onlyif => '/usr/bin/test ! -f /etc/iscsi/.initiator_reset',
before => File['/etc/iscsi/.initiator_reset'],
require => Package['iscsi-initiator-utils'],
}
file { '/etc/iscsi/.initiator_reset':
ensure => present,

View File

@ -27,6 +27,7 @@ describe 'tripleo::profile::base::nova::compute' do
is_expected.to_not contain_class('tripleo::profile::base::nova')
is_expected.to_not contain_class('nova::compute')
is_expected.to_not contain_class('nova::network::neutron')
is_expected.to_not contain_package('iscsi-initiator-utils')
is_expected.to_not contain_exec('reset-iscsi-initiator-name')
is_expected.to_not contain_file('/etc/iscsi/.initiator_reset')
}
@ -51,6 +52,7 @@ eos
is_expected.to contain_class('tripleo::profile::base::nova')
is_expected.to contain_class('nova::compute')
is_expected.to contain_class('nova::network::neutron')
is_expected.to contain_package('iscsi-initiator-utils')
is_expected.to contain_exec('reset-iscsi-initiator-name')
is_expected.to contain_file('/etc/iscsi/.initiator_reset')
is_expected.to_not contain_package('nfs-utils')
@ -66,6 +68,7 @@ eos
is_expected.to contain_class('tripleo::profile::base::nova')
is_expected.to contain_class('nova::compute')
is_expected.to contain_class('nova::network::neutron')
is_expected.to contain_package('iscsi-initiator-utils')
is_expected.to contain_exec('reset-iscsi-initiator-name')
is_expected.to contain_file('/etc/iscsi/.initiator_reset')
is_expected.to contain_package('nfs-utils')