[augeas-devel] Problem with iptables lense and blank lines

Terence Haddock thaddock at tripi.com
Mon Mar 7 10:37:26 UTC 2011


Hi Augeas developers,

I am trying to write a lense for the UFW firewall (see
https://help.ubuntu.com/community/UFW) to use in Puppet scripts. Some
of UFW's configuration files are in iptables format, so I would like
to reuse the 'stock' iptables configuration like this:

(* Parse rules config files for ufw *)
module Ufw_Rules =
  autoload xfm

  let lns = Iptables.lns

  let filter = incl "/etc/ufw/*.rules"
      . Util.stdexcl

  let xfm = transform lns filter


But because of the blank lines, parsing fails:

augtool> ls /augeas/files/etc/ufw/before.rules/
path = /files/etc/ufw/before.rules
lens/ = @Ufw_Rules
error/ = parse_failed
augtool> ls /augeas/files/etc/ufw/before.rules/error
pos = 355
line = 11
char = 0
lens = /usr/share/augeas/lenses/dist/iptables.aug:72.10-.32:
message = Iterated lens matched less than it should

Attached is the before.rules file I used to test, and a patch that
allows iptables to work with blank lines.

Please let me know if you need anything else, and if it's possible for
this patch to be applied.

Thank you,
Terence Haddock
-------------- next part --------------
A non-text attachment was scrubbed...
Name: before.rules
Type: application/octet-stream
Size: 2781 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110307/b43aa2e6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1305 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110307/b43aa2e6/attachment.bin>


More information about the augeas-devel mailing list