fix deleting the last notification rule for pagerduty migrator (#484)
This commit is contained in:
parent
981fdf54a1
commit
b68dd9bc92
1 changed files with 7 additions and 3 deletions
|
|
@ -31,12 +31,16 @@ def migrate_notification_rules(user: dict) -> None:
|
|||
notification_rules, user["oncall_user"]["id"]
|
||||
)
|
||||
|
||||
for rule in user["oncall_user"]["notification_rules"]:
|
||||
oncall_api_client.delete("personal_notification_rules/{}".format(rule["id"]))
|
||||
|
||||
for rule in oncall_rules:
|
||||
oncall_api_client.create("personal_notification_rules", rule)
|
||||
|
||||
if oncall_rules:
|
||||
# delete old notification rules if any new rules were created
|
||||
for rule in user["oncall_user"]["notification_rules"]:
|
||||
oncall_api_client.delete(
|
||||
"personal_notification_rules/{}".format(rule["id"])
|
||||
)
|
||||
|
||||
|
||||
def transform_notification_rules(
|
||||
notification_rules: list[dict], user_id: str
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue