GithubHelp home page GithubHelp logo

voxpupuli / puppet-augeasproviders_core Goto Github PK

View Code? Open in Web Editor NEW
10.0 39.0 40.0 767 KB

Alternative Augeas-based providers for Puppet, core library http://augeasproviders.com/

License: Apache License 2.0

Ruby 100.00%
augeas puppet augeasproviders configuration configuration-management configuration-files library puppet-resources puppet-module hacktoberfest

puppet-augeasproviders_core's Introduction

augeasproviders_core: library for building alternative Augeas-based providers for Puppet

Build Status Release Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores puppetmodule.info docs Apache-2 License Donated by Camptocamp

Module description

This module provides a library for module authors to create new types and providers around config files, using the Augeas configuration library to read and modify them.

The advantage of using Augeas over the default Puppet parsedfile implementations is that Augeas will go to great lengths to preserve file formatting and comments, while also failing safely when needed.

If you're a user, you want to see the main augeasproviders project at augeasproviders.com.

Requirements

Ensure both Augeas and ruby-augeas 0.3.0+ bindings are installed and working as normal.

See Puppet/Augeas pre-requisites.

Development documentation

See docs/ (run make) or augeasproviders.com.

Issues

Please file any issues or suggestions on GitHub.

Transfer Notice

This plugin was originally authored by hercules-team. The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance. Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.

Previously: https://github.com/hercules-team/augeasproviders_core

puppet-augeasproviders_core's People

Contributors

alexjfisher avatar b4ldr avatar bastelfreak avatar ckaenzig avatar crayfishx avatar domcleal avatar ekarlso avatar ekohl avatar gregswift avatar h-haaks avatar jamespwilliams avatar lollipopman avatar maxadamo avatar raphink avatar smortex avatar treydock avatar tuxmea avatar vchepkov avatar zilchms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-augeasproviders_core's Issues

Wildcards in default_file block

I'm trying to create a new provider for managing devices in RANCiD using the lens I've created in hercules-team/augeas/pull/514 and I need to use a wildcard to match potentially multiple files with the pattern /etc/rancid/*/router.db. The lens in question works in augtool as a standalone lens with this pattern but I've found I can't use the same pattern in the default_file block as it hits https://github.com/hercules-team/augeasproviders_core/blob/604680cb5fe7e32fd1ad1051fc34ef100a4d6923/lib/puppet/provider/augeasprovider/default.rb#L555 which errors when there are multiple matches.

If I comment out that line then the provider seems to work using puppet resource rancid_device ... however I can see in the code there are a few places which expect to be given a single file and it's likely only working by fluke.

My provider is here: https://github.com/bodgit/puppet-rancid/blob/master/lib/puppet/provider/rancid_device/augeas.rb

I'm not sure if the answer is some Dir.glob action somewhere?

How do I install the prerequisites?

Your website and forge documentation both say to install Augeas and the Ruby bindings. The link to the Puppet/Augeas docs reference a non-existing "pre-requisites" section. As-is, I'm unable to figure out both what to install or how to install it.

Requirements

Ensure both Augeas and ruby-augeas 0.3.0+ bindings are installed and working as normal.

See Puppet/Augeas pre-requisites.

The Puppet augeas_core documentation says everything should already be installed? But, that's not what I'm seeing when I try to use the sysctl resource (for example).

The augeas libraries and ruby bindings must be installed in order to use this module. If you are using puppet-agent packages, then those prerequisites are already satisfied for most platforms.

I don't want to manually install anything except Puppet on this box, so I'm not going to run yum install augeas.

I don't have a system Ruby installed, although Puppet vendors one, but I don't think I'm supposed to use it directly. And I'm not going to run gem install ruby-augeas. That gem is pre-release and it's not been updated for many years.

Oracle Linux support

Can we add:

{
  "operatingsystem": "OracleLinux",
  "operatingsystemrelease": [
    "7",
    "8"
  ]
},

Into metadata.json

I've been doing this myself as it works fine for my needs. Which I can continue to do if there are other functions that perhaps I'm not utilizing that do not work in Oracle Linux. It is rebranded RedHat so I'm not sure what the issue is, but not having this is a show stopper for any Puppet module that requires augeasproviders_core.

Oracle Linux admins are out here. :)

[Regression] Could not evaluate: undefined method `[]' for nil:NilClass

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.25.0
  • Ruby: AIO bundled ruby
  • Distribution: Almalinux 9
  • Module version: 4.0.0

How to reproduce (e.g Puppet code you use)

include sysctl_conf

and

sysctl_conf::values:
  fs.suid_dumpable:
    value: 0
    comment: do not core dump suid/sgid binaries
  fs.protected_hardlinks:
    value: 1
    comment: cannot link if do not have read/write access to it.
  fs.protected_symlinks:
    value: 1
    comment: cannot link if do not have read/write access to it.
  fs.protected_fifos:
    value: 2
    comment: cannot use fifo if do not have read and write access to it.
  vm.mmap_min_addr:
    value: 65536
    comment: non-root cannot user low mem
  vm.overcommit_memory:
    value: 0
    comment: should we overcommit memory
  vm.panic_on_oom:
    value: 0

And so on

What are you seeing

Errors in catalog

What behaviour did you expect instead

No errors

Output log

Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[fs.suid_dumpable]/Sysctl[fs.suid_dumpable]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[fs.protected_hardlinks]/Sysctl[fs.protected_hardlinks]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[fs.protected_symlinks]/Sysctl[fs.protected_symlinks]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[fs.protected_fifos]/Sysctl[fs.protected_fifos]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[vm.mmap_min_addr]/Sysctl[vm.mmap_min_addr]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[vm.overcommit_memory]/Sysctl[vm.overcommit_memory]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[vm.panic_on_oom]/Sysctl[vm.panic_on_oom]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.dmesg_restrict]/Sysctl[kernel.dmesg_restrict]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.domainname]/Sysctl[kernel.domainname]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.panic_on_oops]/Sysctl[kernel.panic_on_oops]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.task_delayacct]/Sysctl[kernel.task_delayacct]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.keys.root_maxbytes]/Sysctl[kernel.keys.root_maxbytes]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.keys.root_maxkeys]/Sysctl[kernel.keys.root_maxkeys]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.kptr_restrict]/Sysctl[kernel.kptr_restrict]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.perf_event_paranoid]/Sysctl[kernel.perf_event_paranoid]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.randomize_va_space]/Sysctl[kernel.randomize_va_space]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.sched_autogroup_enabled]/Sysctl[kernel.sched_autogroup_enabled]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.unprivileged_bpf_disabled]/Sysctl[kernel.unprivileged_bpf_disabled]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[kernel.yama.ptrace_scope]/Sysctl[kernel.yama.ptrace_scope]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[net.core.netdev_max_backlog]/Sysctl[net.core.netdev_max_backlog]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[net.ipv4.tcp_mtu_probing]/Sysctl[net.ipv4.tcp_mtu_probing]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[net.core.wmem_max]/Sysctl[net.core.wmem_max]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[net.core.rmem_max]/Sysctl[net.core.rmem_max]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[net.core.netdev_budget]/Sysctl[net.core.netdev_budget]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[vm.dirty_ratio]/Sysctl[vm.dirty_ratio]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[vm.dirty_background_ratio]/Sysctl[vm.dirty_background_ratio]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[vm.zone_reclaim_mode]/Sysctl[vm.zone_reclaim_mode]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[user.max_user_namespaces]/Sysctl[user.max_user_namespaces]: Could not evaluate: undefined method `[]' for nil:NilClass
Error: /Stage[main]/Sysctl_conf/Sysctl_conf::Entry[user.max_net_namespaces]/Sysctl[user.max_net_namespaces]: Could not evaluate: undefined method `[]' for nil:NilClass

Any additional information you'd like to impart

The previous vox version (3.2.1) is in use in my production environment without issues.

Working:

mod 'puppet-augeasproviders_core', '3.2.1'
mod 'puppet-augeasproviders_grub', '5.0.0'
mod 'puppet-augeasproviders_shellvar', '6.0.0'
mod 'puppet-augeasproviders_sysctl', '3.1.0'
mod 'deric-sysctl_conf', '0.4.0'

Not working:

mod 'puppet-augeasproviders_core', '4.0.0'
mod 'puppet-augeasproviders_grub', '5.0.0'
mod 'puppet-augeasproviders_shellvar', '6.0.0'
mod 'puppet-augeasproviders_sysctl', '3.1.0'
mod 'deric-sysctl_conf', '0.4.0'

Ruby 2.4.0 Error: Failed to apply catalog: private method `open' called for Augeas:Class

ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

Running the most recent augeas gem, and 2.1.3 of this module, I get the following error.

$ puppet agent -t --trace
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for host.example.com
Info: Applying configuration version '13790f4f01245edc85ff6bb19cb39a9c86244a61'
Error: Failed to apply catalog: private method `open' called for Augeas:Class
Did you mean?  open3
/opt/puppetlabs/puppet/cache/lib/puppet/provider/augeasprovider/default.rb:70:in `aug_handler'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/augeasprovider/default.rb:670:in `augopen_internal'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/augeasprovider/default.rb:109:in `augopen'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/host/augeas.rb:45:in `get_resources'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/host/augeas.rb:62:in `block in prefetch'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/host/augeas.rb:62:in `each'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/host/augeas.rb:62:in `inject'
/opt/puppetlabs/puppet/cache/lib/puppet/provider/host/augeas.rb:62:in `prefetch'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/transaction.rb:323:in `prefetch'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/transaction.rb:223:in `prefetch_if_necessary'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/transaction.rb:107:in `block in evaluate'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/graph/relationship_graph.rb:116:in `traverse'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/transaction.rb:154:in `evaluate'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/resource/catalog.rb:222:in `block in apply'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/util/log.rb:155:in `with_destination'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/transaction/report.rb:142:in `as_logging_destination'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/resource/catalog.rb:221:in `apply'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/configurer.rb:171:in `block in apply_catalog'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/util.rb:223:in `block in benchmark'
/usr/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/util.rb:222:in `benchmark'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/configurer.rb:170:in `apply_catalog'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/configurer.rb:343:in `run_internal'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/configurer.rb:221:in `block in run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/context.rb:65:in `override'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet.rb:241:in `override'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/configurer.rb:195:in `run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:45:in `block (4 levels) in run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent/locker.rb:21:in `lock'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:45:in `block (3 levels) in run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:98:in `with_client'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:42:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:65:in `run_in_fork'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:41:in `block in run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/application.rb:179:in `controlled_run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/agent.rb:39:in `run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/application/agent.rb:353:in `onetime'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/application/agent.rb:331:in `run_command'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/application.rb:344:in `block in run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/util.rb:540:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/application.rb:344:in `run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/util/command_line.rb:132:in `run'
/usr/lib/ruby/vendor_ruby/2.4.0/puppet/util/command_line.rb:72:in `execute'
/usr/bin/puppet:5:in `<main>'

Dependency issue with the augeasproviders ecosystem after adoption

Sorry that i ditched the template here, but this issue is more general.

It is nice, that this module experiences better maintenance under the voxpupuli umbrella, but it is the base for a whole ecosystem of "addon"-modules (https://forge.puppetlabs.com/modules/herculesteam), these "addon"-modules have the previous herculesteam-augeasproviders_core as dependency, which is now broken.
Technically it still works, if you use those addons with this adopted core module, but it is not a clean depencency management. If you do proper dependency resolution (like we do) it is broken.

Is it planned to adopt the other modules as well, or will the original author update them to fix the dependency?

Dependency Issue with Librarian

Hello,

I am trying to utilize 'augeasproviders' in a Puppetfile but it looks to be having a dependency issue that cannot be resolved:

[Librarian] Resolving herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]   Checking manifests
[Librarian]   Module herculesteam-augeasproviders_grub found versions: 3.1.0, 3.0.1, 3.0.0, 2.4.0, 2.3.0, 2.2.0, 2.1.0, 2.0.1, 2.0.0
[Librarian]     Checking herculesteam-augeasproviders_grub/3.1.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/3.1.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/3.1.0 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/3.0.1 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/3.0.1 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/3.0.1 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/3.0.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/3.0.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/3.0.0 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/2.4.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/2.4.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/2.4.0 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/2.3.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/2.3.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/2.3.0 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/2.2.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/2.2.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/2.2.0 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/2.1.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/2.1.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/2.1.0 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/2.0.1 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/2.0.1 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/2.0.1 <https://forgeapi.puppetlabs.com>
[Librarian]     Checking herculesteam-augeasproviders_grub/2.0.0 <https://forgeapi.puppetlabs.com>
[Librarian]       Conflict between herculesteam-augeasproviders_grub/2.0.0 <https://forgeapi.puppetlabs.com> and herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
[Librarian]       Backtracking from herculesteam-augeasproviders_grub/2.0.0 <https://forgeapi.puppetlabs.com>
[Librarian]   Failed to resolve herculesteam-augeasproviders_grub (< 4.0.0, > 3.1.0) <(no source specified)>
Could not resolve the dependencies.

According to the Forge, the dependency for augeasprovideers_grub is >3.1.0 < 4.0.0:

https://forge.puppet.com/herculesteam/augeasproviders/dependencies

herculesteam/augeasproviders_grub (>3.1.0 <4.0.0)

The latest available version of augeasproviders_grub is 3.1.0 so this looks to be causing dependency resolution to fail.

Should it be >=3.1.0 to allow it to resolve the current version (3.1.0)?

Thanks

Travis

Puppet 6

I've written a few custom types using this module as a base and I'm finding that code that used to work fine on Puppet 4.x & 5.x is now breaking on 6.x when I try and run my tests.

It seems to be breaking in the provider(s) on the first line:

Puppet::Type.type(:my_shiny_type).provide(:augeas, :parent => Puppet::Type.type(:augeasprovider).provider(:default)) do

Puppet::Type.type(:augeasprovider) is returning Nil despite having the same path hacks that work in 4.x & 5.x.

Any ideas?

Delete property value

Hi,

I'm deploying a custom type to configure nagios contacts with augeas.

If I'm understanding well, according to http://augeasproviders.com/documentation/development.html if I want to be to remove a property I should use the :rm_node option in the accesor.

In my type I have the property defined as:

newproperty(:service_notification_options) do
    desc 'Nagios configuration file parameter.'
    validate do |value|
      if !value.match?(/^([wucrfsn](,[wucrfsn])*)?$/) then
        raise ArgumentError, "service_notification_options must be a comma separated list of 'w', 'u', 'c', 'r', 'f', 's', 'n' (#{value} provided)"
      end
    end
  end
end

and in the provider I get:

attr_aug_accessor(:service_notification_options,
                    :label => 'service_notification_options',
                    :type => :string,
                    :rm_node => true,
                   )

but with this code I have tried to remove the service_notification_options of a contact, but I can't. The contact in my file is:

define contact {
name fulanito
contact_name fulanito
can_submit_commands 1
email [email protected]
retain_nonstatus_information 1
service_notification_options w
}

I have tried not using the service_notification_options in the puppet resource and passing an empty value, like:

um_nagios_contact {'fulanito':
  target                       => '/tmp/contacts.cfg',
  contact_name                 => 'fulanito',
  email                        => '[email protected]',
  can_submit_commands          => 1,
  retain_nonstatus_information => 1,
  service_notification_options => '',
}

or

um_nagios_contact {'fulanito':
  target                       => '/tmp/contacts.cfg',
  contact_name                 => 'fulanito',
  email                        => '[email protected]',
  can_submit_commands          => 1,
  retain_nonstatus_information => 1,
  service_notification_options => undef,
}

How is the correct way to handle property removal? Or do I have to code myself the writer for the property?

Error while installing puppet module camptocamp/openldap 1.14.0

Hello Team,

I am getting the below error while installing puppet module.

Puppet Module: (puppet version is 3.7.4)

puppet module install puppetlabs/postgresql --version 4.7.1
puppet module install camptocamp/openldap --version 1.14.0
puppet module install puppetlabs/firewall --version 1.8.0

Error: /Stage[main]/Openldap::Server::Config/Shellvar[SLAPD_LDAPS]: Could not evaluate: undefined method ‘context=’ for # (Augeas: 0x7f4609926390)
Error: /Stage[main]/Openldap::Server::Config/Shellvar[SLAPD_LDAP]: Could not evaluate: undefined method ‘context=’ for # (Augeas: 0x7f4609926390)

Please help me to resolve this issue. what could be the problem.

Thanks,
Raja Rajagopal

[Regression] Cannot alias Shellvar already declared

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.18.0
  • Ruby: ruby-3.0.3-159.el9.x86_64
  • Distribution: RHEL 9
  • Module version: 3.2.0

How to reproduce (e.g Puppet code you use)

include stdlib::manage
stdlib::manage::create_resources:
    shellvar:
        set_hostname_early:
            ensure: present
            variable: GRUB_CMDLINE_LINUX
            target: /etc/default/grub
            value: "hostname=%{facts.fqdn}"
            array_append: true
            notify: Exec[refresh_grub2_config]
        set_console_blank_timeout:
            ensure: present
            variable: GRUB_CMDLINE_LINUX
            target: /etc/default/grub
            value: consoleblank=0
            array_append: true
            notify: Exec[refresh_grub2_config]
        remove_dracut_rhgb_splash:
            ensure: absent
            target: /etc/default/grub
            variable: GRUB_CMDLINE_LINUX
            array_append: true
            value:
                - rhgb
                - splash
            notify: Exec[refresh_grub2_config]
        remove_dracut_quiet:
            ensure: absent
            target: /etc/default/grub
            variable: GRUB_CMDLINE_LINUX
            array_append: true
            value: quiet
            notify: Exec[refresh_grub2_config]
    exec:
        refresh_grub2_config:
            path: /usr/bin:/usr/sbin
            command: grub2-mkconfig -o /boot/grub2/grub.cfg
            onlyif: test $(stat --format=%Y /etc/default/grub) -gt $(stat --format=%Y /boot/grub2/grub.cfg)
            provider: shell
mod 'puppetlabs-stdlib', '8.4.0'
mod 'puppet-augeasproviders_core', '3.2.0'
mod 'herculesteam-augeasproviders_shellvar', '4.1.0'

What are you seeing

Catalog fails to compile with voxpupuli module

What behaviour did you expect instead

Catalog continues to compile

Output log

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Cannot alias Shellvar[set_console_blank_timeout] to ["/etc/default/grub", "GRUB_CMDLINE_LINUX"] at (file: /etc/puppetlabs/code/environments/production/modules/stdlib/manifests/manage.pp, line: 49); resource ["Shellvar", "/etc/default/grub", "GRUB_CMDLINE_LINUX"] already declared (file: /etc/puppetlabs/code/environments/production/modules/stdlib/manifests/manage.pp, line: 49) (file: /etc/puppetlabs/code/environments/production/modules/stdlib/manifests/manage.pp, line: 49, column: 7) on node

Any additional information you'd like to impart

It appears that the array_append: true setting is either being lost in translation or not being propagated to the alias.

mod 'herculesteam-augeasproviders_core', '3.1.0' does not show this issue.

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.