collect only unique providers #275

merged 2 commits into from Jan 16, 2014

2 participants


Noticed the provides_map would contain multiple copies of the same plugin under attr[:_plugins]. This changes the provides_map so that it saves only one copy of a plugin in attr[:_plugins].

@danielsdeleo @sersut

Chef Software, Inc. member

I thought I'd solved this problem by modifying the plugin loader code to build the dependency map in one go and then instantiate all the plugins. Do you have more info on how this situation occurs?


OK I just figured out what's really going on with this...

Once all the plugin classes have been loaded, @v7_plugin_classes contains each unique plugin class. Looking at the CPU plugin shows Ohai::NamedPlugin::CPU.provides_attrs = ["cpu", "cpu", "cpu", ... "cpu"], one for each file that declares provides "cpu", 9 total.

We need to do a uniq over the provided attributes. I can put that in.


OK this should do it. @danielsdeleo

Chef Software, Inc. member

Looks good to me.

@mcquin mcquin merged commit 17369e5 into master Jan 16, 2014

1 check passed

Details default The Travis CI build passed
@mcquin mcquin deleted the provides-map-plugin-uniqueness branch Jan 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment