voxpupuli / puppet-postfix

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

virtual maps not permitted to have multiple recipients by Augeas lens #346

Closed sandynomad closed 1 year ago

sandynomad commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

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

postfix::virtual { 'name@example.domain':
    ensure      => present,
    destination => 'name2@example.domain, name3@example.domain'
}

What are you seeing

Debug: Augeas[Postfix virtual - name@example.domain](provider=augeas): Put failed on one or more files, output from /augeas//error:
Debug: Augeas[Postfix virtual - name@example.domain](provider=augeas): /augeas/files/etc/postfix/virtual/error = put_failed
Debug: Augeas[Postfix virtual - name@example.domain](provider=augeas): /augeas/files/etc/postfix/virtual/error/path = /files/etc/postfix/virtual/files/etc/postfix/virtual/pattern[11]
Debug: Augeas[Postfix virtual - name@example.domain](provider=augeas): /augeas/files/etc/postfix/virtual/error/lens = /opt/puppetlabs/puppet/share/augeas/lenses/dist/postfix_virtual.aug:46.7-48.15:
Debug: Augeas[Postfix virtual - name@example.domain](provider=augeas): /augeas/files/etc/postfix/virtual/error/message = Failed to match tree under /files/etc/postfix/virtual/pattern[11]

 { "destination" = "name2@example.domain, name3@example.domain" }

  with pattern

{ /destination/ = /[*+.0-9=@-Z\\_a-z-]+/ }
(
    { /destination/ = /[*+.0-9=@-Z\\_a-z-]+/ })*
Debug: Augeas[Postfix virtual - name@example.domain](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Extensions::Mailer/Postfix::Virtual[name@example.domain]/Augeas[Postfix virtual -     name@example.domain]: Could not evaluate: Save failed, see debug output for details

What behaviour did you expect instead

/etc/postfix/virtual updated with:

name@example.domain name2@example.domain,name3@example.domain

Output log

As above.

Any additional information you'd like to impart

None.

smortex commented 1 year ago
destination => 'name2@example.domain, name3@example.domain'

That does not look like a valid e-mail address. I guess you want:

postfix::virtual { 'name@example.domain':
  ensure      => present,
  destination => [
    'name2@example.domain',
    'name3@example.domain',
  ],
}
smortex commented 1 year ago

Please reopen if this does not fix your issue.

sandynomad commented 1 year ago

Hi Smortex,

Thanks - this does fix the issue. Looking at the REFERENCE.md this is obvious.

However the information at https://forge.puppet.com/modules/puppet/postfix/readme appears to be misleading in the case of multiple targets:

destination

A string defining where the e-mails will be delivered to, (virtual(8)). Default: Undefined. Example: 'root'