a )gG @sdddlmZmZmZeZddlZddlmm m Z ddl m Z ddlmZGdddeZdS))absolute_importdivisionprint_functionN)PrefixFactNamespace)BaseFactCollectorcsNeZdZdZdZeZdfdd ZddZdd Z d d Z dd d Z Z S)OhaiFactCollectorzIThis is a subclass of Facts for including information gathered from Ohai.ohaiNcs$tddd}tt|j||ddS)NrZohai_)Znamespace_nameprefix) collectors namespace)rsuperr__init__)selfr r  __class__I/usr/lib/python3.9/site-packages/ansible/module_utils/facts/other/ohai.pyr !s  zOhaiFactCollector.__init__cCs|d}|S)Nr)Z get_bin_path)rmodule ohai_pathrrr find_ohai's zOhaiFactCollector.find_ohaicCs||\}}}|||fSN)Z run_commandrrrrcouterrrrrrun_ohai+szOhaiFactCollector.run_ohaicCs4||}|sdS|||\}}}|dkr0dS|S)Nr)rrrrrrget_ohai_output/s z!OhaiFactCollector.get_ohai_outputcCsHi}|s |S||}|dur"|Szt|}WntyBYn0|Sr)rjsonloads Exception)rrZcollected_factsZ ohai_factsZ ohai_outputrrrcollect:s  zOhaiFactCollector.collect)NN)NN) __name__ __module__ __qualname____doc__namesetZ _fact_idsr rrrr __classcell__rrrrrs r)Z __future__rrrtypeZ __metaclass__rZ"ansible.module_utils.compat.typingZ module_utilscompattypingtZ$ansible.module_utils.facts.namespacerZ$ansible.module_utils.facts.collectorrrrrrrs