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

provider supports prefetch, but puppet resource sysctl does not show any values #35

Open
tuxmea opened this issue Aug 1, 2019 · 7 comments

Comments

@tuxmea
Copy link
Member

tuxmea commented Aug 1, 2019

When using puppet resource sysctl no values are shown.
Even when specifying the sysctlk setting no values are shown:

puppet resource sysctl net.ipv4.ip_forward
sysctl { 'net.ipv4.ip_forward':
  ensure => present,
}
@tuxmea
Copy link
Member Author

tuxmea commented Aug 1, 2019

@SimonHoenscheid : fyi

@raphink
Copy link
Member

raphink commented Aug 5, 2019

Tbh I never really understood how to make all params/properties show there. The values are stored properly in the @property_hash but they're not showing in the output…

@tuxmea
Copy link
Member Author

tuxmea commented Oct 21, 2019

Analysis:
The resources hash is built properly:

{:name=>"vm.zone_reclaim_mode", :ensure=>:present, :value=>"0", :apply=>:true, :persist=>:false}

At the end of instances method we build the result:

@resource_cache = resources.map{|x| x = new(x)}

But resource_hash is set to (provider=augeas) only.

What does the new method do?
I always thought that it sets available parameters of the type to their values.

@raphink any clue?
@DavidS
@dev_el_ops

@alexjfisher
Copy link
Member

Ok... So I had a little look at this.

instances does correctly set everything in @property hash. In most providers, mk_resource_methods would be used to create 'getters' and 'setters' for each property based on @property_hash. In this provider, that isn't the case. attr_aug_accessor (from the parent provider) is used for val/value (comment is slightly different again).

So the getter than gets called has a completely different implementation to fetching values than was used in instances. (augeas only vs a mix of augeas and sysctl -a)

@alexjfisher
Copy link
Member

Maybe @domcleal could shed some light on the current implementation ;) I assume there was a good reason for the current strategy, and attempting to 'fix' it, might be complicated/unwise.

@alexjfisher
Copy link
Member

Actually I think @trevor-vaughan might know more. Before #15 instances didn't look at all settings and there wasn't any caching in that method either.

@trevor-vaughan
Copy link
Contributor

So, what seems to be going on is that the current provider is missing a couple of features.

  1. It needs to merge all items in every file that is managed
  2. It needs to add a parameter that is the target file. This will need to be deconflicted with the entire stack but will allow for retrieval and comparison of all live and stored items.

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

4 participants