I was trying to use defnode as a simple way to declare state
idempotently, and defnode seems to be the ticket.  let's say I wanted
to add a new entry in /etc/services

  defnode svc '/files/etc/services/service-name[. = "foo" and protocol = 
"tcp"]' foo
  set $svc/port 4711
  set $svc/protocol tcp

this works fine for known services, but when adding a new entry, it
fails.  Augeas creates the new node and initialises it to the value
"foo", but the $svc can't be used.

  augtool> print /files/etc/services/service-name[last()]
  /files/etc/services/service-name[10313] = "foo"

  # notice port and protocol are missing from the print-out, although
  # they were set without complaint above.

  augtool> set $svc "bar"
  Failed

I tried to look at it in GDB without reaching enlightenment :-) $svc
is added to the symbol table, but I think the problem is that the new
node isn't added to the nodeset it refers to.  just rerunning the
defnode won't help, since the new node doesn't actually match...

-- 
Kjetil T. Homme
Redpill Linpro AS - Changing the game

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to