Skipping because no files were changed
I started with this, and it worked sometimes:
augeas {"automaster$name":
context => "/files/etc/auto.master",
changes => $changes,
onlyif => "match map[. = '/$name'] size == 0"
}
In some cases it did not work, saying "Skipping because no files were changed" even though debugging showed that changes were made. This version works all the time:
augeas {"automaster$name":
context => "/files/etc/auto.master",
incl => "/etc/auto.master",
lens => "Automaster.lns",
load_path => "/var/lib/puppet/lib/augeas/lenses",
changes => $changes,
onlyif => "match map[. = '/$name'] size == 0"
}
I'm not yet sure why this happened, but it seems the difference is that in a manifest where augeas is used previously with load_path, that I need to use it here too.
Hi,
ReplyDeleteCan you post your Automaster.lns ?
Sorry it took me so long to notice this. Here's my lens if you still want it:
Deletemodule Automaster =
autoload xfm
let eol = Util.eol
let comment = Util.comment
let empty = Util.empty
let mount_point = store /\/[^# \t\n]+/
let include = [ label "include" .
del /\+[ \t]*/ "+" .
store /[^# \t\n]+/ .
eol ]
let options = [ label "options" . store /-[^ \t\n]+/ ]
let map_param =
let name = [ label "name" . store /[^: \t\n]+/ ]
in let type = [ label "type" . store /[a-z]+/ ]
in let format = [ label "format" . store /[a-z]+/ ]
in let options = [ label "options" . store /[^ \t\n]+/ ]
in let prelude = ( type .
( del "," "," . format ) ? .
del ":" ":" )
in ( prelude ? .
name .
( Util.del_ws_spc . options ) ? )
let map_record = [ label "map" .
mount_point . Util.del_ws_spc .
map_param .
eol ]
let lns = ( map_record |
include |
comment |
empty ) *
let relevant = (incl "/etc/auto.master") .
Util.stdexcl
let xfm = transform lns relevant