saltstack-formulas / postfix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
25 stars 130 forks source link

Don't call 'newaliases' if the 'alias_maps' postfix setting has 'regexp' as its dictionary type #50

Closed petarmaric closed 7 years ago

petarmaric commented 7 years ago

Here's an excerpt from my Pillar:

postfix:
  config:
    alias_maps: regexp:/etc/aliases
    alias_database: regexp:/etc/aliases

  aliases: |
    # Forward all local *nix users mail to our admins (via greedy regexp)
    /.+/    admins@example.com
# ...

Running state.apply results in a rather cryptic error:

...
          ID: run-newaliases
    Function: cmd.wait
        Name: newaliases
      Result: False
     Comment: Command "newaliases" run
     Started: 08:29:38.848092
    Duration: 1018.418 ms
     Changes:
              ----------
              pid:
                  24312
              retcode:
                  1
              stderr:
                  postalias: fatal: unsupported dictionary type: regexp. Is the postfix-regexp package installed?
              stdout:
...

We shouldn't presume that everyone is using hash as their dictionary type, as 'newaliases' should not be called if the 'alias_maps' postfix setting has regexp as its dictionary type.

References:

EvaSDK commented 7 years ago

Should we then make a whilelist or a blacklist of file-types that require calling newaliases/postmap ?

petarmaric commented 7 years ago

I have a feeling that the following whitelist (based on http://www.postfix.org/postmap.1.html):

may be more preferable.

EvaSDK commented 7 years ago

Please test PR#51, it should satisfy your requirements.

EvaSDK commented 7 years ago

Ping ?

EvaSDK commented 7 years ago

The PR is now merged so this issue can be closed.

duk3luk3 commented 7 years ago

Thank you - next time, please include "Fixes #issue" in the commit message of your final commit for the PR.