badgerious / puppet-wmi_obj

Manage WMI (Windows Management Instrumentation) objects with Puppet.
Other
3 stars 1 forks source link

Potential Logic change to fix long query time #1

Open PeterHiggins opened 8 years ago

PeterHiggins commented 8 years ago

Hello badgerious,

I was attempting to use your module to manage a large number of wmi objects. There is a 20 second delay if a wmi query is run with properties set to empty strings. In my use case there are some properties which are key properties of the wmi object, they do not need to be set, but must be created as they are key properties.

The validation in your module forces me to set these empty properties in the resource definition, which results in > 45 minute execution time for the puppet run (I have 92 wmi objects to create).

When I create these wmi objects with powershell if I omit the 'empty' key properties they are created anyway.

I have re-worked your module somewhat to do the following:

  1. create all the key properties whether defined in the resource def or not.
  2. only check the values of the properties defined in the resource def.
  3. only use the defined properties in the catalog alias

This has the benefit of still allowing an empty wmi_obj paramter to be defined if it is desirable to enforce an empty state, while removing the burden on the puppet user to define values for key properties that they are not interested in.

I can share the changes I have made if they are more widely considered useful, I'm not sure if the logic is generally acceptable or if it is specific to my use case.

Cheers,

Peter.

badgerious commented 8 years ago

Hi Peter,

Interesting... Why is there a 20 second delay when running queries with empty strings? Could you provide an example of a query that runs long with empty strings but quickly with non-empty? I'm curious.

I can certainly give your changes a review. I'll admit that it may be difficult to determine general applicability; I don't receive much feedback about this module and don't have a good idea of how it's used by people other than me.