in bugbot/rules/variant_expiration.py [0:0]
def get_bugs(self, date="today", bug_ids=[], chunk_size=None) -> dict:
bugs = super().get_bugs(date, bug_ids, chunk_size)
# Create bugs for variants that will be expired soon
for variant_name, variant_info in self.variants.items():
if (
variant_info.get("bug_id")
or variant_info["expiration"] >= self.open_bug_date
):
continue
component = ComponentName.from_str(variant_info["component"])
expiration = variant_info["expiration"].strftime("%Y-%m-%d")
new_bug = {
"summary": f"The variant `{variant_name}` expiration is on {expiration}",
"product": component.product,
"component": component.name,
"status_whiteboard": "[variant-expiration]",
"type": "task",
"see_also": self.get_related_bug_ids(variant_name),
"cc": self.cc_on_bugs,
"description": BUG_DESCRIPTION,
"version": "unspecified",
}
if self.dryrun or self.test_mode:
bug = {"id": f"to be created for {variant_name}"}
logger.info(
"A new bug for `%s` will be created with:\n%s",
variant_name,
new_bug,
)
else:
try:
bug = utils.create_bug(new_bug)
except HTTPError as error:
logger.error(
"Failed to create a bug for the variant `%s`:\n%s",
variant_name,
error.response.text,
exc_info=error,
)
continue
bug_id = str(bug["id"])
bugs[bug_id] = {
"id": bug_id,
"product": component.product,
"component": component.name,
"expiration": expiration,
"variant_name": variant_name,
"action": ExpirationAction.FILE_NEW_BUG,
}
return bugs