Closed tparkercbn closed 5 years ago
@tparkercbn Can you please test this directly with augtool
to help pinpoint whether it is a lens issue or a provider issue?
Interesting (and unexpected). If you add single quotes inside your double quotes around the value
parameters in your resource declarations does that work or is it invalid?
Sorry. I deleted the prevous comment as I realized that it was still in an error state so the quotes change were not actually helping. I added a set of \" \" to my value and that works.
My working config is this:
grub_config {'GRUB_TERMINAL':
value => "\"${join($boot::grub_terminals, ' ')}\"",
notify => Exec['update-grub-config'],
}
grub_config {'GRUB_SERIAL_COMMAND':
value => "\"serial --unit=0 --speed=${boot::serialconsole}\"",
notify => Exec['update-grub-config'],
}
augtool> get etc/default/grub/GRUB_TERMINAL etc/default/grub/GRUB_TERMINAL = "console serial" augtool> set etc/default/grub/GRUB_TERMINAL '"console serial foo"' augtool> save Saved 1 file(s) augtool> set etc/default/grub/GRUB_TERMINAL '"console serial"' augtool> save Saved 1 file(s) augtool>
OK, should be easy enough to fix.
Everything looks OK in your /etc/default/grub
file after adding the quotes, right?
yes. The values are double quoted as expected:
Notice: /Stage[main]/Boot::Grub2/Grub_config[GRUB_TERMINAL]/value: value changed '"console serial foo"' to '"console serial"'
cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_CMDLINE_LINUX="root=/dev/vdb console=tty1 console=ttyS0,115200n8 rd.net.timeout.dhcp=2 biosdevname=0 net.ifnames=0" GRUB_DISABLE_RECOVERY="true" GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200" GRUB_DISABLE_OS_PROBER="true"
Rolling this and #45 into the same patch. Should have a PR later tonight.
if you have a branch I can clone I can give it a test.
I'm getting very odd behaviour now.
1. The boolean value is being "corrected" on every run but makes no changes to /etc/default/grub
Notice: /Stage[main]/Boot::Grub2/Grub_config[GRUB_DISABLE_OS_PROBER]/value: value changed '"true"' to 'true' (corrective)
If the lines with spaces do not exist in the file at all: Notice: /Stage[main]/Boot::Grub2/Grub_config[GRUB_TERMINAL]/ensure: created (corrective) Debug: Puppet::Type::Grub_config::ProviderGrub2: Save failure details: /augeas/files/etc/default/grub/error/path = /files/etc/default/grub/files/etc/default/grub/GRUB_TERMINAL /augeas/files/etc/default/grub/error/lens = /opt/puppetlabs/puppet/share/augeas/lenses/dist/shellvars.aug:70.18-.39: /augeas/files/etc/default/grub/error/message = None of the alternatives in the union match Error: /Stage[main]/Boot::Grub2/Grub_config[GRUB_TERMINAL]: Could not evaluate: Failed to save Augeas tree to file. See debug logs for details.
If the lines exist but are wrong: Nothing happens at all, it's as if that setting is not in the catalog.
I think I've isolated it in the acceptance tests. Will get those working and prod again when I can.
Sounds good! I have a working config with the \" workaround for now. Let me know if I can help with more testing. I have an r10k environment setup to pull from your branch.
@tparkercbn Try again whenever you get a chance
Good morning.
I have been completely unable to get this to break no matter what I throw at it.
Thank you very much for the fixes, it's working perfectly.
grub_config values with spaces cause augeus errors:
Notice: /Stage[main]/Boot::Grub2/Grub_config[GRUB_TERMINAL]/value: value changed '"console serial"' to 'console serial' Error: /Stage[main]/Boot::Grub2/Grub_config[GRUB_TERMINAL]: Could not evaluate: Failed to save Augeas tree to file. See debug logs for details.
Notice: /Stage[main]/Boot::Grub2/Grub_config[GRUB_SERIAL_COMMAND]/value: value changed '"serial --unit=0 --speed=115200"' to 'serial --unit=0 --speed=115200' Error: /Stage[main]/Boot::Grub2/Grub_config[GRUB_SERIAL_COMMAND]: Could not evaluate: Failed to save Augeas tree to file. See debug logs for details.