mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
win_script: add support for become and centralise exec wrapper builder (#45582)
* win_script: add support for become and centralise exec wrapper builder * satisfying the pep8 gods * do not scan for module dependencies when running as a script
This commit is contained in:
parent
03dbb1d9c4
commit
d81249994e
7 changed files with 101 additions and 73 deletions
|
@ -119,7 +119,6 @@ from ansible.module_utils.six.moves.urllib.parse import urlunsplit
|
|||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.six import binary_type
|
||||
from ansible.plugins.connection import ConnectionBase
|
||||
from ansible.plugins.shell.powershell import leaf_exec
|
||||
from ansible.utils.hashing import secure_hash
|
||||
from ansible.utils.path import makedirs_safe
|
||||
|
||||
|
@ -488,21 +487,6 @@ class Connection(ConnectionBase):
|
|||
self.shell_id = None
|
||||
self._connect()
|
||||
|
||||
def _create_raw_wrapper_payload(self, cmd, environment=None):
|
||||
environment = {} if environment is None else environment
|
||||
|
||||
payload = {
|
||||
'module_entry': to_text(base64.b64encode(to_bytes(cmd))),
|
||||
'powershell_modules': {},
|
||||
'actions': ['exec'],
|
||||
'exec': to_text(base64.b64encode(to_bytes(leaf_exec))),
|
||||
'environment': environment,
|
||||
'min_ps_version': None,
|
||||
'min_os_version': None
|
||||
}
|
||||
|
||||
return json.dumps(payload)
|
||||
|
||||
def _wrapper_payload_stream(self, payload, buffer_size=200000):
|
||||
payload_bytes = to_bytes(payload)
|
||||
byte_count = len(payload_bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue