Code Monkey home page Code Monkey logo

Comments (6)

Hufschmidt avatar Hufschmidt commented on September 27, 2024

Maybe this helps. It seems like (at least with array_append => true) the value parameter needs to be part of the unique resource name (aka composite name)...

EDIT:
I don't know if properties can be used as (composite-) namevar, looking at this seems like yes, which would be a rather easy solution. Or we could try to use a similar trick as with the package type, see here

Otherwise I think the only solution is go the way of puppetlabs-inifile#subsetting and introduce a new (namevar-) parameter sub_variable as replacement for array_append, such that the above resources can have unique names.

from puppet-augeasproviders_shellvar.

raphink avatar raphink commented on September 27, 2024

I'm not really sure to understand how switching the title_patterns method would break this.

In any case:

  • I'm pretty sure array_append has nothing to do with this, it's just the fact of having two resources with the same target/variable combination
  • Properties cannot be used as namevars, as namevars need to be parameters since they identify the resource as primary keys.

Mainly, I can't reproduce this either on Puppet 4.10 or 5.5. Which version of Puppet are you using?

from puppet-augeasproviders_shellvar.

Hufschmidt avatar Hufschmidt commented on September 27, 2024
  • I'm pretty sure array_append has nothing to do with this, it's just the fact of having two resources with the same target/variable combination

Oh ok, thanks you for clearing this confusion. I thought this is the intended use-case, similar to puppetlabs-inifile subsetting parameter.

Mainly, I can't reproduce this either on Puppet 4.10 or 5.5. Which version of Puppet are you using?

This happened with Puppet 4.10.

Since I was able to solve this using hercules-team/augeasproviders_grub instead and given your above explanation I think we can close this issue as it seems to be the intended behavior.

from puppet-augeasproviders_shellvar.

kenyon avatar kenyon commented on September 27, 2024

Running into this exact same problem now with Puppet 6.27.0 and augeasproviders_shellvar v5.0.0. 😒 I'm even trying to set the same variable in the same file as the original reporter, GRUB_CMDLINE_LINUX in /etc/default/grub, because I gave up on augeasproviders_grub due to voxpupuli/puppet-augeasproviders_grub#51 and voxpupuli/puppet-augeasproviders_grub#74 (it also has the same alias problem too though, if you want to set the same parameters for multiple bootmodes as you need to do to support both RHEL and Debian and need to modify GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX).

It's starting to look like I might need to use file_line or just manage the whole /etc/default/grub file.

Update: turns out that /etc/default/grub doesn't really do anything on RHEL 8. So I'm using puppet module atsonkov/grubby to manage the grub config there. Reference: https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault

Eventually I think this problem will go away for /etc/default/grub because that file will be irrelevant assuming Debian adopts the BLS like Fedora/RHEL have: https://uapi-group.org/specifications/specs/boot_loader_specification/

from puppet-augeasproviders_shellvar.

kenyon avatar kenyon commented on September 27, 2024

Silly workaround, but it seems to work fine: add extra slashes to the target path.

shellvar { 'wanted kernel parameters':
  ensure       => present,
  variable     => 'GRUB_CMDLINE_LINUX',
  target       => '/etc/default//grub',
  value        => [
    'audit=1',
  ],
  array_append => true,
  notify       => Exec['update-grub'],
}

shellvar { 'unwanted kernel parameters':
  ensure       => absent,
  variable     => 'GRUB_CMDLINE_LINUX',
  target       => '/etc/default/grub',
  value        => [
    'nomodeset',
    'quiet',
    'splash',
  ],
  array_append => true,
  notify       => Exec['update-grub'],
}

from puppet-augeasproviders_shellvar.

P6wG7 avatar P6wG7 commented on September 27, 2024

Got the same issue with puppet 8.5.1 and this very small patch fixed on my side:

diff --git a/lib/puppet/type/shellvar.rb b/lib/puppet/type/shellvar.rb
index 70c99c6..97378ae 100644
--- a/lib/puppet/type/shellvar.rb
+++ b/lib/puppet/type/shellvar.rb
@@ -55,6 +55,7 @@ Puppet::Type.newtype(:shellvar) do
 
   newparam(:name) do
     desc 'The default namevar'
+    isnamevar
   end
 
   newparam(:variable) do

This is added in that PR: #61

from puppet-augeasproviders_shellvar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.