voxpupuli / puppet-postfix

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

Impossible to create virtual regexp map #323

Open vasilevalex opened 2 years ago

vasilevalex commented 2 years ago

Affected Puppet, Ruby, OS and module versions/distributions

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

Simply use example from the code: https://github.com/voxpupuli/puppet-postfix/blob/fd273052c63668b0287b283615d1d783728685f3/manifests/virtual.pp#L34

node "toto.example.com" {
  include postfix
  postfix::config { "virtual_alias_maps":
    value => "regexp:/etc/postfix/virtual_regexp"
  }
 postfix::virtual { "/.+@.+/":
   ensure      => present,
   file        => '/etc/postfix/virtual_regexp',
   destination => 'root',
  }
}

What are you seeing

Virtual map can't be created because of limitation of symbols to match pattern. Regexp map is formatted the same way as hash map, but it is impossible to build even simple regular expressions using only very limited amount of symbols: *+.0-9=@-Z\\_a-z-

What behaviour did you expect instead

Pattern should use additionally at least these symbols: ^][$/()|?}{

Output log

Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): Opening augeas with root /, lens path , flags 64
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): Augeas version 1.12.0 is installed
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): sending command 'defnode' with params ["entry", "/files/etc/postfix/virtual_regexp/pattern[. = '/.+@.+/']", "/.+@.+/"]
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): sending command 'rm' with params ["$entry/destination"]
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): sending command 'set' with params ["$entry/destination[1]", "root"]
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): Put failed on one or more files, output from /augeas//error:
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): /augeas/files/etc/postfix/virtual_regexp/error = put_failed
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): /augeas/files/etc/postfix/virtual_regexp/error/path = /files/etc/postfix/virtual_regexp/
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): /augeas/files/etc/postfix/virtual_regexp/error/lens = /opt/puppetlabs/puppet/share/augeas/lenses/dist/postfix_virtual.aug:51.10-.47:
Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): /augeas/files/etc/postfix/virtual_regexp/error/message = Unexpected node '/files/etc/postfix/virtual_regexp/pattern[2]': can not match tree

     { "pattern" = "/.+@.+/" }

 with pattern
   (    { }
      | { /#comment/ = /[^\t\n\r ].*[^\t\n\r ]|[^\t\n\r ]/ }
      | { /pattern/ = /[*+.0-9=@-Z\\_a-z-]+/ })*

Debug: Augeas[Postfix virtual - /.+@.+/](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Profile::Postfix_cfg/Postfix::Virtual[/.+@.+/]/Augeas[Postfix virtual - /.+@.+/]: Could not evaluate: Save failed, see debug output for details