o nnh@s\ddlmZddlmZddlmZddlmZddlm Z ddl m Z GdddeZ d S) ) annotations) AnsibleError) Conditional) ActionBase) string_types)booleancs.eZdZdZdZedZdfdd ZZS) ActionModulez Fail with custom message F)fail_msgmsgquiet success_msgthatNc s|durt}tt|||}~d|jjvrtdd}d}|jjd|jjd}|dur3d}n"t|t rFt dd|DsEtdnt|t t fsUtd t ||jjd }|durcd }n"t|t rvt d d|Dsutd nt|t t fstdt |t |jjdddd}z|jjd}Wnty|jjd}Ynwt|tr|j|}t|t s|g}t|jd}|sd|d<|D]$} | g|_|j|j|d} | sd|d<| |d<| |d<||d<|Sqd|d<||d<|S)Nr z%conditional required in "that" stringr r zAssertion failedcs|]}t|tVqdSN isinstancer.0xrH/usr/local/lib/python3.10/dist-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 %sr zAll assertions passedcsrrrrrrrr;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)loaderT_ansible_verbose_always)templarall_varsfailed evaluated_to assertionchanged)dictsuperrrun_taskargsrgetrlistallrtyperuntemplated_argsKeyErrorstr_templartemplater_loaderwhenevaluate_conditional) selftmp task_varsresultr r r thatscondr test_result __class__rrr$!sh          zActionModule.run)NN) __name__ __module__ __qualname____doc___requires_connection frozenset _VALID_ARGSr$ __classcell__rrr:rrs rN) __future__ransible.errorsransible.playbook.conditionalransible.plugins.actionransible.module_utils.sixr)ansible.module_utils.parsing.convert_boolrrrrrrs