From 4892b4e9223398f621f774a2bfe124b30ad85063 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jun 03 2021 13:23:56 +0000 Subject: use format for name_template --- diff --git a/plugins/hub/sidetag.conf b/plugins/hub/sidetag.conf index 3a2ed0f..d4e55a4 100644 --- a/plugins/hub/sidetag.conf +++ b/plugins/hub/sidetag.conf @@ -6,4 +6,4 @@ remove_empty = off # template for sidetag names. It must contain basetag and tag_id parts # if allowed_suffixes is not empty and suffix was requested, it will be added # as {name_template}-{suffix}. (percent-signs need to be escaped) -# name_template = %%(basetag)s-sidetag-%%(tag_id)d +# name_template = {basetag}-side-{tag_id} diff --git a/plugins/hub/sidetag_hub.py b/plugins/hub/sidetag_hub.py index 4fb96b6..2d184f4 100644 --- a/plugins/hub/sidetag_hub.py +++ b/plugins/hub/sidetag_hub.py @@ -118,7 +118,7 @@ def createSideTag(basetag, debuginfo=False, suffix=None): # ugly, it will waste one number in tag_id_seq, but result will match with # id assigned by _create_tag tag_id = nextval("tag_id_seq") + 1 - sidetag_name = NAME_TEMPLATE % {'basetag': basetag["name"], 'tag_id': tag_id} + sidetag_name = NAME_TEMPLATE.format(basetag=basetag["name"], tag_id=tag_id) if suffix: sidetag_name += '-%s' % suffix extra = { @@ -313,7 +313,7 @@ def handle_sidetag_untag(cbtype, *args, **kws): # read config and register if not CONFIG: - CONFIG = koji.read_config_files(CONFIG_FILE) + CONFIG = koji.read_config_files(CONFIG_FILE, raw=True) print(open(CONFIG_FILE).read()) if CONFIG.has_option("sidetag", "remove_empty") and CONFIG.getboolean( "sidetag", "remove_empty" @@ -324,4 +324,4 @@ if not CONFIG: if CONFIG.has_option("sidetag", "name_template"): NAME_TEMPLATE = CONFIG.get("sidetag", "name_template") else: - NAME_TEMPLATE = '%(basetag)s-side-%(tag_id)d' + NAME_TEMPLATE = '{basetag}-side-{tag_id}'