From 350086df4e34ade88df86bc7c356fcd03f359985 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mon, 1 Mar 2021 13:34:43 +0100 Subject: [PATCH] cli: sidetag --suffix option --- plugins/cli/sidetag_cli.py | 13 ++++++++++++- plugins/hub/sidetag.conf | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/cli/sidetag_cli.py b/plugins/cli/sidetag_cli.py index 4b9cc34b..8713bdef 100644 --- a/plugins/cli/sidetag_cli.py +++ b/plugins/cli/sidetag_cli.py @@ -33,15 +33,26 @@ def handle_add_sidetag(options, session, args): parser.add_argument( "--debuginfo", action="store_true", help=_("Buildroot repo will contain debuginfos") ) + parser.add_argument( + "--suffix", actions="store", help=_("Suffix from hub-supported ones") + ) opts = parser.parse_args(args) activate_session(session, options) + kwargs = {"debuginfo": opts.debuginfo} + if opts.suffix: + kwargs['suffix'] = opts.suffix try: - tag = session.createSideTag(opts.basetag, debuginfo=opts.debuginfo) + tag = session.createSideTag(opts.basetag, **kwargs) except koji.ActionNotAllowed: parser.error(_("Policy violation")) + except koji.ParameterError as ex: + if 'suffix' in str(ex): + parser.error(_("Hub is older and doesn't support --suffix, please run it without it")) + else: + raise if not opts.quiet: print(tag["name"]) diff --git a/plugins/hub/sidetag.conf b/plugins/hub/sidetag.conf index 260789df..fefa32d8 100644 --- a/plugins/hub/sidetag.conf +++ b/plugins/hub/sidetag.conf @@ -2,4 +2,4 @@ # automatically remove sidetag on untagging last package remove_empty = off # potential suffixes for sidetag names -allowed_suffixes = stack-gate +# allowed_suffixes =