populate_billing_realms: Delete existing remote realms.

Running script multiple times created multiple `RemoteRealm`
objects resulting in processing error.
This commit is contained in:
Aman Agrawal
2023-12-08 05:55:51 +00:00
committed by Tim Abbott
parent 0f163cedbc
commit c49fc8c6fe

View File

@@ -461,6 +461,10 @@ def populate_remote_server(customer_profile: CustomerProfile) -> Dict[str, str]:
def populate_remote_realms(customer_profile: CustomerProfile) -> Dict[str, str]:
# Delete existing remote realm.
RemoteRealm.objects.filter(name=customer_profile.unique_id).delete()
flush_cache(None)
local_realm = populate_realm(customer_profile)
assert local_realm is not None