Skip to content

Commit

Permalink
Fix top scope variables and legacy facts
Browse files Browse the repository at this point in the history
  • Loading branch information
smoeding committed Apr 12, 2023
1 parent 2447b2d commit a3247d1
Show file tree
Hide file tree
Showing 29 changed files with 87 additions and 85 deletions.
4 changes: 2 additions & 2 deletions manifests/access/entry.pp
Expand Up @@ -39,9 +39,9 @@
'absent' => "rm key[ . = '${key}']",
}

augeas { "${::sendmail::params::access_file}-${title}":
augeas { "${sendmail::params::access_file}-${title}":
lens => 'Sendmail_Map.lns',
incl => $::sendmail::params::access_file,
incl => $sendmail::params::access_file,
changes => $changes,
require => Class['sendmail::access::file'],
notify => Class['sendmail::makeall'],
Expand Down
6 changes: 3 additions & 3 deletions manifests/access/file.pp
Expand Up @@ -16,12 +16,12 @@
include sendmail::params
include sendmail::makeall

file { $::sendmail::params::access_file:
file { $sendmail::params::access_file:
ensure => file,
content => $content,
source => $source,
owner => $::sendmail::params::sendmail_user,
group => $::sendmail::params::sendmail_group,
owner => $sendmail::params::sendmail_user,
group => $sendmail::params::sendmail_group,
mode => '0640',
notify => Class['sendmail::makeall'],
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/aliases/file.pp
Expand Up @@ -15,12 +15,12 @@
include sendmail::params
include sendmail::aliases::newaliases

file { $::sendmail::params::alias_file:
file { $sendmail::params::alias_file:
ensure => file,
content => $content,
source => $source,
owner => 'root',
group => $::sendmail::params::alias_file_group,
group => $sendmail::params::alias_file_group,
mode => '0644',
notify => Class['sendmail::aliases::newaliases'],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/aliases/newaliases.pp
Expand Up @@ -10,7 +10,7 @@
include sendmail::params

exec { 'sendmail::aliases::newaliases':
command => "${::sendmail::params::sendmail_binary} -bi",
command => "${sendmail::params::sendmail_binary} -bi",
refreshonly => true,
}
}
4 changes: 2 additions & 2 deletions manifests/authinfo/entry.pp
Expand Up @@ -100,9 +100,9 @@
'absent' => "rm key[ . = '${key}']",
}

augeas { "${::sendmail::params::authinfo_file}-${key}":
augeas { "${sendmail::params::authinfo_file}-${key}":
lens => 'Sendmail_Map.lns',
incl => $::sendmail::params::authinfo_file,
incl => $sendmail::params::authinfo_file,
changes => $changes,
require => Class['sendmail::authinfo::file'],
notify => Class['sendmail::makeall'],
Expand Down
4 changes: 2 additions & 2 deletions manifests/authinfo/file.pp
Expand Up @@ -15,12 +15,12 @@
include sendmail::params
include sendmail::makeall

file { $::sendmail::params::authinfo_file:
file { $sendmail::params::authinfo_file:
ensure => file,
content => $content,
source => $source,
owner => 'root',
group => $::sendmail::params::sendmail_group,
group => $sendmail::params::sendmail_group,
mode => '0600',
notify => Class['sendmail::makeall'],
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/domaintable/entry.pp
Expand Up @@ -36,9 +36,9 @@
'absent' => "rm key[ . = '${key}']",
}

augeas { "${::sendmail::params::domaintable_file}-${title}":
augeas { "${sendmail::params::domaintable_file}-${title}":
lens => 'Sendmail_Map.lns',
incl => $::sendmail::params::domaintable_file,
incl => $sendmail::params::domaintable_file,
changes => $changes,
require => Class['sendmail::domaintable::file'],
notify => Class['sendmail::makeall'],
Expand Down
6 changes: 3 additions & 3 deletions manifests/domaintable/file.pp
Expand Up @@ -15,12 +15,12 @@
include sendmail::params
include sendmail::makeall

file { $::sendmail::params::domaintable_file:
file { $sendmail::params::domaintable_file:
ensure => file,
content => $content,
source => $source,
owner => $::sendmail::params::sendmail_user,
group => $::sendmail::params::sendmail_group,
owner => $sendmail::params::sendmail_user,
group => $sendmail::params::sendmail_group,
mode => '0640',
notify => Class['sendmail::makeall'],
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/genericstable/entry.pp
Expand Up @@ -41,9 +41,9 @@
'absent' => "rm key[ . = '${key}']",
}

augeas { "${::sendmail::params::genericstable_file}-${title}":
augeas { "${sendmail::params::genericstable_file}-${title}":
lens => 'Sendmail_Map.lns',
incl => $::sendmail::params::genericstable_file,
incl => $sendmail::params::genericstable_file,
changes => $changes,
require => Class['sendmail::genericstable::file'],
notify => Class['sendmail::makeall'],
Expand Down
6 changes: 3 additions & 3 deletions manifests/genericstable/file.pp
Expand Up @@ -15,12 +15,12 @@
include sendmail::params
include sendmail::makeall

file { $::sendmail::params::genericstable_file:
file { $sendmail::params::genericstable_file:
ensure => file,
content => $content,
source => $source,
owner => $::sendmail::params::sendmail_user,
group => $::sendmail::params::sendmail_group,
owner => $sendmail::params::sendmail_user,
group => $sendmail::params::sendmail_group,
mode => '0640',
notify => Class['sendmail::makeall'],
}
Expand Down
10 changes: 5 additions & 5 deletions manifests/init.pp
Expand Up @@ -181,8 +181,8 @@
Boolean $enable_ipv4_daemon = true,
Boolean $enable_ipv6_daemon = true,
Hash[String,Data] $features = {},
Array[String] $mailers = $::sendmail::params::mailers,
Array[String] $local_host_names = [ $::fqdn ],
Array[String] $mailers = $sendmail::params::mailers,
Array[String] $local_host_names = [ $facts['networking']['fqdn'] ],
Array[String] $relay_domains = [],
Array[String] $trusted_users = [],
Optional[Variant[String,Array[String]]] $trust_auth_mech = undef,
Expand All @@ -209,10 +209,10 @@
Boolean $enable_msp_trusted_users = false,
Boolean $manage_sendmail_mc = true,
Boolean $manage_submit_mc = true,
Array[String] $auxiliary_packages = $::sendmail::params::auxiliary_packages,
Array[String] $auxiliary_packages = $sendmail::params::auxiliary_packages,
String $package_ensure = 'present',
Boolean $package_manage = $::sendmail::params::package_manage,
String $service_name = $::sendmail::params::service_name,
Boolean $package_manage = $sendmail::params::package_manage,
String $service_name = $sendmail::params::service_name,
Boolean $service_enable = true,
Boolean $service_manage = true,
Stdlib::Ensure::Service $service_ensure = 'running',
Expand Down
4 changes: 2 additions & 2 deletions manifests/local_host_names.pp
Expand Up @@ -15,10 +15,10 @@
) {
include sendmail::params

file { $::sendmail::params::local_host_names_file:
file { $sendmail::params::local_host_names_file:
ensure => file,
owner => 'root',
group => $::sendmail::params::sendmail_group,
group => $sendmail::params::sendmail_group,
mode => '0644',
content => join(suffix(sendmail::canonify_array($local_host_names), "\n")),
notify => Class['sendmail::service'],
Expand Down
4 changes: 2 additions & 2 deletions manifests/mailertable/entry.pp
Expand Up @@ -42,9 +42,9 @@
'absent' => "rm key[ . = '${key}']",
}

augeas { "${::sendmail::params::mailertable_file}-${title}":
augeas { "${sendmail::params::mailertable_file}-${title}":
lens => 'Sendmail_Map.lns',
incl => $::sendmail::params::mailertable_file,
incl => $sendmail::params::mailertable_file,
changes => $changes,
require => Class['sendmail::mailertable::file'],
notify => Class['sendmail::makeall'],
Expand Down
6 changes: 3 additions & 3 deletions manifests/mailertable/file.pp
Expand Up @@ -15,12 +15,12 @@
include sendmail::params
include sendmail::makeall

file { $::sendmail::params::mailertable_file:
file { $sendmail::params::mailertable_file:
ensure => file,
content => $content,
source => $source,
owner => $::sendmail::params::sendmail_user,
group => $::sendmail::params::sendmail_group,
owner => $sendmail::params::sendmail_user,
group => $sendmail::params::sendmail_group,
mode => '0644',
notify => Class['sendmail::makeall'],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/makeall.pp
Expand Up @@ -8,7 +8,7 @@
include sendmail::package

exec { 'sendmail::makeall':
command => $::sendmail::params::configure_command,
command => $sendmail::params::configure_command,
refreshonly => true,
path => '/bin:/sbin:/usr/bin:/usr/sbin',
require => Class['sendmail::package'],
Expand Down
25 changes: 13 additions & 12 deletions manifests/mc.pp
Expand Up @@ -68,8 +68,8 @@
#
#
class sendmail::mc (
String $ostype = $::sendmail::params::sendmail_mc_ostype,
Optional[String] $sendmail_mc_domain = $::sendmail::params::sendmail_mc_domain,
String $ostype = $sendmail::params::sendmail_mc_ostype,
Optional[String] $sendmail_mc_domain = $sendmail::params::sendmail_mc_domain,
Optional[String] $cf_version = undef,
Optional[String] $smart_host = undef,
Optional[String] $domain_name = undef,
Expand All @@ -78,7 +78,7 @@
Optional[Boolean] $dont_probe_interfaces = undef,
Boolean $enable_ipv4_daemon = true,
Boolean $enable_ipv6_daemon = true,
Array[String] $mailers = $::sendmail::params::mailers,
Array[String] $mailers = $sendmail::params::mailers,
Variant[String,Array[String]] $trust_auth_mech = [],
Optional[String] $version_id = undef,
) inherits sendmail::params {
Expand Down Expand Up @@ -123,9 +123,9 @@

concat { 'sendmail.mc':
ensure => 'present',
path => $::sendmail::params::sendmail_mc_file,
path => $sendmail::params::sendmail_mc_file,
owner => 'root',
group => $::sendmail::params::sendmail_group,
group => $sendmail::params::sendmail_group,
mode => '0644',
notify => Class['sendmail::makeall'],
}
Expand Down Expand Up @@ -210,16 +210,17 @@
}
}

if ($::os['family'] == 'FreeBSD') {
if ($facts['os']['family'] == 'FreeBSD') {
# FreeBSD uses a sendmail.mc file named after the hostname of the
# machine. Unfortunately Puppet doesn't know, if $::hostname or $::fqdn
# will be the correct fact to determine the file name that the makefile
# expects (the hostname command is used by the makefile). Therefore we
# use a symbolic link here to create the second alternative.
# machine. Unfortunately Puppet doesn't know, if
# $facts[networking][hostname] or $facts[networking][fqdn] will be the
# correct fact to determine the file name that the makefile expects (the
# hostname command is used by the makefile). Therefore we use a symbolic
# link here to create the second alternative.

file { "${::sendmail::params::mail_settings_dir}/${::fqdn}.mc":
file { "${sendmail::params::mail_settings_dir}/${facts[networking][fqdn]}.mc":
ensure => link,
target => "${::hostname}.mc",
target => "${facts[networking][hostname]}.mc",
before => Concat['sendmail.mc'],
}
}
Expand Down
6 changes: 3 additions & 3 deletions manifests/mc/starttls.pp
Expand Up @@ -109,7 +109,7 @@
}

$params = {
'include_starttls_m4' => $::os['family'] in [ 'Debian' ],
'include_starttls_m4' => $facts['os']['family'] in [ 'Debian' ],
'ca_cert_file' => $ca_cert_file,
'ca_cert_path' => $ca_cert_path,
'server_cert_file' => $_server_cert_file,
Expand All @@ -127,8 +127,8 @@
content => epp('sendmail/starttls.m4', $params),
}

if $::sendmail_version != undef {
if versioncmp($::sendmail_version, '8.15.1') < 0 {
if $facts['sendmail_version'] != undef {
if versioncmp($facts['sendmail_version'], '8.15.1') < 0 {
if $cipher_list {
sendmail::mc::local_config { 'CipherList':
content => "O CipherList=${cipher_list}\n",
Expand Down
6 changes: 3 additions & 3 deletions manifests/package.pp
Expand Up @@ -15,13 +15,13 @@
#
#
class sendmail::package (
Array[String] $auxiliary_packages = $::sendmail::params::auxiliary_packages,
Array[String] $auxiliary_packages = $sendmail::params::auxiliary_packages,
String $package_ensure = 'present',
Boolean $package_manage = $::sendmail::params::package_manage,
Boolean $package_manage = $sendmail::params::package_manage,
) inherits sendmail::params {

if $package_manage {
package { $::sendmail::params::package_name:
package { $sendmail::params::package_name:
ensure => $package_ensure,
}

Expand Down
8 changes: 4 additions & 4 deletions manifests/params.pp
Expand Up @@ -30,7 +30,7 @@

$mailers = [ 'smtp', 'local' ]

case $::os['family'] {
case $facts['os']['family'] {

'Debian': {
$package_manage = true
Expand Down Expand Up @@ -86,14 +86,14 @@
$submit_mc_domain = undef

$configure_command = "make -C ${mail_settings_dir} all install"
$sendmail_mc_file = "${mail_settings_dir}/${::hostname}.mc"
$submit_mc_file = "${mail_settings_dir}/${::hostname}.submit.mc"
$sendmail_mc_file = "${mail_settings_dir}/${facts[networking][hostname]}.mc"
$submit_mc_file = "${mail_settings_dir}/${facts[networking][hostname]}.submit.mc"

$alias_file = '/etc/mail/aliases'
}

default: {
fail("Unsupported osfamily ${::os[family]}")
fail("Unsupported osfamily ${facts[os][family]}")
}
}
}
4 changes: 2 additions & 2 deletions manifests/relay_domains.pp
Expand Up @@ -15,10 +15,10 @@
) {
include sendmail::params

file { $::sendmail::params::relay_domains_file:
file { $sendmail::params::relay_domains_file:
ensure => file,
owner => 'root',
group => $::sendmail::params::sendmail_group,
group => $sendmail::params::sendmail_group,
mode => '0644',
content => join(suffix(sendmail::canonify_array($relay_domains), "\n")),
notify => Class['sendmail::service'],
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Expand Up @@ -19,7 +19,7 @@
#
#
class sendmail::service (
String $service_name = $::sendmail::params::service_name,
String $service_name = $sendmail::params::service_name,
Boolean $service_enable = true,
Boolean $service_manage = true,
Stdlib::Ensure::Service $service_ensure = 'running',
Expand Down
23 changes: 12 additions & 11 deletions manifests/submit.pp
Expand Up @@ -35,8 +35,8 @@
#
#
class sendmail::submit (
Optional[String] $ostype = $::sendmail::params::submit_mc_ostype,
Optional[String] $submit_mc_domain = $::sendmail::params::submit_mc_domain,
Optional[String] $ostype = $sendmail::params::submit_mc_ostype,
Optional[String] $submit_mc_domain = $sendmail::params::submit_mc_domain,
String $msp_host = '[127.0.0.1]',
Pattern[/^(MSA)|([0-9]+)$/] $msp_port = 'MSA',
Boolean $enable_msp_trusted_users = false,
Expand All @@ -53,7 +53,7 @@
'msp_port' => $msp_port,
}

file { $::sendmail::params::submit_mc_file:
file { $sendmail::params::submit_mc_file:
ensure => file,
owner => 'root',
group => $sendmail::params::sendmail_group,
Expand All @@ -62,17 +62,18 @@
notify => [ Class['sendmail::makeall'], Class['sendmail::service'], ],
}

if ($::os['family'] == 'FreeBSD') {
if ($facts['os']['family'] == 'FreeBSD') {
# FreeBSD uses a sendmail.mc file named after the hostname of the
# machine. Unfortunately Puppet doesn't know, if $::hostname or $::fqdn
# will be the correct fact to determine the file name that the makefile
# expects (the hostname command is used by the makefile). Therefore we
# use a symbolic link here to create the second alternative.
# machine. Unfortunately Puppet doesn't know, if
# $facts[networking][hostname] or $facts[networking][[fqdn] will be the
# correct fact to determine the file name that the makefile expects (the
# hostname command is used by the makefile). Therefore we use a symbolic
# link here to create the second alternative.

file { "${::sendmail::params::mail_settings_dir}/${::fqdn}.submit.mc":
file { "${sendmail::params::mail_settings_dir}/${facts[networking][fqdn]}.submit.mc":
ensure => link,
target => "${::hostname}.submit.mc",
before => File[$::sendmail::params::submit_mc_file],
target => "${facts[networking][hostname]}.submit.mc",
before => File[$sendmail::params::submit_mc_file],
}
}
}

0 comments on commit a3247d1

Please sign in to comment.