Detach principal from thing when it is deleted
This commit is contained in:
parent
577f81a18b
commit
2d5e2e9c2b
2 changed files with 25 additions and 0 deletions
|
|
@ -331,6 +331,12 @@ class IoTBackend(BaseBackend):
|
|||
|
||||
# can raise ResourceNotFoundError
|
||||
thing = self.describe_thing(thing_name)
|
||||
|
||||
# detach all principals
|
||||
for k in list(self.principal_things.keys()):
|
||||
if k[1] == thing_name:
|
||||
del self.principal_things[k]
|
||||
|
||||
del self.things[thing.arn]
|
||||
|
||||
def delete_thing_type(self, thing_type_name):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue