voxpupuli / puppet-postfix

Puppet postfix module
Apache License 2.0
70 stars 172 forks source link

virt advice is wrong #343

Open fayeg21 opened 1 year ago

fayeg21 commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

class{'postfix':
    satellite           => false,
    mta                 => true,
    smtp_listen         => 'all',
    mynetworks          => join([lookup('my_network'),' 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128']),
    myorigin            => lookup('my_origin'),
    mydestination       => join([$facts['networking']['hostname'],', localhost.localdomain, localhost']),
    masquerade_domains  => [lookup('masquerade_domains')],
    masquerade_classes  => ['envelope_sender', 'header_sender'],
    root_mail_recipient => lookup('root_email'),
    relayhost           => 'direct',
  }

  postfix::config { 'smtp_generic_maps':
    ensure  => present,
    value   => 'hash:/etc/postfix/generic',
  }

  postfix::hash { '/etc/postfix/generic':
    ensure  => 'present',
    content => epp('profile/email/generic.epp'),
  }

  postfix::hash { '/etc/postfix/virtual':
    ensure => present,
  }

  postfix::config { 'virtual_alias_maps':
    ensure  => present,
    value   => 'hash:/etc/postfix/virtual',
  }

  postfix::virtual {'root@xxxx':
    ensure      => present,
    destination => lookup('root_email'),
  }

What are you seeing

The docs tell you to define a postfix::hash stanza but when you do (and have mta=>true) you get this error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Postfix::Hash[/etc/postfix/virtual] is already declared at (file: /etc/puppetlabs/code/modules/postfix/manifests/mta.pp, line: 78); cannot redeclare (file: /etc/puppetlabs/code/environments/production/site/profile/manifests/email/smarthost.pp, line: 39)

What behaviour did you expect instead

No erorr when following the docs.

Output log

Any additional information you'd like to impart