mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-21 04:10:23 -07:00
win_reboot: fix 2.6 issues and better handle post reboot reboot (#42330)
* win_reboot: fix 2.6 issues and better handle post reboot reboot * changed winrm _reset to reset * Add handler to reset calls when .reset() throws an AnsibleError on older hosts * Moving back to _reset to get the issue fixed
This commit is contained in:
parent
780c8986af
commit
940d4a0e89
7 changed files with 128 additions and 18 deletions
|
@ -204,6 +204,7 @@ class TestConnectionWinRM(object):
|
|||
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options=options, direct=direct)
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
for attr, expected in expected.items():
|
||||
actual = getattr(conn, attr)
|
||||
|
@ -236,6 +237,7 @@ class TestWinRMKerbAuth(object):
|
|||
new_stdin = StringIO()
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options=options)
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
conn._kerb_auth("user@domain", "pass")
|
||||
mock_calls = mock_popen.mock_calls
|
||||
|
@ -264,6 +266,7 @@ class TestWinRMKerbAuth(object):
|
|||
new_stdin = StringIO()
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options=options)
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
conn._kerb_auth("user@domain", "pass")
|
||||
mock_calls = mock_pexpect.mock_calls
|
||||
|
@ -292,6 +295,7 @@ class TestWinRMKerbAuth(object):
|
|||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
options = {"_extras": {}, "ansible_winrm_kinit_cmd": "/fake/kinit"}
|
||||
conn.set_options(var_options=options)
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
with pytest.raises(AnsibleConnectionFailure) as err:
|
||||
conn._kerb_auth("user@domain", "pass")
|
||||
|
@ -314,6 +318,7 @@ class TestWinRMKerbAuth(object):
|
|||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
options = {"_extras": {}, "ansible_winrm_kinit_cmd": "/fake/kinit"}
|
||||
conn.set_options(var_options=options)
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
with pytest.raises(AnsibleConnectionFailure) as err:
|
||||
conn._kerb_auth("user@domain", "pass")
|
||||
|
@ -337,6 +342,7 @@ class TestWinRMKerbAuth(object):
|
|||
new_stdin = StringIO()
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options={"_extras": {}})
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
with pytest.raises(AnsibleConnectionFailure) as err:
|
||||
conn._kerb_auth("invaliduser", "pass")
|
||||
|
@ -361,6 +367,7 @@ class TestWinRMKerbAuth(object):
|
|||
new_stdin = StringIO()
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options={"_extras": {}})
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
with pytest.raises(AnsibleConnectionFailure) as err:
|
||||
conn._kerb_auth("invaliduser", "pass")
|
||||
|
@ -383,6 +390,7 @@ class TestWinRMKerbAuth(object):
|
|||
new_stdin = StringIO()
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options={"_extras": {}})
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
with pytest.raises(AnsibleConnectionFailure) as err:
|
||||
conn._kerb_auth("username", "password")
|
||||
|
@ -407,6 +415,7 @@ class TestWinRMKerbAuth(object):
|
|||
new_stdin = StringIO()
|
||||
conn = connection_loader.get('winrm', pc, new_stdin)
|
||||
conn.set_options(var_options={"_extras": {}})
|
||||
conn._build_winrm_kwargs()
|
||||
|
||||
with pytest.raises(AnsibleConnectionFailure) as err:
|
||||
conn._kerb_auth("username", "password")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue