Skip to content

Commit

Permalink
Merge pull request #10 from JacobCallahan/main
Browse files Browse the repository at this point in the history
Add basic context manager functionality
  • Loading branch information
mshriver authored Aug 15, 2022
2 parents f344a97 + 951bfbe commit c06b552
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions manifester/manifester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit c06b552

Please sign in to comment.