[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] Setting nodes with empty values (0.7 regression?)

On Thu, Jan 28, 2010 at 09:19:10AM -0800, David Lutterkort wrote:
> On Thu, 2010-01-28 at 20:50 +1100, Matthew Palmer wrote:
> > We've got an internal lens that, for various mostly-sane reasons, uses a key
> > with no value (because we want to set modifiers on it in subkeys).  In 0.5,
> > we could just do:
> > 
> >     set /files/etc/x/y/z/A null
> > 
> > And the save would succeed.  When we reloaded the file, we'd see
> > 
> >     /files/etc/x/y/z/A (none)
> > 
> > And all would be happy.  In 0.7, however, attempting to do this results in
> > the message:
> > 
> > message = Failed to match
> >     ({ /[^\001-\004\t\n ,/A-Z\\]+/ } | { /A|L|U|K|P/ })({ /[^\001-\004\t\n ,/A-Z\\]+/ } | { /A|L|U|K|P/ })*
> >   with tree
> >     { "A" = "null" }
> > 
> > Now, I expect this is due to the value matching code that got introduced a
> > while ago (so I guess this is all my own fault, in a way), but I'm wondering
> > if there's any way to work around this, or perhaps relax the requirement in
> > sublenses that don't have a value regex at all?
> Both augtool and the Augeas type for puppet have a 'clear' command that
> you can use to set the value of a node to NULL - does that work for
> you ?

It seems to work in augtool, and the augeas Puppet type seems to recognise
it, but the augeas-ruby bindings have a cry.  I'm assuming they're out of
date, I'll update my packages.  How new is the 'clear' command?  I don't
recall seeing it when I was starting out (I did a fair bit of research
before settling on the 'null' hack) and since my Ruby bindings don't like
it, I'm assuming it's relatively new...

> > For reference, I can use "set /files/etc/x/y/z/A ''" to do the right thing
> > in augtool, but I need to do this edit in the Puppet type, which maintains
> > it's reputation for being epsilon short of being just too damned painful to
> > use.
> Anything I can do to make it more usable ?

Take off and nuke it from orbit...

In all seriousness, it needs a complete rethink.  The command parsing is
buggy as all hell, it's tripped me up a few times and I've had to mangle it
into some sort of shape (values with spaces in them comes to mind).  It
really needs a much more expressive language for performing edits; whilst
the available commands are fine for augtool, you don't have the ability to
"think" in a resource, so we need conditionals that can be interspersed with
editing commands -- or else allow multiple resources to be bundled into the
one Augeas editing session.

Basically, there needs to be a way to describe a workflow similar to what a
person would do in augtool.  "Is this here?  No, OK, create that.  What
about this one?  No, Righto, create that too.  Are these values right?  No? 
Set them, then." Half of the custom types I'm running are actually wrappers
around Augeas, because the built-in type can't do the trick, and there are
plenty of augeas resources in my manifests that I *know* are fragile as all
buggery and will likely break at the first hint of anything tricky, but were
pushed into use because they didn't fail totally and hence passed the
"whooshing deadlines" it'll-do-for-now threshold.  If someone actually wants
to do the augeas type properly, I'll give them some of these as examples of
stuff that should be doable, but isn't.

- Matt

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]