Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Rename EventGrid subscription (#2960)
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges authored Apr 4, 2023
1 parent 706c9fc commit 34b513e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/deployment/bicep-templates/event-grid.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource eventGridSystemTopics 'Microsoft.EventGrid/systemTopics@2021-12-01' = {
}

resource eventSubscriptions 'Microsoft.EventGrid/systemTopics/eventSubscriptions@2021-12-01' = {
name: 'onefuzz1_subscription'
name: 'onefuzz1-subscription'
parent: eventGridSystemTopics
properties: {
destination: {
Expand Down
20 changes: 11 additions & 9 deletions src/deployment/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,16 +877,18 @@ def remove_eventgrid(self) -> None:
)

# Event subscription for version up to 5.1.0
old_subscription_name = "onefuzz1"
old_subscription_exists = Client.event_subscription_exists(
event_grid_client, src_resource_id, old_subscription_name
)
# or 7.1.0
old_subscription_names = ["onefuzz1", "onefuzz1_subscription"]
for old_subscription_name in old_subscription_names:
old_subscription_exists = Client.event_subscription_exists(
event_grid_client, src_resource_id, old_subscription_name
)

if old_subscription_exists:
logger.info("removing deprecated event subscription")
event_grid_client.event_subscriptions.begin_delete(
src_resource_id, old_subscription_name
).wait()
if old_subscription_exists:
logger.info("removing deprecated event subscription")
event_grid_client.event_subscriptions.begin_delete(
src_resource_id, old_subscription_name
).wait()

def add_instance_id(self) -> None:
logger.info("setting instance_id log export")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_base_event(
resource_group, location
):
if (
entry.name == "onefuzz1_subscription"
entry.name == "onefuzz1-subscription"
and entry.type == "Microsoft.EventGrid/eventSubscriptions"
and entry.event_delivery_schema == "EventGridSchema"
and entry.destination.endpoint_type == "StorageQueue"
Expand Down

0 comments on commit 34b513e

Please sign in to comment.