a )g@shddlmZmZmZeZddlmZddlm Z ddl m Z ddl m Z ddlmZGddde Zd S) )absolute_importdivisionprint_function) AnsibleError) Conditional) ActionBase) string_types)booleancs.eZdZdZdZedZdfdd ZZS) ActionModulez Fail with custom message F)fail_msgmsgquiet success_msgthatNc s|durt}tt|||}~d|jjvr6tdd}d}|jjd|jjd}|durfd}nDt|t rt dd|Dstdnt|t t fstd t ||jjd }|durd }nFt|t rt d d|Dstd n t|t t fs tdt |t |jjdddd}z|jjd}Wn tyT|jjd}Yn0t|trn|j|}t|t s|g}t|jd}|sd|d<|D]L} | g|_|j|j|d} | sd|d<| |d<| |d<||d<|Sqd|d<||d<|S)Nrz%conditional required in "that" stringr r zAssertion failedcss|]}t|tVqdSN isinstancer.0xrA/usr/lib/python3.9/site-packages/ansible/plugins/action/assert.py 2z#ActionModule.run..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 %srzAll assertions passedcss|]}t|tVqdSrrrrrrr;rzBType 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)loaderTZ_ansible_verbose_always)ZtemplarZall_varsZfailedZ evaluated_toZ assertionZchanged)dictsuperr runZ_taskargsrgetrlistallrtyper Zuntemplated_argsKeyErrorstrZ_templartemplaterZ_loaderZwhenZevaluate_conditional) selftmpZ task_varsresultr rr ZthatsZcondrZ test_result __class__rrr!s`           zActionModule.run)NN) __name__ __module__ __qualname____doc__ZTRANSFERS_FILES frozensetZ _VALID_ARGSr __classcell__rrr*rr sr N)Z __future__rrrr#Z __metaclass__Zansible.errorsrZansible.playbook.conditionalrZansible.plugins.actionrZansible.module_utils.sixrZ)ansible.module_utils.parsing.convert_boolr r rrrrs