psrp - do not display bootstrap wrapper for eachach task (#51779)

pull/51796/head
Jordan Borean 6 years ago committed by GitHub
parent 6654c7aeea
commit 146a89b612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- psrp - do not display bootstrap wrapper for each module exec run

@ -293,14 +293,15 @@ class Connection(ConnectionBase):
super(Connection, self).exec_command(cmd, in_data=in_data, super(Connection, self).exec_command(cmd, in_data=in_data,
sudoable=sudoable) sudoable=sudoable)
if cmd == "-" and not in_data.startswith(b"#!"): if cmd.startswith(" ".join(_common_args) + " -EncodedCommand"):
# The powershell plugin sets cmd to '-' when we are executing a # This is a PowerShell script encoded by the shell plugin, we will
# PowerShell script with in_data being the script to execute. # decode the script and execute it in the runspace instead of
script = in_data # starting a new interpreter to save on time
in_data = None b_command = base64.b64decode(cmd.split(" ")[-1])
display.vvv("PSRP: EXEC (via pipeline wrapper)", script = to_text(b_command, 'utf-16-le')
host=self._psrp_host) in_data = to_text(in_data, errors="surrogate_or_strict", nonstring="passthru")
elif cmd == "-":
if in_data and in_data.startswith(u"#!"):
# ANSIBALLZ wrapper, we need to get the interpreter and execute # ANSIBALLZ wrapper, we need to get the interpreter and execute
# that as the script - note this won't work as basic.py relies # that as the script - note this won't work as basic.py relies
# on packages not available on Windows, once fixed we can enable # on packages not available on Windows, once fixed we can enable
@ -310,13 +311,13 @@ class Connection(ConnectionBase):
# in_data = to_text(in_data) # in_data = to_text(in_data)
raise AnsibleError("cannot run the interpreter '%s' on the psrp " raise AnsibleError("cannot run the interpreter '%s' on the psrp "
"connection plugin" % interpreter) "connection plugin" % interpreter)
elif cmd.startswith(" ".join(_common_args) + " -EncodedCommand"):
# This is a PowerShell script encoded by the shell plugin, we will # call build_module_command to get the bootstrap wrapper text
# decode the script and execute it in the runspace instead of bootstrap_wrapper = self._shell.build_module_command('', '', '')
# starting a new interpreter to save on time if bootstrap_wrapper == cmd:
b_command = base64.b64decode(cmd.split(" ")[-1]) # Do not display to the user each invocation of the bootstrap wrapper
script = to_text(b_command, 'utf-16-le') display.vvv("PSRP: EXEC (via pipeline wrapper)")
in_data = to_text(in_data, errors="surrogate_or_strict", nonstring="passthru") else:
display.vvv("PSRP: EXEC %s" % script, host=self._psrp_host) display.vvv("PSRP: EXEC %s" % script, host=self._psrp_host)
else: else:
# in other cases we want to execute the cmd as the script # in other cases we want to execute the cmd as the script

Loading…
Cancel
Save