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:
parent
6998ffe694
commit
4a048d4a85
@ -42,7 +42,6 @@ class KojiWrapper(object):
|
|||||||
self.koji_module = koji.get_profile_module(profile)
|
self.koji_module = koji.get_profile_module(profile)
|
||||||
session_opts = {}
|
session_opts = {}
|
||||||
for key in (
|
for key in (
|
||||||
"krbservice",
|
|
||||||
"timeout",
|
"timeout",
|
||||||
"keepalive",
|
"keepalive",
|
||||||
"max_retries",
|
"max_retries",
|
||||||
@ -52,7 +51,6 @@ class KojiWrapper(object):
|
|||||||
"offline_retry_interval",
|
"offline_retry_interval",
|
||||||
"debug",
|
"debug",
|
||||||
"debug_xmlrpc",
|
"debug_xmlrpc",
|
||||||
"krb_rdns",
|
|
||||||
"serverca",
|
"serverca",
|
||||||
"use_fast_upload",
|
"use_fast_upload",
|
||||||
):
|
):
|
||||||
@ -76,7 +74,7 @@ class KojiWrapper(object):
|
|||||||
os.path.expanduser(self.koji_module.config.serverca),
|
os.path.expanduser(self.koji_module.config.serverca),
|
||||||
)
|
)
|
||||||
elif auth_type == "kerberos":
|
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, "principal", None),
|
||||||
getattr(self.koji_module.config, "keytab", None),
|
getattr(self.koji_module.config, "keytab", None),
|
||||||
)
|
)
|
||||||
|
@ -35,14 +35,11 @@ class KojiWrapperBaseTestCase(unittest.TestCase):
|
|||||||
_, self.tmpfile = tempfile.mkstemp()
|
_, self.tmpfile = tempfile.mkstemp()
|
||||||
self.koji_profile = mock.Mock()
|
self.koji_profile = mock.Mock()
|
||||||
with mock.patch("pungi.wrappers.kojiwrapper.koji") as koji:
|
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(
|
koji.get_profile_module = mock.Mock(
|
||||||
return_value=mock.Mock(
|
return_value=mock.Mock(
|
||||||
config=DumbMock(
|
config=DumbMock(
|
||||||
server="koji.example.com",
|
server="koji.example.com", authtype="kerberos", cert="",
|
||||||
authtype="kerberos",
|
|
||||||
krb_rdns=False,
|
|
||||||
cert="",
|
|
||||||
),
|
),
|
||||||
pathinfo=mock.Mock(
|
pathinfo=mock.Mock(
|
||||||
work=mock.Mock(return_value="/koji"),
|
work=mock.Mock(return_value="/koji"),
|
||||||
@ -59,12 +56,13 @@ class KojiWrapperBaseTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class KojiWrapperTest(KojiWrapperBaseTestCase):
|
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.keytab = "testkeytab"
|
||||||
self.koji.koji_module.config.principal = "testprincipal"
|
self.koji.koji_module.config.principal = "testprincipal"
|
||||||
self.assertEqual(self.koji.koji_module.config.krb_rdns, False)
|
|
||||||
self.koji.login()
|
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):
|
def test_get_image_build_cmd_without_required_data(self):
|
||||||
with self.assertRaises(AssertionError):
|
with self.assertRaises(AssertionError):
|
||||||
|
Loading…
Reference in New Issue
Block a user