Commit fc9856dd authored by Fabien Combernous's avatar Fabien Combernous

Merge branch...

Merge branch '88-module-is-not-idempotent-when-manage-admin-is-enable-but-hash-of-admin-is-empty' into 'master'

Resolve "module is not idempotent when manage admin is enable but hash of admin is empty"

Closes #88

See merge request !91
parents 0fdd55a4 24fbb4c6
Pipeline #4259 passed with stages
in 1 minute and 37 seconds
......@@ -108,7 +108,7 @@ class freeipa::install::server {
contain freeipa::helpers::flushcache
if $freeipa::enable_manage_admins {
if $freeipa::enable_manage_admins and $freeipa::humanadmins.length > 0 {
contain freeipa::config::keytab
class {'freeipa::config::humanadmins':
humanadmins => $freeipa::humanadmins,
......
require 'spec_helper_acceptance'
describe 'freeipa class' do
context 'with ipa_role master' do
describe 'class freeipa' do
context 'with ipa_role master and no humanadmins defined' do
hosts_as('master').each do |master|
it 'applies idempotently' do
pp = <<-EOS
class { 'freeipa':
ipa_role => 'master',
domain => 'example.lan',
ipa_server_fqdn => 'ipa-server-1.example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
install_ipa_server => true,
ip_address => '10.10.10.35',
enable_ip_address => true,
enable_hostname => true,
enable_manage_admins => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan',
humanadmins => {
foo => {
ensure => 'present',
password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
},
bar => {
password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
ensure => 'present',
},
pp = <<-EOS
class { 'freeipa':
ipa_role => 'master',
domain => 'example.lan',
ipa_server_fqdn => 'ipa-server-1.example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
install_ipa_server => true,
ip_address => '10.10.10.35',
enable_ip_address => true,
enable_hostname => true,
enable_manage_admins => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan',
humanadmins => {},
}
EOS
it 'installs master without error' do
apply_manifest_on(master, pp, catch_failures: true)
end
it 'installs master idempotently' do
apply_manifest_on(master, pp, catch_changes: true)
end
describe command('ipactl status') do
its(:exit_status) { is_expected.to be 0 }
end
end
end
context 'with ipa_role master and some humanadmins defined' do
hosts_as('master').each do |master|
pp = <<-EOS
class { 'freeipa':
ipa_role => 'master',
domain => 'example.lan',
ipa_server_fqdn => 'ipa-server-1.example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
install_ipa_server => true,
ip_address => '10.10.10.35',
enable_ip_address => true,
enable_hostname => true,
enable_manage_admins => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan',
humanadmins => {
foo => {
ensure => 'present',
password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
},
}
EOS
bar => {
password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
ensure => 'present',
},
},
}
EOS
it 'creates humanadmins without error' do
apply_manifest_on(master, pp, catch_failures: true)
end
it 'creates humanadmins idempotently' do
apply_manifest_on(master, pp, catch_changes: true)
end
......
require 'spec_helper'
describe 'freeipa::config::keytab' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:pre_condition) do
manifest = <<-EOS
class{ 'freeipa' :
ipa_role => 'master',
ipa_master_fqdn => 'master.example.lan',
ipa_server_fqdn => 'foo.example.lan',
domain => 'example.lan',
password_usedto_joindomain => 'foobartest',
puppet_admin_password => 'foobartest',
directory_services_password => 'foobartest',
ip_address => '10.10.10.35',
}
EOS
manifest
end
let(:facts) { os_facts }
it { is_expected.to compile }
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment