Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grub2 does not add the /files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT path if it is missing #11

Closed
trevor-vaughan opened this issue Oct 26, 2015 · 5 comments

Comments

@trevor-vaughan
Copy link
Contributor

Attempted to apply the following with Puppet:

kernel_parameter { 'fips':
  value    => '1',
  bootmode => 'normal'
}

Received the following error:

Info: Applying configuration version '1445871089'
Notice: /Stage[main]/Main/Kernel_parameter[fips]/ensure: created
Debug: Puppet::Type::Kernel_parameter::ProviderGrub2: Save failure details:
/augeas/files/etc/default/grub/error/path = /files/etc/default/grub/GRUB_CMDLINE_LINUX_DEFAULT
/augeas/files/etc/default/grub/error/lens = /usr/share/augeas/lenses/dist/shellvars_list.aug:38.13-.78:
/augeas/files/etc/default/grub/error/message = Failed to match 
    { /quote/ = /'/ }({ /value/ = /[^\001-\004\t\n ']+/ }{ /value/ = /[^\001-\004\t\n ']+/ }*)? | { /quote/ = /"/ }({ /value/ = /([^\001-\004\t\n "\\]|\\\\[^\001-\004\n])+/ }{ /value/ = /([^\001-\004\t\n "\\]|\\
\\[^\001-\004\n])+/ }*)? | { /quote/ = // }{ /value/ = /(([^\001-\004\t\n "'\\]|\\\\[^\001-\004\n])+)+/ }?
  with tree
    { "value" = "fips=1" }
Error: /Stage[main]/Main/Kernel_parameter[fips]: Could not evaluate: Failed to save Augeas tree to file. See debug logs for details.

This appears to be because GRUB_CMDLINE_LINUX_DEFAULT is not present in /etc/default/grub by default and should be created by Augeas if it is not present in the file.

Ideally, it would default to whatever GRUB_CMDLINE_LINUX has in it at the time of creation.

@raphink
Copy link
Member

raphink commented Oct 26, 2015

Good catch it seems. Could you try to provide tests for this?

@trevor-vaughan
Copy link
Contributor Author

Here you go: https://github.com/trevor-vaughan/grub_test

bundle
rake acceptance

@raphink
Copy link
Member

raphink commented Oct 28, 2015

OK. I would have preferred a PR adding a test to this module instead of external code.

@trevor-vaughan
Copy link
Contributor Author

Fair enough.

Are you OK with the approach that I used in that link? I can port it in, just not for a few days.

@raphink
Copy link
Member

raphink commented Oct 28, 2015

Take your time. I'm afk for another 10 days, can't really thoroughly review from my phone.

trevor-vaughan added a commit to trevor-vaughan/augeasproviders_grub that referenced this issue Jan 9, 2016
* Ensure that any missing element is created before attemping to be
  modified. This prevents Augeas failures.

* Copy GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT if the latter
  does not exist.

* Added Beaker tests to cover these two cases and allow for further
  practical expansion.

Fixes voxpupuli#11
trevor-vaughan added a commit to trevor-vaughan/augeasproviders_grub that referenced this issue Jan 9, 2016
* Ensure that any missing element is created before attemping to be
  modified. This prevents Augeas failures.

* Copy GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT if the latter
  does not exist.

* Added Beaker tests to cover these two cases and allow for further
  practical expansion.

Fixes voxpupuli#11
trevor-vaughan added a commit to trevor-vaughan/augeasproviders_grub that referenced this issue Feb 25, 2016
* Ensure that any missing element is created before attemping to be
  modified. This prevents Augeas failures.

* Copy GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT if the latter
  does not exist.

* Added Beaker tests to cover these two cases and allow for further
  practical expansion.

Fixes voxpupuli#11
trevor-vaughan added a commit to trevor-vaughan/augeasproviders_grub that referenced this issue Mar 3, 2016
* Ensure that any missing element is created before attemping to be
  modified. This prevents Augeas failures.

* Copy GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT if the latter
  does not exist.

* Added Beaker tests to cover these two cases and allow for further
  practical expansion.

Fixes voxpupuli#11
trevor-vaughan added a commit to trevor-vaughan/augeasproviders_grub that referenced this issue Mar 3, 2016
* Ensure that any missing element is created before attemping to be
  modified. This prevents Augeas failures.

* Copy GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT if the latter
  does not exist.

* Added Beaker tests to cover these two cases and allow for further
  practical expansion.

Fixes voxpupuli#11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants