
    Vh                    b    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  G d de      Zy	)
    )annotations)AnsibleError)Conditional)
ActionBase)string_types)booleanc                  8     e Zd ZdZdZ ed      Zd fd	Z xZS )ActionModulez Fail with custom message F)fail_msgmsgquietsuccess_msgthatc                ,   |
t               }t        t        |   ||      }~d| j                  j
                  vrt        d      d }d }| j                  j
                  j                  d| j                  j
                  j                  d            }|d}nZt        |t              rt        d |D              s8t        d      t        |t        t        f      st        dt        |      z        | j                  j
                  j                  d	      }|d
}nZt        |t              rt        d |D              s8t        d      t        |t        t        f      st        dt        |      z        t        | j                  j
                  j                  dd      d      }	 | j                  j                  d   }t        |t               r| j"                  j%                  |      }t        |t              s|g}t'        | j(                        }|sd|d<   |D ]A  }	|	g|_        |j-                  | j"                  |      }
|
r+d|d<   |
|d<   |	|d<   ||d<   |c S  d|d<   ||d<   |S # t        $ r | j                  j
                  d   }Y w xY w)Nr   z%conditional required in "that" stringr   r   zAssertion failedc              3  <   K   | ]  }t        |t                y wN
isinstancer   .0xs     M/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/action/assert.py	<genexpr>z#ActionModule.run.<locals>.<genexpr>2   s     Eqz!\2E   zFType of one of the elements in fail_msg or msg list is not string typezHIncorrect type for fail_msg or msg, expected a string or list and got %sr   zAll assertions passedc              3  <   K   | ]  }t        |t                y wr   r   r   s     r   r   z#ActionModule.run.<locals>.<genexpr>;   s     Hqz!\2Hr   zBType of one of the elements in success_msg list is not string typezDIncorrect type for success_msg, expected a string or list and got %sr   F)strict)loaderT_ansible_verbose_always)templarall_varsfailedevaluated_to	assertionchanged)dictsuperr
   run_taskargsr   getr   listallr   typer   untemplated_argsKeyErrorstr_templartemplater   _loaderwhenevaluate_conditional)selftmp	task_varsresultr   r   r   thatscondr   test_result	__class__s              r   r'   zActionModule.run!   si   I|T.sI>(FGG::??&&z4::??3F3Fu3MN)H$'EHEE"#kllH|T&:;ilpqylzz{{jjoo))-81KT*HKHH"#ghhK,)=>ehlmxhyyzz

++GU;EJ	,JJ//7E eS!MM**51E %&GE $,,/04F,- 
	DDI33DMMT]3^K#'x )4~&&*{# (u
	 "y#uM  	, JJOOF+E	,s   (I. ."JJ)NN)	__name__
__module____qualname____doc___requires_connection	frozenset_VALID_ARGSr'   __classcell__)r=   s   @r   r
   r
      s#    $ OPKR R    r
   N)
__future__r   ansible.errorsr   ansible.playbook.conditionalr   ansible.plugins.actionr   ansible.module_utils.sixr   )ansible.module_utils.parsing.convert_boolr   r
    rF   r   <module>rN      s'   " # ' 4 - 1 =Y: YrF   