[augeas-devel] fstab lens
Lance Dillon
riffraff169 at yahoo.com
Sat Jan 14 15:36:03 UTC 2012
Aha, fantastic, thanks for the help. I will try this at the earliest opportunity (possibly monday morning).
>________________________________
> From: Raphaël Pinson <raphink at gmail.com>
>To: Lance Dillon <riffraff169 at yahoo.com>
>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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20120114/92266073/attachment.htm>
More information about the augeas-devel
mailing list