Comments (6)
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.
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 sametarget
/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.
- I'm pretty sure
array_append
has nothing to do with this, it's just the fact of having two resources with the sametarget
/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.
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.
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.
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)
- Exporting array value fails HOT 1
- Shellvar doesn't work on Debian Squeeze HOT 10
- Cannot use both comment = "" and uncomment = true HOT 3
- Bulk updates requires a lot of studdering HOT 6
- problem with exclude in yum.conf HOT 2
- Add `alias` to ensure value HOT 3
- shellvar doesn't work properly for export HOT 4
- undefined method `split' for nil:NilClass when file contains managed variable name in comments with no assignment
- rspec Unknown resource type: 'shellvar' HOT 3
- Error with Puppet 5.3.3 HOT 2
- Add support for 'puppet generate types' HOT 1
- Support for Puppet 2019.x ? HOT 1
- shellvar crashes
- support ensure => sourced HOT 2
- Puppet7 support HOT 1
- shellvar: array + quoted not working HOT 1
- shellvar: quoted does not converge HOT 1
- Shellvar comment parameter make a mess of existing comments HOT 1
- shellvar: export + comment requires two passes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppet-augeasproviders_shellvar.