mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-16 14:09:12 -07:00
Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace. * Enable strict mode for all PowerShell modules and internal commands. * Update common PowerShell code to fix strict mode errors. * Fix an issue with Set-Attr where it would not replace an existing property if already set. * Add tests for exception handling using modified win_ping modules.
This commit is contained in:
parent
47d9e7ca93
commit
4b2cdadc98
9 changed files with 286 additions and 22 deletions
|
@ -167,7 +167,7 @@ class Connection(ConnectionBase):
|
|||
elif '-EncodedCommand' not in cmd_parts:
|
||||
script = ' '.join(cmd_parts)
|
||||
if script:
|
||||
cmd_parts = self._shell._encode_script(script, as_list=True)
|
||||
cmd_parts = self._shell._encode_script(script, as_list=True, strict_mode=False)
|
||||
if '-EncodedCommand' in cmd_parts:
|
||||
encoded_cmd = cmd_parts[cmd_parts.index('-EncodedCommand') + 1]
|
||||
decoded_cmd = to_unicode(base64.b64decode(encoded_cmd))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue