Module fails with blank mydestination on a satellite
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 7 aio
- Ruby:
- Distribution: Ubuntu 20.04/22.04
- Module version: 3.0.0
How to reproduce (e.g Puppet code you use)
This should be a minimal configuration that will recreate the issue.
class {'::postfix':
satellite => true,
relayhost => $relayhost,
masquerade_domains => [
$masquerade_domain,
],
}
What are you seeing
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, pick(): must receive at least one non empty value (file: /etc/puppetlabs/code/environments/postfix/modules/postfix/manifests/satellite.pp, line: 40, column: 21) on node
What behaviour did you expect instead
Setting $mydestination to an empty value w/o a puppet Evaluation Error
Output log
See above
Any additional information you'd like to impart
I'm trying to configure a satellite relay with no local delivery, hence setting mydestination to an empty string. This causes the pick() command to fail as I have not specified satellite::mydestination. It seems that this is not a good use of pick.
mydestination should still be set to the default value, even for satellites: https://www.postfix.org/postconf.5.html#mydestination
@kenyon I read that section several times before submitting the bug report. I do not see how that can be inferred from the text.
I have found this example in their documentation which shows mydestination being empty.
Maybe I'm confused exactly what this module means by mta and satellite. Basically I'm want to run postfix so that it forwards all mail to a relay.
I also use this module to configure postfix in satellite mode. I leave mydestination at the postfix default, and still all mail goes to the relayhost. It works because of the virtual map that forwards everything to root https://github.com/voxpupuli/puppet-postfix/blob/f51bf0efee4cbdd6c27e48fef082a215ff49be89/manifests/satellite.pp#L34-L37 and your setting of root_mail_recipient as shown in the example at https://github.com/voxpupuli/puppet-postfix/blob/master/REFERENCE.md#configure-postfix-as-satellite.
I guess if you want to do it differently, a patch may be needed.
@kenyon thanks for the pointer to Reference.md, that has more detail than is showing on puppet forge. Reading that, satellite is not what I want, I should configure postfix::mta and set the parameters I need. I have some aliases configured and they are ignored.
I do still think it's a bug that it fails with mydestination being empty. While not necessary, I think it's a valid configuration.
Hmm, mta has the same issue
https://github.com/voxpupuli/puppet-postfix/blob/master/manifests/mta.pp#L16
Looking at my configs I am using this in my common.yaml:
postfix::mydestination: 'blank'
postfix::mta: true
postfix::relayhost: '[mail.OMIT]'
This is what forces all Postfix mail through my site's relay host. The relay host then is responsible for sending mail:
postfix::mta: true
postfix::relayhost: 'direct'
postfix::mydestination: 'pcre:/etc/postfix/hpc_hosts.pcre'
@treydock That is basically the workaround I'm using:
postfix::mydestination: '-'
and just proves my point. Postfix allows for and recommends using an empty mydestination field. The used of pick() is causing an error when it should not.
Thanks.
Jeff
+1