Skip to content

Commit

Permalink
Clean up legacy fact usage (#94)
Browse files Browse the repository at this point in the history
* Clean up legacy fact usage

* Version bump and CHANGELOG addition
  • Loading branch information
silug authored Jul 8, 2024
1 parent 7a6ddeb commit 317bac7
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Wed Jul 03 2024 Steven Pritchard <[email protected]> - 7.7.2
- Clean up legacy fact usage to support puppet 8

* Wed Jan 17 2024 Richard Gardner <[email protected]> - 7.7.1
- Updated hiera.yaml facts to support puppet 8

Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@

#### Table of Contents

1. [Module Description - What the module does and why it is useful](#module-description)
2. [Setup - The basics of getting started with Krb5](#setup)
* [What Krb5 affects](#what-krb5-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with Krb5](#beginning-with-krb5)
3. [Usage - Configuration options and additional functionality](#usage)
* [Automatic Management](#automatically-manage-the-kdc-and-keytabs-on-clients)
* [Manual Configuration](#manual-configuration-and-expansion)
4. [Integration with SIMP NFS Module](#integration-with-simp-nfs-module)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
7. [Acceptance Tests](#acceptance-tests)
- [Krb5](#krb5)
- [Table of Contents](#table-of-contents)
- [Module Description](#module-description)
- [Setup](#setup)
- [What krb5 affects](#what-krb5-affects)
- [Setup Requirements](#setup-requirements)
- [Beginning with krb5](#beginning-with-krb5)
- [Usage](#usage)
- [Automatically manage the KDC and keytabs on clients](#automatically-manage-the-kdc-and-keytabs-on-clients)
- [Keytab Propagation](#keytab-propagation)
- [Manual Configuration and Expansion](#manual-configuration-and-expansion)
- [Creating Admin Principals](#creating-admin-principals)
- [ACL Configuration](#acl-configuration)
- [Create Your Admin Principal](#create-your-admin-principal)
- [Creating Host Principals](#creating-host-principals)
- [Create Your Keytabs](#create-your-keytabs)
- [Integration with SIMP NFS Module](#integration-with-simp-nfs-module)
- [Limitations](#limitations)
- [Development](#development)
- [Acceptance tests](#acceptance-tests)

## Module Description

Expand Down Expand Up @@ -163,8 +171,8 @@ is **probably** appropriate for your organization.

```ruby
krb5_acl{ "${::domain}_admin":
principal => "*/admin@${::domain}",
krb5_acl{ "${facts['networking']['domain']}_admin":
principal => "*/admin@${facts['networking']['domain']}",
operation_mask => '*'
}
```
Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ Default value: `true`

The realms under which the hosts should be generated

Default value: `Facter.value(:domain)`
Default value: `Facter.value(:networking)['domain']`

##### <a name="-krb5kdc_auto_keytabs--user"></a>`user`

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/krb5kdc_auto_keytabs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
The realms under which the hosts should be generated
DESC

defaultto(Facter.value(:domain))
defaultto(Facter.value(:networking)['domain'])

validate do |value|
unless (value.is_a?(String) || value.is_a?(Array)) || Array(value).count { |x| !x.is_a?(String) }.zero?
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-krb5",
"version": "7.7.1",
"version": "7.7.2",
"author": "SIMP Team",
"summary": "Puppet management of the MIT kerberos stack",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
it_behaves_like 'common config'

# Based on the Hiera default.yaml
it { is_expected.to create_krb5__setting__realm(facts[:domain]).with_admin_server(facts[:fqdn]) }
it { is_expected.to create_krb5__setting__realm(facts[:networking][:domain]).with_admin_server(facts[:networking][:fqdn]) }
end

context 'with krb5::kdc declared' do
Expand All @@ -32,7 +32,7 @@
it_behaves_like 'common config'

# Based on the Hiera default.yaml
it { is_expected.to create_krb5__setting__realm(facts[:domain]).with_admin_server(facts[:fqdn]) }
it { is_expected.to create_krb5__setting__realm(facts[:networking][:domain]).with_admin_server(facts[:networking][:fqdn]) }
end

context 'when passed a custom set of realms' do
Expand All @@ -53,7 +53,7 @@
it_behaves_like 'common config'

# Based on the Hiera default.yaml
it { is_expected.not_to create_krb5__setting__realm(facts[:domain]).with_admin_server(facts[:fqdn]) }
it { is_expected.not_to create_krb5__setting__realm(facts[:networking][:domain]).with_admin_server(facts[:networking][:fqdn]) }

it { is_expected.to create_krb5__setting__realm('realm.one').with_admin_server('admin.server.one') }

Expand Down
12 changes: 6 additions & 6 deletions spec/classes/kdc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
it { is_expected.to create_class('krb5::kdc::install') }
it { is_expected.to create_class('krb5::kdc::config') }
it { is_expected.to create_class('krb5::kdc::service') }
it { is_expected.to create_krb5__kdc__realm(facts[:domain]) }
it { is_expected.to create_krb5__setting__realm(facts[:domain]) }
it { is_expected.to create_krb5__kdc__realm(facts[:networking][:domain]) }
it { is_expected.to create_krb5__setting__realm(facts[:networking][:domain]) }
it { is_expected.to contain_class('krb5::kdc::auto_keytabs') }

it_behaves_like 'auto_keytab'
Expand All @@ -31,7 +31,7 @@
end

shared_examples_for 'auto_keytab' do
it { is_expected.to create_krb5kdc_auto_keytabs('__default__').with(:realms => facts[:domain]) }
it { is_expected.to create_krb5kdc_auto_keytabs('__default__').with(:realms => facts[:networking][:domain]) }
end

shared_examples_for 'selinux hotfix' do
Expand Down Expand Up @@ -62,7 +62,7 @@
it { is_expected.not_to contain_package('krb5-server-ldap') }
it { is_expected.not_to contain_class('krb5::kdc::firewall') }

if os_facts[:selinux]
unless os_facts.dig(:os, 'selinux').nil?
it { is_expected.to contain_class('krb5::kdc::selinux_hotfix') }
end
end
Expand All @@ -71,7 +71,7 @@
let(:params) { { :firewall => true, :haveged => true, :ldap => true } }

it_behaves_like 'common kdc config'
if os_facts[:selinux]
unless os_facts.dig(:os, 'selinux').nil?
it_behaves_like 'selinux hotfix'
end
it { is_expected.to contain_class('haveged') }
Expand All @@ -87,7 +87,7 @@
end

it_behaves_like 'common kdc config'
if os_facts[:selinux]
unless os_facts.dig(:os, 'selinux').nil?
it_behaves_like 'selinux hotfix'
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/setting/realm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

let(:params) do
{
:admin_server => facts[:hostname]
:admin_server => facts[:networking][:hostname]
}
end

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/hieradata/default.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
simp_options::puppet::server: "%{facts.fqdn}"
simp_options::puppet::server: "%{facts.networking.fqdn}"
simp_options::trusted_nets:
- '1.2.3.4/32'

0 comments on commit 317bac7

Please sign in to comment.