mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-05-16 13:56:11 +08:00
A script for adjusting tags in PDC.
This commit is contained in:
36
bootstrap/change-tag-in-pdc.py
Normal file
36
bootstrap/change-tag-in-pdc.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pdc_client
|
||||||
|
|
||||||
|
servername, token, variant_uid, new_tag = \
|
||||||
|
sys.argv[-4], sys.argv[-3], sys.argv[-2], sys.argv[-1]
|
||||||
|
|
||||||
|
if os.path.basename(__file__) in (servername, token, variant_uid,):
|
||||||
|
raise ValueError("Provide a PDC server name defined in "
|
||||||
|
"/etc/pdc.d/ and a token")
|
||||||
|
|
||||||
|
print("Connecting to PDC server %r with token %r" % (servername, token))
|
||||||
|
pdc = pdc_client.PDCClient(servername, token=token)
|
||||||
|
|
||||||
|
print("Querying for %r to see what tag it has today" % variant_uid)
|
||||||
|
obj = pdc['unreleasedvariants'][variant_uid]()
|
||||||
|
answer = raw_input("Change koji_tag for %r from %r to %r? [y/N]" % (
|
||||||
|
variant_uid, obj['koji_tag'], new_tag))
|
||||||
|
if not answer.lower() in ('y', 'yes'):
|
||||||
|
print("Exiting, taking no action.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
print("Submitting PATCH to new_tag.")
|
||||||
|
# Do it this way once we fix that ugly PATCH bug.
|
||||||
|
#pdc['unreleasedvariants'][variant_uid] += {
|
||||||
|
# 'variant_uid': variant_uid,
|
||||||
|
# 'koji_tag': new_tag,
|
||||||
|
#}
|
||||||
|
try:
|
||||||
|
# This way works, but it *always* throws a TypeError.
|
||||||
|
pdc['unreleasedvariants/'] += {variant_uid: {'koji_tag': new_tag}}
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
print("Done.")
|
||||||
Reference in New Issue
Block a user