diff --git a/manifester/manifester.py b/manifester/manifester.py index cfb79b1..fdaea30 100644 --- a/manifester/manifester.py +++ b/manifester/manifester.py @@ -323,3 +323,13 @@ def get_manifest(self): subscription_data=sub, ) return self.trigger_manifest_export() + + def __enter__(self): + try: + return self.get_manifest() + except: + self.delete_subscription_allocation() + raise + + def __exit__(self, *tb_args): + self.delete_subscription_allocation()