
    Vh                    ^    d dl mZ d dlZd dlmc mc mZ d dlm	Z	 d dl
mZ  G d de      Zy)    )annotationsN)PrefixFactNamespace)BaseFactCollectorc                  P     e Zd ZdZdZ e       Zd fd	Zd Zd Z	d Z
ddZ xZS )	OhaiFactCollectorzIThis is a subclass of Facts for including information gathered from Ohai.ohaic                J    t        dd      }t        t        |   ||       y )Nr   ohai_)namespace_nameprefix)
collectors	namespace)r   superr   __init__)selfr   r   	__class__s      U/home/dcms/DCMS/lib/python3.12/site-packages/ansible/module_utils/facts/other/ohai.pyr   zOhaiFactCollector.__init__    s-    'v/68	/::C 	0 	E    c                $    |j                  d      S )Nr   )get_bin_path)r   modules     r   	find_ohaizOhaiFactCollector.find_ohai&   s    ""
 	
r   c                6    |j                  |      \  }}}|||fS )N)run_commandr   r   	ohai_pathrcouterrs         r   run_ohaizOhaiFactCollector.run_ohai+   s$    )))4C3|r   c                f    | j                  |      }|sy | j                  ||      \  }}}|dk7  ry |S )Nr   )r   r    r   s         r   get_ohai_outputz!OhaiFactCollector.get_ohai_output/   s;    NN6*	}}VY7C7
r   c                    i }|s|S | j                  |      }||S 	 t        j                  |      }|S # t        $ r |j	                  d       Y |S w xY w)NzFailed to gather ohai facts)r"   jsonloads	Exceptionwarn)r   r   collected_facts
ohai_factsohai_outputs        r   collectzOhaiFactCollector.collect:   sk    
**62	7K0J   	7KK56	7s   4 AA)NN)__name__
__module____qualname____doc__nameset	_fact_idsr   r   r    r"   r+   __classcell__)r   s   @r   r   r      s,    SDIE

	r   r   )
__future__r   r$   "ansible.module_utils.compat.typingmodule_utilscompattypingt$ansible.module_utils.facts.namespacer   $ansible.module_utils.facts.collectorr   r    r   r   <module>r=      s&     #  . . D B.) .r   