mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-23 10:12:03 +08:00
allow setting multiple schedule task names for product pages
this adds a new setting, product_pages_schedule_task_names, which is the list version of product_pages_schedule_task_name.
This commit is contained in:
@@ -410,9 +410,14 @@ def _process_support_streams(db_session, mmd, params):
|
||||
"""
|
||||
Check if the specified scheduled task date has been reached. Returns True if it has.
|
||||
"""
|
||||
if not conf.product_pages_schedule_task_name:
|
||||
log.debug(config_msg, "product_pages_schedule_task_name")
|
||||
return False
|
||||
names = conf.product_pages_schedule_task_names
|
||||
if not names:
|
||||
# also allow for the older, single-valued option
|
||||
if conf.product_pages_schedule_task_name:
|
||||
names = [conf.product_pages_schedule_task_name]
|
||||
else:
|
||||
log.debug(config_msg, "product_pages_schedule_task_names")
|
||||
return False
|
||||
|
||||
schedule_url = "{}/api/v7/releases/{}/schedule-tasks/?fields=name,date_finish".format(
|
||||
conf.product_pages_url.rstrip("/"), pp_release)
|
||||
@@ -430,17 +435,18 @@ def _process_support_streams(db_session, mmd, params):
|
||||
)
|
||||
return False
|
||||
|
||||
name = conf.product_pages_schedule_task_name.lower().strip()
|
||||
for task in pp_json:
|
||||
if task['name'].lower().strip() == name:
|
||||
task_date = task['date_finish']
|
||||
if datetime.strptime(task_date, "%Y-%m-%d").date() >= datetime.utcnow().date():
|
||||
log.debug(
|
||||
"The task date %s hasn't been reached yet. Not adding a stream suffix.",
|
||||
task_date
|
||||
)
|
||||
return False
|
||||
return True
|
||||
for name in names:
|
||||
name = name.lower().strip()
|
||||
for task in pp_json:
|
||||
if task['name'].lower().strip() == name:
|
||||
task_date = task['date_finish']
|
||||
if datetime.strptime(task_date, "%Y-%m-%d").date() >= datetime.utcnow().date():
|
||||
log.debug(
|
||||
"The task date %s hasn't been reached yet. Not adding a stream suffix.",
|
||||
task_date
|
||||
)
|
||||
return False
|
||||
return True
|
||||
# Schedule task not available; rely on GA date
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user