Aha, fantastic, thanks for the help. I will try this at the earliest
opportunity (possibly monday morning).
>________________________________
> From: Raphaël Pinson <[email protected]>
>To: Lance Dillon <[email protected]>
>Sent: Saturday, January 14, 2012 9:30 AM
>Subject: Re: [augeas-devel] fstab lens
>
>Hi,
>
>
>The problem is indeed your code. opt nodes must be all in the same
>place. In order to do so, all you need to do is create a new new opt
>node after the last existing one before you assign it a value. Use ins
>for that:
>
>
>define opt ( $fname, $opt, $value ) {
> $key = $name
> $context = "/files/etc/fstab"
>
> augeas { "$key-$fname-$opt-$value":
> context => "$context",
> onlyif => "match *[spec='$key'][file='$fname']/opt[.='$opt']
>size == 0",
> changes => [
>"ins opt after *[spec='$key'][file='$fname']/opt[last()]",
>"set *[spec='$key'][file='$fname']/opt[last()] $opt",
>"set *[spec='$key'][file='$fname']/opt[last()]/value $value",
>],
>}
>}
>
>
>should do.
>
>
>Cheers,
>
>Raphaël
>
>
>_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel