[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 Fri, 2010-01-29 at 05:24 +1100, Matthew Palmer wrote:
> On Thu, Jan 28, 2010 at 09:19:10AM -0800, David Lutterkort wrote:
> > 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...

The clear command has been in augtool for a long time now, but it didn't
make it into the ruby-augeas bindings and the augeas type in puppet
until fairly recently (ruby-augeas-0.3.0; can't remember the puppet
version where it first showed up)

The main reason to have a separate 'clear' is that in text-based tools
like augtool, you can't really write down a set PATH NULL, since you
need to allow every possible string as a value.

> > > 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.

What would that look like ? Would it be enough to add an if statement,
something like

        if PATHEXPR
          STATEMENTS
        else
          STATEMENTS
        end

where PATHEXPR is true according to the usual rules for path expressions
(e.g., a nodeset is true if it's nonempty) That measn you could write

        if count(/files/etc/hosts/*[ipaddr = '192.168.0.1']) = 0
          set ...
        end

> 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.

I'd appreciate if you could send them here or enter them into the puppet
bug tracker and cc me.

David




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