Open DavidS opened 5 years ago
I don't need full manifest information, but I would love the get()
method for a resource to be able to get the full context on all of that type of resource specified in the manifest. With simple_get_filter
I can get a list of resource names, but not the arguments.
My use case is the puppetlabs-git
git_config
provider. The get()
method would ostensibly be able to enumerate all git configs on a system, but the provider supports setting git configs per user. So enumerating all configs means iterating over all users, which in some environments is not an option. If the set of resources from the catalog was available, I could at least enumerate the current status of those. I realize this means that we can't ensure absent in an idempotent manner. It would also allow me to match the functionality of the low-level provider (which specifies value()
, value=()
, and mk_resource_methods()
).
my use case above does not apply here after all. I misunderstood that name
and names
parameters are actually hashes with all namevars, which is sufficient for my case.
Edited the description with a possible implementation path.
Implemented in #284
Example for how this is currently used/implemented:
https://github.com/puppetlabs/puppetlabs-sqlserver/blob/b36eecf3fdadb3d45c9691fcac2e92c66fa3ad30/lib/puppet/provider/sqlserver_tsql/mssql.rb#L16-L26
Puppet::Type
'sresource.catalog.resources
provides access to other resources in the current catalog.Possible implementation:
raw_catalog_access
feature flag to https://github.com/puppetlabs/puppet-resource_api/blob/bd93dbac616baa4ffa18c99a0b45946c9d474fec/lib/puppet/resource_api/type_definition.rb#L37catalog
accessor to https://github.com/puppetlabs/puppet-resource_api/blob/bd93dbac616baa4ffa18c99a0b45946c9d474fec/lib/puppet/resource_api/base_context.rb#L13resource.catalog
to context every time one is created iff theraw_catalog_access
feature is declared on the type definitionresource.catalog
is not available at the class level