From 940d4a0e898b950363f4d2fccb02ad430e5a294f Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 11 Jul 2018 09:12:29 +1000 Subject: 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 --- test/units/plugins/connection/test_winrm.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/units/plugins/connection') diff --git a/test/units/plugins/connection/test_winrm.py b/test/units/plugins/connection/test_winrm.py index bfd27743b8..e906a9d2b3 100644 --- a/test/units/plugins/connection/test_winrm.py +++ b/test/units/plugins/connection/test_winrm.py @@ -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") -- cgit v1.2.1