Hi Raphael,

 

no, I need an empty line after Uitl.eol, before any other text. But you bring 
up an interesting point, that my lens doesn't recognize the end of a file, 
which could be accepted all the same, without requiring an actual empty line. 
But how can I match the end of a file?

 

Ciao,

Xavier.

 

From: Raphaël Pinson [mailto:raphael.pin...@camptocamp.com] 
Sent: Tuesday, December 22, 2015 1:31 PM
To: Mol, Xavier (SCC)
Cc: augeas-devel@redhat.com
Subject: Re: [augeas-devel] How to insert empty nodes in Augeas trees?

 

It's common to end every line with a Util.eol, which defaults to a newline. Or 
do you mean that you need an empty line at the end of the file?

 

 

Raphaël

 

On Tue, Dec 22, 2015 at 12:58 PM, Mol, Xavier (SCC) <xavier....@kit.edu> wrote:

Hi Raphael, all,

 

some more finding about this…

 

Neither 'touch', nor 'rename' can be used during a put unit test. Also, relying 
on Augeas users to do this just to insert a line break, which is required for a 
valid configuration file, is ugly and error prone. This workaround still may be 
used to add additional empty lines to a configuration file just to improve 
readability (where they don't break anything), so still a useful lesson. Though 
for my custom lens, I have decided to look for and create empty lines by 
default, as with any string literal. This way, the Augeas tree doesn't need to 
feature empty nodes and empty lines will be added in put direction 
automatically.

 

Thank you again for your time,

Xavier.

 

From: augeas-devel-boun...@redhat.com [mailto:augeas-devel-boun...@redhat.com] 
On Behalf Of Mol, Xavier (SCC)
Sent: Tuesday, December 22, 2015 10:27 AM
To: Raphaël Pinson


Cc: augeas-devel@redhat.com
Subject: Re: [augeas-devel] How to insert empty nodes in Augeas trees?

 

Hi Raphael,

 

thank you again for your quick and helpful reply!

 

Ciao,

Xavier.

 

From: Raphaël Pinson [mailto:raphael.pin...@camptocamp.com] 
Sent: Tuesday, December 22, 2015 10:25 AM
To: Mol, Xavier (SCC)
Cc: augeas-devel@redhat.com
Subject: Re: [augeas-devel] How to insert empty nodes in Augeas trees?

 

Hello Xavier,

 

 

I was going to say that was not possible, but I actually (to my great surprise) 
found a way to do it:

 

    augtool> touch /files/etc/fstab/01

    augtool> rename /files/etc/fstab/01 ""

    rename : /files/etc/fstab/01 to  1

    augtool> save

    Saved 1 file(s)

 

Just added an empty line at the end of /etc/fstab

 

 

Cheers,

 

Raphaël

 

 

 

On Tue, Dec 22, 2015 at 10:06 AM, Mol, Xavier (SCC) <xavier....@kit.edu> wrote:

Hello Augeas experts,

is there a way to insert empty nodes in an Augeas tree? I've made a lens, that 
expects an empty line as last part (Util.empty), which works fine with existing 
files. However, when inserting a new node in the tree with that lens, the 
closing empty line is missing. Do I need to have a labelled node in the tree 
without value or children, that simply puts an empty line in the resulting 
string instead?

Thank you for your time,
Xavier.

****
Karlsruher Institute of Technology (KIT)
Steinbuch Centre for Computing (SCC)

B. Sc. Xavier Mol
GridKa Storage Administrator and Support Manager

Hermann-von-Helmholtz-Platz 1
Geb. 449
76344 Eggenstein-Leopoldshafen
Phone: +49 721 608 23041 <tel:%2B49%20721%20608%2023041> 
Email: xavier....@kit.edu
www.kit.edu
KIT - University of the State of Baden-Württemberg and National Large-scale 
Research Center of the Helmholtz Association
"Since 2010, the KIT has been certified as a family-friendly university."
****


_______________________________________________
augeas-devel mailing list
augeas-devel@redhat.com
https://www.redhat.com/mailman/listinfo/augeas-devel





 

-- 

Raphaël Pinson

Infrastructure Developer & Training Leader

+33 458 482 013

 

Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com





 

-- 

Raphaël Pinson

Infrastructure Developer & Training Leader

+33 458 482 013

 

Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
augeas-devel mailing list
augeas-devel@redhat.com
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to