one
one copied to clipboard
Case sensitive Augeas oned.conf lens
Description
Augeas lens for reading oned.conf-like configuration files is case sensitive, so it's easy to create redundant entries with different casing, which are not effective (i.e., only first occurance in unique parameters matter).
To Reproduce Steps to reproduce the behavior.
# augtool
augtool> print /files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DRIVER = "\"raw\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/CACHE = "\"none\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DISCARD = "\"unmap\""
augtool> set /files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DRIVER '"test"'
augtool> print /files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DRIVER = "\"test\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/CACHE = "\"none\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DISCARD = "\"unmap\""
augtool> set /files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/driver '"test"'
augtool> print /files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DRIVER = "\"test\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/CACHE = "\"none\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/DISCARD = "\"unmap\""
/files/etc/one/vmm_exec/vmm_exec_kvm.conf/DISK/driver = "\"test\"" # <---------------
augtool>
Expected behavior All path elements inside file, no matter the real casing, can be addressed simply (e.g., downcasing everything in memory structure on load, while preserving the original casing on save).
Details
- Version: 5.12.6
Progress Status
- [ ] Branch created
- [ ] Code committed to development branch
- [ ] Testing - QA
- [ ] Documentation
- [ ] Release notes - resolved issues, compatibility, known issues
- [ ] Code committed to upstream release/hotfix branches
- [ ] Documentation committed to upstream release/hotfix branches
To fix this it seems we would need to switch from non-specific lenses based on regex allowing arbitrary keys to more specific entries with enumerating allowed keys. So, instead
let name = key /[A-Z_0-9]+/`
we can have
let port = del /[pP][oO][rR][tT]/ "PORT" . label "PORT"
let name = ( port | ... )
This would work case-insensitive for line PORT=2633
IMO double definitions (caps sensitive or not) should be handled by the server-side too. OpenNebula should issue a warning or even raise an error for such issues. This will be more generic because such errors could be done not only with augeas lens.
For example, at the beginning I've usually was uncommenting the DB section to enable MySQL configuration, forgetting to comment the sqlite3 one which was leading to oned still using sqlite3... (it looks like the first match has precedence). Not exactly the case because the augeas lens actually resolved this case, but I think that you understand me.