Good morning to list,
Let me at first get context. I am using augeas ruby bindings to do some
automatic changes in configuration files. I build some tools around
allowing easier access to augeas, but I have now one challenge.

In general I have set of modifications, additional entries and removed
entries. My challenge is that path is not stable, so when new entry is
added or removed from array like #comment, then it changes path of
other items in array.

So consider this scenario. I need to modify two comments, remove two
comments and add comment before another comment. The first part is
easy and I use set. The second part I already solved as I know original
path and do it in reverse order so e.g. remove #comment[50] and
#comment[36]. Then I want to add new #comment before original
#comment[10] but it is no longer #comment[10] and I also do not know
what will be number of new comment ( ok, in this case I know it is path
of comment I inserted before, but sometimes I need to add it before
another key like "inst #comment before $prefix/alias[5]" then is there
easy way how to get path of newly inserted label? like
$prefix/#comment[16] ?

Also is there way how to get what is old path? Value is not unique,
especially in comments and I find manually counting and changing all
indexes quite complex.

Thanks for help and tips.

Josef

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

Reply via email to