I just hit an issue where a grub.conf contained the following 2 lines:

serial -unit=0 -speed=115200
terminal -timeout=5 serial console

Those lines are incorrect. They should use '--' instead of '-' for options. I just checked the grub source and grub will be silently ignoring the options. Grub effectively reads them as:

serial
terminal serial console

However, the effect of the above on augeas is that grub.conf isn't parsed at all. I think much better behaviour would be to localise errors in the tree wherever possible according to syntax, and parse the rest as normal.

For a worked example, take the following grub.conf fragment:

terminal -timeout=5 serial console
default=0
frobnicate --foobaz
hiddenmenu

The above could be parsed as:

* terminal
  * #error = -timeout=5
  * serial
  * console
* default = 0
* #error = frobnicate --foobaz
* hiddenmenu

This is, of course, dependent on implementing this behaviour in each lens. The advantage of this is that arbitrary errors which don't cause failure can be ignored if desired, or highlighted otherwise. Specifically for virt-v2v, a misconfigured grub serial console won't prevent me from working out which kernel is supposed to be booted.

Firstly, do people agree this is the right thing to do?

Secondly, I only dip occasionally into lens development. I believe that implementing the above will require the use of a fall-through or a wildcard match. Wouldn't this cause a problem with common prefixes? I'm not sure how I'd go about implementing this.

Thanks,

Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490

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

Reply via email to