feat: prompt user for confirmation before destroying instance
This commit is contained in:
@@ -112,7 +112,6 @@ def create_instance(offer_id: int) -> int:
|
||||
return response["new_contract"]
|
||||
|
||||
def destroy_instance(instance_id: int) -> None:
|
||||
return None
|
||||
"""Destroys a running instance."""
|
||||
print(f"Destroying instance {instance_id}...")
|
||||
vast_request("DELETE", f"instances/{instance_id}/")
|
||||
@@ -260,11 +259,12 @@ def main():
|
||||
finally:
|
||||
if instance_id:
|
||||
try:
|
||||
input("\nPress ENTER to destroy the instance and clean up...")
|
||||
should_destroy=input("\nENTER D to destroy the instance and clean up...")
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
pass
|
||||
print("\nCleaning up...")
|
||||
destroy_instance(instance_id)
|
||||
if should_destroy.strip().lower() == 'd':
|
||||
print("\nCleaning up...")
|
||||
destroy_instance(instance_id)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user