From 4a048d4a853456d8ae697bf1057963c91c69595d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 2 Dec 2020 14:04:31 +0100 Subject: [PATCH] kojiwrapper: Use gssapi_login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The krb_login method is deprecated and will be removed in 1.22 JIRA: RHELCMP-3383 Signed-off-by: Lubomír Sedlář --- pungi/wrappers/kojiwrapper.py | 4 +--- tests/test_koji_wrapper.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/pungi/wrappers/kojiwrapper.py b/pungi/wrappers/kojiwrapper.py index 1d80afd9..e82fa477 100644 --- a/pungi/wrappers/kojiwrapper.py +++ b/pungi/wrappers/kojiwrapper.py @@ -42,7 +42,6 @@ class KojiWrapper(object): self.koji_module = koji.get_profile_module(profile) session_opts = {} for key in ( - "krbservice", "timeout", "keepalive", "max_retries", @@ -52,7 +51,6 @@ class KojiWrapper(object): "offline_retry_interval", "debug", "debug_xmlrpc", - "krb_rdns", "serverca", "use_fast_upload", ): @@ -76,7 +74,7 @@ class KojiWrapper(object): os.path.expanduser(self.koji_module.config.serverca), ) elif auth_type == "kerberos": - self.koji_proxy.krb_login( + self.koji_proxy.gssapi_login( getattr(self.koji_module.config, "principal", None), getattr(self.koji_module.config, "keytab", None), ) diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index 67a0a305..d14fe02a 100644 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -35,14 +35,11 @@ class KojiWrapperBaseTestCase(unittest.TestCase): _, self.tmpfile = tempfile.mkstemp() self.koji_profile = mock.Mock() with mock.patch("pungi.wrappers.kojiwrapper.koji") as koji: - koji.krb_login = mock.Mock() + koji.gssapi_login = mock.Mock() koji.get_profile_module = mock.Mock( return_value=mock.Mock( config=DumbMock( - server="koji.example.com", - authtype="kerberos", - krb_rdns=False, - cert="", + server="koji.example.com", authtype="kerberos", cert="", ), pathinfo=mock.Mock( work=mock.Mock(return_value="/koji"), @@ -59,12 +56,13 @@ class KojiWrapperBaseTestCase(unittest.TestCase): class KojiWrapperTest(KojiWrapperBaseTestCase): - def test_krb_login_krb(self): + def test_kerberos_login(self): self.koji.koji_module.config.keytab = "testkeytab" self.koji.koji_module.config.principal = "testprincipal" - self.assertEqual(self.koji.koji_module.config.krb_rdns, False) self.koji.login() - self.koji.koji_proxy.krb_login.assert_called_with("testprincipal", "testkeytab") + self.koji.koji_proxy.gssapi_login.assert_called_with( + "testprincipal", "testkeytab" + ) def test_get_image_build_cmd_without_required_data(self): with self.assertRaises(AssertionError):