Unverified Commit 4359fdce authored by Romain Tartière's avatar Romain Tartière Committed by GitHub
Browse files

Merge pull request #350 from ekohl/drop-old-lenses

Drop old augeas lenses
parents 854798f1 ebe70124
Loading
Loading
Loading
Loading
+0 −51
Original line number Diff line number Diff line
(*
Module: Postfix_Transport
  Parses /etc/postfix/transport

Author: Raphael Pinson <raphael.pinson@camptocamp.com>

About: Reference
  This lens tries to keep as close as possible to `man 5 transport` where possible.

About: License
   This file is licenced under the LGPL v2+, like the rest of Augeas.

About: Lens Usage
   To be documented

About: Configuration files
   This lens applies to /etc/postfix/transport. See <filter>.

About: Examples
   The <Test_Postfix_Transport> file contains various examples and tests.
*)

module Postfix_Transport =

autoload xfm

(* View: space_or_eol *)
let space_or_eol = del /([ \t]*\n)?[ \t]+/ " "

(* View: colon *)
let colon = Sep.colon

(* View: transport *)
let transport = [ label "transport" . (store Rx.word)? ]

(* View: nexthop *)
let nexthop = [ label "nexthop" . (store Rx.space_in)? ]

(* View: record *)
let record = [ label "pattern" . store /[^# \t\r\n]+/
             . space_or_eol . transport
             . colon . nexthop
             . Util.eol ]

(* View: lns *)
let lns = (Util.empty | Util.comment | record)*

(* Variable: filter *)
let filter = incl "/etc/postfix/transport"

let xfm = transform lns filter

files/lenses/postfix_virtual.aug

deleted100644 → 0
+0 −56
Original line number Diff line number Diff line
(*
Module: Postfix_Virtual
  Parses /etc/postfix/virtual

Author: Raphael Pinson <raphael.pinson@camptocamp.com>

About: Reference
  This lens tries to keep as close as possible to `man 5 virtual` where possible.

About: License
   This file is licenced under the LGPL v2+, like the rest of Augeas.

About: Lens Usage
   To be documented

About: Configuration files
   This lens applies to /etc/postfix/virtual. See <filter>.

About: Examples
   The <Test_Postfix_Virtual> file contains various examples and tests.
*)

module Postfix_Virtual =

autoload xfm

(* Variable: space_or_eol_re *)
let space_or_eol_re = /([ \t]*\n)?[ \t]+/

(* View: space_or_eol *)
let space_or_eol (sep:regexp) (default:string) =
  del (space_or_eol_re? . sep . space_or_eol_re?) default

(* View: word *)
let word = store /[A-Za-z0-9@\*.+=_-]+/

(* View: comma *)
let comma = space_or_eol "," ", "

(* View: destination *)
let destination = [ label "destination" . word ]

(* View: record *)
let record =
  let destinations = Build.opt_list destination comma
  in [ label "pattern" . word
     . space_or_eol Rx.space " " . destinations
     . Util.eol ]

(* View: lns *)
let lns = (Util.empty | Util.comment | record)*

(* Variable: filter *)
let filter = incl "/etc/postfix/virtual"

let xfm = transform lns filter
+0 −53
Original line number Diff line number Diff line
(*
Module: Test_Postfix_Transport
  Provides unit tests and examples for the <Postfix_Transport> lens.
*)

module Test_Postfix_Transport =

(* View: conf *)
let conf = "# a comment
the.backed-up.domain.tld       relay:[their.mail.host.tld]
.my.domain   :
*            smtp:outbound-relay.my.domain
example.com      uucp:example
example.com      slow:
example.com      :[gateway.example.com]
user.foo@example.com  
    smtp:bar.example:2025
.example.com     error:mail for *.example.com is not deliverable
/^bounce\+.*/ sympabounce:
"

(* Test: Postfix_Transport.lns *)
test Postfix_Transport.lns get conf =
  { "#comment" = "a comment" }
  { "pattern" = "the.backed-up.domain.tld"
    { "transport" = "relay" }
    { "nexthop" = "[their.mail.host.tld]" } }
  { "pattern" = ".my.domain"
    { "transport" }
    { "nexthop" } }
  { "pattern" = "*"
    { "transport" = "smtp" }
    { "nexthop" = "outbound-relay.my.domain" } }
  { "pattern" = "example.com"
    { "transport" = "uucp" }
    { "nexthop" = "example" } }
  { "pattern" = "example.com"
    { "transport" = "slow" }
    { "nexthop" } }
  { "pattern" = "example.com"
    { "transport" }
    { "nexthop" = "[gateway.example.com]" } }
  { "pattern" = "user.foo@example.com"
    { "transport" = "smtp" }
    { "nexthop" = "bar.example:2025" } }
  { "pattern" = ".example.com"
    { "transport" = "error" }
    { "nexthop" = "mail for *.example.com is not deliverable" } }
  { "pattern" = "/^bounce\+.*/"
    { "transport" = "sympabounce" }
    { "nexthop" } }

+0 −53
Original line number Diff line number Diff line
(*
Module: Test_Postfix_Virtual
  Provides unit tests and examples for the <Postfix_Virtual> lens.
*)

module Test_Postfix_Virtual =

(* View: conf *)
let conf = "# a comment
virtual-alias.domain     anything
postmaster@virtual-alias.domain  postmaster
user1@virtual-alias.domain       address1
user-1@virtual-alias.domain       address1
user_2@virtual-alias.domain
    address2,
    address3
user+test@virtual-alias.domain
    address2,
    address3
root    robert.oot@domain.com
@example.net  root,postmaster
"

(* Test: Postfix_Virtual.lns *)
test Postfix_Virtual.lns get conf =
  { "#comment" = "a comment" }
  { "pattern" = "virtual-alias.domain"
    { "destination" = "anything" }
  }
  { "pattern" = "postmaster@virtual-alias.domain"
    { "destination" = "postmaster" }
  }
  { "pattern" = "user1@virtual-alias.domain"
    { "destination" = "address1" }
  }
  { "pattern" = "user-1@virtual-alias.domain"
    { "destination" = "address1" }
  }
  { "pattern" = "user_2@virtual-alias.domain"
    { "destination" = "address2" }
    { "destination" = "address3" }
  }
  { "pattern" = "user+test@virtual-alias.domain"
    { "destination" = "address2" }
    { "destination" = "address3" }
  }
  { "pattern" = "root"
    { "destination" = "robert.oot@domain.com" }
  }
  { "pattern" = "@example.net"
    { "destination" = "root" }
    { "destination" = "postmaster" }
  }
+0 −12
Original line number Diff line number Diff line
@@ -8,18 +8,6 @@ class postfix::augeas {
  assert_private()

  $module_path = get_module_path($module_name)
  augeas::lens { 'postfix_transport':
    ensure       => present,
    lens_content => file("${module_path}/files/lenses/postfix_transport.aug"),
    test_content => file("${module_path}/files/lenses/test_postfix_transport.aug"),
    stock_since  => '1.0.0',
  }
  augeas::lens { 'postfix_virtual':
    ensure       => present,
    lens_content => file("${module_path}/files/lenses/postfix_virtual.aug"),
    test_content => file("${module_path}/files/lenses/test_postfix_virtual.aug"),
    stock_since  => '1.7.0',
  }
  augeas::lens { 'postfix_canonical':
    ensure       => present,
    lens_content => file("${module_path}/files/lenses/postfix_canonical.aug"),
Loading