From c50685304c8bff2dfa59fbd5eb8b57152fd87d66 Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Sep 28 2021 15:42:42 +0000 Subject: [PATCH 1/4] hub: [API:getFullInheritance] be tolerant of stops/jumps kwargs with None values --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 00d23bd..08ca24d 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -11863,7 +11863,7 @@ class RootExports(object): context.session.assertPerm('tag') return writeInheritanceData(tag, data, clear=clear) - def getFullInheritance(self, tag, event=None, reverse=False): + def getFullInheritance(self, tag, event=None, reverse=False, **kwargs): """ :param int|str tag: tag ID | name :param int event: event ID @@ -11872,6 +11872,15 @@ class RootExports(object): :returns: list of node dicts """ + # Backwards-compatible with the removed options + for k, v in kwargs.items(): + if k in ('stops', 'jumps'): + if v is not None: + raise koji.ParameterError("%s option has been removed since 1.26" % k) + else: + raise koji.ParameterError( + "getFullInheritance() got an unexpected keyword argument '%s'" % k) + if not isinstance(tag, int): # lookup tag id tag = get_tag_id(tag, strict=True) From 6e837927e0b5137e31799cbe8949424c2f89a71a Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Sep 28 2021 15:42:48 +0000 Subject: [PATCH 2/4] allow Falsy values too --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 08ca24d..f00f754 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -11875,7 +11875,7 @@ class RootExports(object): # Backwards-compatible with the removed options for k, v in kwargs.items(): if k in ('stops', 'jumps'): - if v is not None: + if v: raise koji.ParameterError("%s option has been removed since 1.26" % k) else: raise koji.ParameterError( From 8b9e599e925c0f167413026c9f605ab125a8db31 Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Sep 28 2021 15:43:18 +0000 Subject: [PATCH 3/4] CLI: [list-tag-inheritance] Clear Error with removed --stop/--jump opts --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 62a5127..e7210bd 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -4403,6 +4403,9 @@ def anon_handle_list_tag_inheritance(goptions, session, args): (options, args) = parser.parse_args(args) if len(args) != 1: parser.error(_("This command takes exactly one argument: a tag name or ID")) + for deprecated in ('stop', 'jump'): + if getattr(options, deprecated): + parser.error(_("--%s option has been removed in 1.26") % deprecated) ensure_connection(session, goptions) event = koji.util.eventFromOpts(session, options) if event: From 3376b7cd15019584ecf196a6b9a976e2a781079e Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Sep 28 2021 16:05:48 +0000 Subject: [PATCH 4/4] update docstring --- diff --git a/hub/kojihub.py b/hub/kojihub.py index f00f754..56f60ea 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -11869,6 +11869,8 @@ class RootExports(object): :param int event: event ID :param bool reverse: return reversed tree (descendants instead of parents) + :param dict stops: SHOULD NOT BE USED, BACKWARDS COMPATIBLE ONLY + :param dict jumps: SHOULD NOT BE USED, BACKWARDS COMPATIBLE ONLY :returns: list of node dicts """