o nnh#@sddlmZddlZddlZddlZddlmZmZmZm Z m Z ddl m Z ddlmZmZmZddlmZGdddeZdS) ) annotationsN) AnsibleError AnsibleAction_AnsibleActionDoneAnsibleActionFailAnsibleActionSkip)module_manifest)to_bytes to_nativeto_text) ActionBasecs,eZdZdZedZdfdd ZZS) ActionModuleTz^(?:[a-zA-Z]\:)?(\\|\/)Ncs|durt}|jiddiddiddiddiddidddggd\}}tt|||}~zz|d}|rC||rCtd ||d }|rT||sTtd ||d }|rt|jj d drn|j |snt d|t|jj d ds| dst d|t|dddd} ddt| D} | d} |d} | rt|ddd} z|jj|d| |jjddd} Wnty} zt t| d} ~ ww|jjr|ds|d rd|d<t|dd|d<td|dd|d<|jj |jj jtj| }t | !| d|}|"| ||j#|jj j|fdd t}|$|}| r4d!%|| |g}nd!%||g}|jj &|}d}t|jj d drd}d}d}d}d}|jj'r}|jj'}d}|j(}|j)d"|j*d#}|j)d$|j*d#}|j)d%|j*d#}t+,t-|| i||jj.|||||d&|d }|jj j/dd'dd(}|0|j1||d|d)d*|vr|d*dkrt d+Wnt2y} z |0| j3WYd} ~ nd} ~ wwW|4|jj j|SW|4|jj j|S|4|jj jw),z& handler for file transfer operations Ntypestr) _raw_paramscmdcreatesremoveschdir executablerr) argument_specrequired_one_ofrz"%s exists, matching creates optionrz*%s does not exist, matching removes optionr _IS_WINDOWSFz;chdir %s must be an absolute path for a Windows remote node/z>chdir %s must be an absolute path for a Unix-aware remote nodesurrogate_or_stricterrorscSsg|]}t|ddqS)rr)r ).0sr H/usr/local/lib/python3.10/dist-packages/ansible/plugins/action/script.py \sz$ActionModule.run..rrfilesdecryptT)r$changed)resultz*Check mode is not supported for this task.)execute become_user) playcontext become_pass become_flagsscriptz #!powershell) env_stringshebangr)rin_datasudoablerrcznon-zero return code)5dictvalidate_argument_specsuperr run_remote_file_existsrgetattr _connection_shellwindows_absolute_path_detectionmatchr startswithr getshlexsplitstrip_loader get_real_file _find_needle_taskargsr check_moder join_pathtmpdirospathbasenamer replace_transfer_file _fixup_perms2_compute_environment_stringjoin wrap_for_execbecomename get_option _play_context ps_manifest_create_powershell_wrapperr async_valbuild_module_commandupdate_low_level_execute_commandrr&_remove_tmp_path)selftmp task_varsvalidation_resultnew_module_argsr&rrr raw_paramspartssourceretmp_srctarget_commandenv_dictr. script_cmd exec_datarS become_methodr)r+r, become_plugin __class__r r!r6%s         (        zActionModule.run)NN) __name__ __module__ __qualname__TRANSFERS_FILESrecompiler;r6 __classcell__r r rnr!r s r ) __future__rrJrtr?ansible.errorsrrrrransible.executor.powershellrrW+ansible.module_utils.common.text.convertersr r r ansible.plugins.actionr r r r r r!s