Fwd: [augeas-devel] Lens similar to rsync.conf

Raphaël Pinson raphink at gmail.com
Tue May 26 08:44:24 UTC 2009


Forwarding my answer back to the list.


---------- Forwarded message ----------
From: Raphaël Pinson <raphink at gmail.com>
Date: 2009/5/20
Subject: Re: [augeas-devel] Lens similar to rsync.conf
To: "Thomas, Dave" <dthomas at tandbergtv.com>


On Wed, May 20, 2009 at 5:56 PM, Thomas, Dave <dthomas at tandbergtv.com> wrote:
> Hi,
>
>
>
> I need to make an adapter for a config file that’s almost identical to rsync
> but sections are expressed differently:
>
>
>
> Toplevelrecord = val
>
> Section/record = val2
>
> Subsection/section/record=val3
>
>
>
> Scanning the man page, rsync doesn’t seem to do subsections, but otherwise
> the equivalent rsync could be:
>
>
>
> <pre>
>
> rsync.conf
>
>
>
> Toplevelrecord = val
>
> [Section]
>
> record = val2
>
> </pre>
>
>
>
>
>
> I tried to start by matching the regex like so:
>
> [A-Za-z0-9 _.-\/]
>
>
>
> But I get:
>
> lenses/localconf.aug:33.0-38.24:Failed to compile entry
>
> lenses/localconf.aug:34.17-.23:exception: The key regexp
> /[A-Za-z0-9_.-][A-Za-z0-9 _.-\/]*[A-Za-z0-9_.-]/ matches a '/'
>
>
>
> lenses/tests/test_localconf.aug:26.6-.19:Could not load module LocalConf for
> LocalConf.lns
>
> lenses/tests/test_localconf.aug:26.6-.19:Undefined variable LocalConf.lns
>
> lenses/tests/test_localconf.aug: error: Loading failed
>
>

You can't have a "/" in a key, because otherwise Augeas won't know how
to get back from the tree to the file (a->c). Example :

is "a/b" a key or is "a" the key and "b" the subnode ?

So, when you want to use "/" in node values, you need to actually map
them another way, like :

node/value = "a/b"


dput.aug is an example of an IniFile that allows "/" in entries, you
could have a look at it.



Raphaël



>
>
>
> For clarifications:
>
> @@ -25,43 +24,35 @@
>
>
>
>  (************************************************************************
>
>   *                        ENTRY
>
>  * rsyncd.conf allows indented entries, but by default entries outside
>
>   * sections are unindented
>
>   *************************************************************************)
>
> -let entry_re   = /[A-Za-z0-9_.-][A-Za-z0-9 _.-]*[A-Za-z0-9_.-]/
>
> +let entry_re   = /[A-Za-z0-9_.-][A-Za-z0-9 _.-\/]*[A-Za-z0-9_.-]/
>
>
>
> Any suggestions?
>
>
>
> Thanks!
>
> Dave
>
> **********************************************************************
>
> This communication is confidential and intended solely for the
> addressee(s). Any unauthorized review, use, disclosure or distribution
> is prohibited. If you believe this message has been sent to you in
> error, please notify the sender by replying to this transmission and
> delete the message without disclosing it. Thank you.
>
> E-mail including attachments is susceptible to data corruption,
> interception, unauthorized amendment, tampering and viruses, and we
> only send and receive e-mails on the basis that we are not liable for
> any such corruption, interception, amendment, tampering or viruses or
> any consequences thereof.
>
> This email, its content and any attachments is PRIVATE AND
> CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group.
>
> www.tandbergtv.com
> **********************************************************************
>
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
>




More information about the augeas-devel mailing list