Merge "Fix novajoin FreeIPA server parameter"

This commit is contained in:
Zuul 2018-04-13 14:48:15 +00:00 committed by Gerrit Code Review
commit 4076b2a48d
2 changed files with 18 additions and 4 deletions

View File

@ -176,6 +176,13 @@ class nova::metadata::novajoin::api (
if $enable_ipa_client_install {
require ::ipaclient
# If we're installing IPA here, the hostname fact won't be populated yet,
# so we'll use a command to get it.
$ipa_hostname_real = '`grep xmlrpc_uri /etc/ipa/default.conf | cut -d/ -f3`'
} else {
# This assumes that the current node is already IPA enrolled, so the
# fact will work here.
$ipa_hostname_real = $::ipa_hostname
}
package { 'python-novajoin':
@ -262,7 +269,7 @@ class nova::metadata::novajoin::api (
}
exec { 'get-service-user-keytab':
command => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ${::ipa_hostname} \
command => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ${ipa_hostname_real} \
-p nova/${::fqdn} -k ${keytab}",
creates => $keytab,
}

View File

@ -131,10 +131,17 @@ describe 'nova::metadata::novajoin::api' do
end
it 'is_expected.to get service user keytab' do
is_expected.to contain_exec('get-service-user-keytab').with(
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ipa.ipadomain \
if param_hash[:enable_ipa_client_install]
is_expected.to contain_exec('get-service-user-keytab').with(
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s `grep xmlrpc_uri /etc/ipa/default.conf | cut -d/ -f3` \
-p nova/undercloud.example.com -k #{param_hash[:keytab]}",
)
)
else
is_expected.to contain_exec('get-service-user-keytab').with(
'command' => "/usr/bin/kinit -kt /etc/krb5.keytab && ipa-getkeytab -s ipa.ipadomain \
-p nova/undercloud.example.com -k #{param_hash[:keytab]}",
)
end
end
it { is_expected.to contain_file("/var/log/novajoin").with(