• Ewoud Kohl van Wijngaarden's avatar
    Allow blank destinations · a9878376
    Ewoud Kohl van Wijngaarden authored
    It's possible to have a blank destination. A typical use case is discarding
    everything except one domain[1].
    
    example.org :
    .example.org :
    * discard:
    
    One would implement this using puppet-postfix as follows:
    
    postfix::transport { ['example.org', '.example.org']:
      destination => '',
    }
    postfix::transport { '*':
      destination => 'discard',
    }
    
    However, this will result into an error:
    
    err: /Stage[main]/MyClass/Postfix::Transport[example.org]/Augeas[Postfix transport - example.org]: Could not evaluate: Save failed with return code false
    err: /Stage[main]/MyClass/Postfix::Transport[.example.org]/Augeas[Postfix transport - .example.org]: Could not evaluate: Save failed with return code false
    
    The solution is to use clear instead of set if the destination is empty. This
    patch changes the destination to follow a similar pattern as nexthop. For
    convenience it also adds a default to destination since that can now be handled
    properly. Thus the following works.
    
    postfix::transport { ['example.org', '.example.org']:
    }
    postfix::transport { '*':
      destination => 'discard',
    }
    
    [1]: http://dannyman.toldme.com/2008/09/15/howto-postfix-deliver-external-devnull/
    a9878376
transport.pp 1.86 KB