kojiwrapper: Use gssapi_login

The krb_login method is deprecated and will be removed in 1.22

JIRA: RHELCMP-3383
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-12-02 14:04:31 +01:00
parent 6998ffe694
commit 4a048d4a85
2 changed files with 7 additions and 11 deletions

View File

@ -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),
)

View File

@ -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):