Jira (PUP-11719) ModuleDataProvider::validate_data_hash does not prune hash as advertised

16 views
Skip to first unread message

Paul Gale (Jira)

unread,
Jan 18, 2023, 11:28:03 AM1/18/23
to puppe...@googlegroups.com
Paul Gale created an issue
 
Puppet / Bug PUP-11719
ModuleDataProvider::validate_data_hash does not prune hash as advertised
Issue Type: Bug Bug
Affects Versions: PUP 7.20.0
Assignee: Unassigned
Components: Hiera & Lookup
Created: 2023/01/18 8:27 AM
Priority: Normal Normal
Reporter: Paul Gale

Puppet Version: 7.20
Puppet Server Version:
OS Name/Version:

The function ModuleDataProvider::validate_data_hash is supposed to prune all hiera keys that are not prefixed with the configured module_name. It does not. Instead it returns the hash that it was called with unchanged. All pruning is done on a cloned version of the supplied hash that’s discarded.

https://github.com/puppetlabs/puppet/blob/main/lib/puppet/pops/lookup/module_data_provider.rb#L46

Desired Behavior:

  1. It should prune all hiera keys that are not prefixed with the configured module name.
  2. It should include the name of any offending key(s) in the warning message that it prints. The warning message as currently implemented doesn't provide the developer with any meaningful actionable information.

https://github.com/puppetlabs/puppet/blob/main/lib/puppet/pops/lookup/module_data_provider.rb#L54 should be modified to be something like:
Puppet.warning("Module '#{module_name}': #{msg}, key=#{k}") to help identify the offending key(s).

Actual Behavior:

Hiera keys not prefixed with the module name are not pruned from the supplied hash. No warning advising on the offending key(s) is printed.

Fix:

Delete this line and the pruned hash is returned:
https://github.com/puppetlabs/puppet/blob/main/lib/puppet/pops/lookup/module_data_provider.rb#L57

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Tony Vu (Jira)

unread,
Jan 31, 2023, 4:53:01 PM1/31/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages