
    Vh                        d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ  e       Z G d	 d
e	      Zy)    )annotations)Mapping)AnsibleActionFail)string_types)
ActionBase)parse_address)Display)combine_varsc                  0     e Zd ZdZdZdZdZd fd	Z xZS )ActionModulez: Create inventory hosts and groups in the memory inventoryTFc           
        t         t        |   ||      }~| j                  j                  }|j                  di       }t        |t              rt        ||      }nt        dt        |      z        |j                  d|j                  d|j                  dd                   }|t        d      t        j                  d|z         	 t        |d	      \  }}|r||d
<   |j                  d|j                  d|j                  dd                  }	g }
|	rwt        |	t               r|	}n9t        |	t"              r|	j%                  d      }nt        d| j                        |D ]&  }||
vs|
j'                  |j)                                ( t+               }t-        d      }|j/                         D ]  }||vs||   ||<    d|d<   t+        ||
|      |d<   |S # t        $ r |}d }Y w xY w)N_raw_paramszFInvalid raw parameters passed, requires a dictionary/mapping got a  %snamehostnamehostz+name, host or hostname needs to be providedz)creating host via 'add_host': hostname=%sF)allow_rangesansible_ssh_port	groupnamegroupsgroup ,z#Groups must be specified as a list.)obj)r   r   r   r   changed)	host_namer   	host_varsadd_host)superr   run_taskargspop
isinstancer   r
   r   typegetdisplayvvr   	Exceptionlistr   splitappendstripdict	frozensetkeys)selftmp	task_varsresultr!   rawnew_namer   portr   
new_groups
group_list
group_namer   special_argsk	__class__s                   O/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/action/add_host.pyr   zActionModule.run)   s   |T.sI>zzhh}b)c7#T*D#$lostwox$xyy 88FDHHZ&$9O$PQ#$QRR

>IJ	&xeDJD$ '+D#$+txx$((7B:O'PQ
&$'#
FL1#\\#.
'(MSWS]S]^^( :
Z/%%j&6&6&89:
 F	 !LM 	'A$#Aw	!	' "y!DyYzA  	DD	s   G G/.G/)NN)	__name__
__module____qualname____doc__BYPASS_HOST_LOOP_requires_connection_supports_check_moder   __classcell__)r<   s   @r=   r   r   !   s$    D  6 6    r   N)
__future__r   collections.abcr   ansible.errorsr   ansible.module_utils.sixr   ansible.plugins.actionr   ansible.parsing.utils.addressesr   ansible.utils.displayr	   ansible.utils.varsr
   r&   r    rF   r=   <module>rP      s2   & # # , 1 - 9 ) +
)>: >rF   