From 194e18dcab32d2f122dda2bf43db1a6a62a655bd Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 20 Nov 2023 23:07:13 +0100 Subject: [PATCH 1/2] Fix lens filename in postfix::canonical Also adds an acceptance test to verify it actually works. Fixes: 2d8880c5463981ab129f4ab1d92db3f1751626dc ("add support for generating canonical maps") --- manifests/canonical.pp | 2 +- spec/acceptance/canonical_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 spec/acceptance/canonical_spec.rb diff --git a/manifests/canonical.pp b/manifests/canonical.pp index 2a2b6706..d34e7f1d 100644 --- a/manifests/canonical.pp +++ b/manifests/canonical.pp @@ -66,7 +66,7 @@ augeas { "Postfix canonical - ${name}": incl => $_file, - lens => 'Postfix_Canonical.lns', + lens => 'postfix_canonical.lns', changes => $changes, require => Package['postfix'], notify => Exec["generate ${_file}.${lookup_table_suffix}"], diff --git a/spec/acceptance/canonical_spec.rb b/spec/acceptance/canonical_spec.rb new file mode 100644 index 00000000..cad05588 --- /dev/null +++ b/spec/acceptance/canonical_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'spec_helper_acceptance' + +describe 'postfix::canonical' do + it_behaves_like 'an idempotent resource' do + let(:manifest) do + <<~PUPPET + include postfix + postfix::hash { '/etc/postfix/recipient_canonical': + ensure => present, + } + postfix::config { 'canonical_alias_maps': + value => 'hash:/etc/postfix/recipient_canonical', + } + postfix::canonical { 'user@example.com': + file => '/etc/postfix/recipient_canonical', + ensure => present, + destination => 'root', + } + PUPPET + end + end +end From 84a211ba40523dda73b64746d60cf585d777727b Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 20 Nov 2023 23:10:50 +0100 Subject: [PATCH 2/2] Remove camptocamp/augeas dependency This places the lenses in lib/augeas/lenses so Puppet automatically loads them. This removes the need for the unmaintained camptocamp/augeas module. --- REFERENCE.md | 1 - .../augeas}/lenses/postfix_canonical.aug | 0 .../augeas}/lenses/test_postfix_canonical.aug | 0 manifests/augeas.pp | 16 ---------------- manifests/canonical.pp | 1 - metadata.json | 4 ---- 6 files changed, 22 deletions(-) rename {files => lib/augeas}/lenses/postfix_canonical.aug (100%) rename {files => lib/augeas}/lenses/test_postfix_canonical.aug (100%) delete mode 100644 manifests/augeas.pp diff --git a/REFERENCE.md b/REFERENCE.md index 6d61a2de..bbc59bf3 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -12,7 +12,6 @@ #### Private Classes -* `postfix::augeas`: Provides augeas lenses for postfix files * `postfix::files`: Manages the Postfix related files * `postfix::ldap`: Provides the Postfix LDAP support * `postfix::mailman`: Configure Postfix to work with mailman diff --git a/files/lenses/postfix_canonical.aug b/lib/augeas/lenses/postfix_canonical.aug similarity index 100% rename from files/lenses/postfix_canonical.aug rename to lib/augeas/lenses/postfix_canonical.aug diff --git a/files/lenses/test_postfix_canonical.aug b/lib/augeas/lenses/test_postfix_canonical.aug similarity index 100% rename from files/lenses/test_postfix_canonical.aug rename to lib/augeas/lenses/test_postfix_canonical.aug diff --git a/manifests/augeas.pp b/manifests/augeas.pp deleted file mode 100644 index 3ea11b23..00000000 --- a/manifests/augeas.pp +++ /dev/null @@ -1,16 +0,0 @@ -# @summary Provides augeas lenses for postfix files -# -# This class provides the augeas lenses used by the postfix class -# -# @api private -# -class postfix::augeas { - assert_private() - - $module_path = get_module_path($module_name) - augeas::lens { 'postfix_canonical': - ensure => present, - lens_content => file("${module_path}/files/lenses/postfix_canonical.aug"), - test_content => file("${module_path}/files/lenses/test_postfix_canonical.aug"), - } -} diff --git a/manifests/canonical.pp b/manifests/canonical.pp index d34e7f1d..d769b01c 100644 --- a/manifests/canonical.pp +++ b/manifests/canonical.pp @@ -43,7 +43,6 @@ String[1] $lookup_table_suffix = 'db', ) { include postfix - include postfix::augeas $_file = pick($file, "${postfix::confdir}/canonical") diff --git a/metadata.json b/metadata.json index f3f74815..7abcf9c0 100644 --- a/metadata.json +++ b/metadata.json @@ -12,10 +12,6 @@ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.13.0 < 10.0.0" }, - { - "name": "camptocamp/augeas", - "version_requirement": ">= 1.0.0 < 2.0.0" - }, { "name": "puppet/alternatives", "version_requirement": ">= 2.0.0 < 6.0.0"