
    Vh	                    R    d dl mZ dZdZd dlmZ d dlmZ d dlm	Z	  G d de      Z
y	)
    )annotationsa[  
    name: auto
    author:
      - Matt Davis (@nitzmahone)
    version_added: "2.5"
    short_description: Loads and executes an inventory plugin specified in a YAML config
    description:
        - By enabling the C(auto) inventory plugin, any YAML inventory config file with a
          C(plugin) key at its root will automatically cause the named plugin to be loaded and executed with that
          config. This effectively provides automatic enabling of all installed/accessible inventory plugins.
        - To disable this behavior, remove C(auto) from the C(INVENTORY_ENABLED) config element.
z
# This plugin is not intended for direct use; it is a fallback mechanism for automatic enabling of
# all installed inventory plugins.
)AnsibleParserError)BaseInventoryPlugin)inventory_loaderc                  *     e Zd ZdZ fdZddZ xZS )InventoryModuleautoc                p    |j                  d      s|j                  d      syt        t        |   |      S )Nz.ymlz.yamlF)endswithsuperr   verify_file)selfpath	__class__s     N/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/inventory/auto.pyr   zInventoryModule.verify_file!   s/    }}V$T]]7-C_d7==    c                :   |j                  |d      }	 |j                  dd       }|st        dj	                  |            t        j                  |      }|st        dj	                  ||            |j                  |      st        dj	                  ||            | j                  j                  dj	                  |j                  |             |j                  ||||       	 |j                          y # t        $ r d }Y w xY w# t        $ r Y y w xY w)Nnone)cachepluginzRno root 'plugin' key found, '{0}' is not a valid YAML inventory plugin config filez5inventory config '{0}' specifies unknown plugin '{1}'zFinventory source '{0}' could not be verified by inventory plugin '{1}'z>Using inventory plugin '{0}' to process inventory source '{1}')load_from_filegetAttributeErrorr   formatr   r   displayv
_load_nameparseupdate_cache_if_changed)r   	inventoryloaderr   r   config_dataplugin_namer   s           r   r   zInventoryModule.parse&   s4   ++D+?	%//(D9K $%y  &A  &A  BF  &G  H  H!%%k2$%\%c%cdhju%vww!!$'$%m%t%tuy  |G  &H  I  IW^^_e_p_prvwxYE:	**,#  	K	$  		s#   C= ,D =D
D	DD)T)__name__
__module____qualname__NAMEr   r   __classcell__)r   s   @r   r   r      s    D>
r   r   N)
__future__r   DOCUMENTATIONEXAMPLESansible.errorsr   ansible.plugins.inventoryr   ansible.plugins.loaderr   r    r   r   <module>r0      s0    #
 . 9 3!) !r   