droplets: Rename exit_if_droplet_exists to assert_droplet_does_not_exist.

This commit is contained in:
Vishnu KS 2021-03-17 22:57:12 +05:30 committed by Tim Abbott
parent ca9d82fc06
commit 3407627c46
1 changed files with 2 additions and 3 deletions

View File

@ -86,7 +86,7 @@ def fork_exists(username: str) -> bool:
sys.exit(1) sys.exit(1)
def exit_if_droplet_exists(my_token: str, username: str, recreate: bool) -> None: def assert_droplet_does_not_exist(my_token: str, username: str, recreate: bool) -> None:
print(f"Checking to see if droplet for {username} already exists...") print(f"Checking to see if droplet for {username} already exists...")
manager = digitalocean.Manager(token=my_token) manager = digitalocean.Manager(token=my_token)
my_droplets = manager.get_all_droplets() my_droplets = manager.get_all_droplets()
@ -269,8 +269,7 @@ if __name__ == "__main__":
fork_exists(username=username) fork_exists(username=username)
api_token = config["digitalocean"]["api_token"] api_token = config["digitalocean"]["api_token"]
# does the droplet already exist? assert_droplet_does_not_exist(my_token=api_token, username=username, recreate=args.recreate)
exit_if_droplet_exists(my_token=api_token, username=username, recreate=args.recreate)
# set user_data # set user_data
user_data = set_user_data(username=username, userkey_dicts=public_keys) user_data = set_user_data(username=username, userkey_dicts=public_keys)