@ -20,6 +20,7 @@ import os
import pathlib
import re
import shlex
import typing as _t
from ansible . errors import AnsibleError , AnsibleActionFail , AnsibleActionSkip
from ansible . executor . powershell import module_manifest as ps_manifest
@ -35,7 +36,7 @@ class ActionModule(ActionBase):
# after chopping off a potential drive letter.
windows_absolute_path_detection = re . compile ( r ' ^(?:[a-zA-Z] \ :)?( \\ | \ /) ' )
def run ( self , tmp = None , task_vars = None ) :
def run ( self , tmp : str | None = None , task_vars : dict [ str , _t . Any ] | None = None ) - > dict [ str , _t . Any ] :
""" handler for file transfer operations """
if task_vars is None :
task_vars = dict ( )
@ -130,7 +131,7 @@ class ActionModule(ActionBase):
self . _fixup_perms2 ( ( self . _connection . _shell . tmpdir , tmp_src ) , execute = True )
# add preparation steps to one ssh roundtrip executing the script
env_dict = dict ( )
env_dict : dict [ str , _t . Any ] = { }
env_string = self . _compute_environment_string ( env_dict )
if executable :
@ -164,10 +165,10 @@ class ActionModule(ActionBase):
script_cmd = self . _connection . _shell . build_module_command ( env_string = ' ' , shebang = ' #!powershell ' , cmd = ' ' )
# now we execute script, always assume changed.
result = dict ( self . _low_level_execute_command ( cmd = script_cmd , in_data = exec_data , sudoable = True , chdir = chdir ) , changed = True )
result : dict [ str , object ] = dict ( self . _low_level_execute_command ( cmd = script_cmd , in_data = exec_data , sudoable = True , chdir = chdir ) , changed = True )
if ' rc ' in result and result [ ' rc ' ] != 0 :
raise AnsibleActionFail ( ' non-zero return code ' , result = result )
result . update ( msg = ' non-zero return code ' , failed = True )
return result
finally :