You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 24, 2019. It is now read-only.
input_mdoule_puppet_enterprise_factor.py throws an exception if a fact isn't returned by the HTTP(S) request. A value (even for a built-in fact) can be absent for legitimate reasons. In my environment, for example, many of our servers disable IPv6, so the ipaddress6 fact is not present. The resulting behavior is that the splunk add-on only collects facts for the nodes that have all the facts which are hard-coded in input_module_puppet_enterprise_factor.py. As soon as a node is encountered for which one of those facts is absent, an exception is thrown (KeyError) and no more are processed.
I think there 2 good solutions to this:
If it's not necessary to hard code the key names, you should be able to populate the dictionary dynamically based on the key names that are in the the JSON.
Note: If you don't need to hard code the key names, but you do need to ensure that the resulting dictionaries all have consistent keys, then you could simply collect all unique key_names in an array while looping over the JSON and then massage the resulting dictionaries so that they all contain the same keys, even if some of those keys will not have a value. This strategy, while not optimal from a performance perspective, does ensure that custom facts are also available in the Splunk fact reports (I think).
If it's necessary to hard code the key names, define them in an array somewhere. Then, in the dictionary 'merging' section, you can loop over that array, catching the KeyError exceptions to avoid exiting prematurely.
input_mdoule_puppet_enterprise_factor.pythrows an exception if a fact isn't returned by the HTTP(S) request. A value (even for a built-in fact) can be absent for legitimate reasons. In my environment, for example, many of our servers disable IPv6, so theipaddress6fact is not present. The resulting behavior is that the splunk add-on only collects facts for the nodes that have all the facts which are hard-coded ininput_module_puppet_enterprise_factor.py. As soon as a node is encountered for which one of those facts is absent, an exception is thrown (KeyError) and no more are processed.I think there 2 good solutions to this:
KeyErrorexceptions to avoid exiting prematurely.