From 99de501257ffbdd0ff4a6f36a49493166238a38d Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Jan 10 2017 03:14:17 +0000 Subject: more direct tag functions for the hub followup to PR#212 https://pagure.io/koji/pull-request/212 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 51e41a2..6ef5521 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -627,9 +627,15 @@ def readDescendantsData(tag_id, event=None): data = [dict(zip(fields, x)) for x in c.fetchall()] return data + def writeInheritanceData(tag_id, changes, clear=False): """Add or change inheritance data for a tag""" context.session.assertPerm('admin') + _writeInheritanceData(tag_id, changes, clear) + + +def _writeInheritanceData(tag_id, changes, clear=False): + """Add or change inheritance data for a tag""" fields = ('parent_id', 'priority', 'maxdepth', 'intransitive', 'noconfig', 'pkg_filter') if isinstance(changes, dict): changes = [changes] @@ -2971,6 +2977,11 @@ def edit_tag(tagInfo, **kwargs): """ context.session.assertPerm('admin') + _edit_tag(tagInfo, **kwargs) + + +def _edit_tag(tagInfo, **kwargs): + """Edit information for an existing tag.""" if not context.opts.get('EnableMaven') \ and dslice(kwargs, ['maven_support', 'maven_include_all'], strict=False): raise koji.GenericError, "Maven support not enabled" @@ -3050,8 +3061,12 @@ def old_edit_tag(tagInfo, name, arches, locked, permissionID, extra=None): def delete_tag(tagInfo): """Delete the specified tag.""" - context.session.assertPerm('admin') + _delete_tag(tagInfo) + + +def _delete_tag(tagInfo): + """Delete the specified tag.""" #We do not ever DELETE tag data. It is versioned -- we revoke it instead.