Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up legacy fact usage #94

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]) }

Check failure on line 24 in spec/classes/client_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet Spec (Puppet 8.x, ~> 8.0, 3.1, true)

krb5::client with supported operating systems on almalinux-8-x86_64 with default parameters is expected to contain Krb5::Setting::Realm[example.com] with admin_server => "foo.example.com" Failure/Error: it { is_expected.to create_krb5__setting__realm(facts[:networking][:domain]).with_admin_server(facts[:networking][:fqdn]) } Puppet::DataBinding::LookupError: Undefined variable 'spec_title' (file: /home/runner/work/pupmod-simp-krb5/pupmod-simp-krb5/spec/fixtures/hieradata/hiera.yaml, line: 9) on node fv-az695-574.gmayhch2cacunn5b1cp1zlasod.dx.internal.cloudapp.net
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'
Loading