ssh-key input parameter allowed
This commit is contained in:
parent
7c5adf8517
commit
a0fd38e966
@ -10,4 +10,4 @@ echo "--------------------------------------------------------------------------
|
||||
echo " Success! I guess..."
|
||||
echo "############################"
|
||||
echo "Let's spawn some new machines!"
|
||||
python just_do_everything.py --create
|
||||
python just_do_everything.py $1 --create
|
@ -95,18 +95,17 @@ def create_client(creds_path):
|
||||
return client
|
||||
|
||||
|
||||
def load_key(key_folder, pub_key_name):
|
||||
home_path = Path.home().joinpath(key_folder, pub_key_name)
|
||||
print(f"\t\tUsing the {home_path} file")
|
||||
with open(home_path) as f:
|
||||
def load_key(pub_key_path):
|
||||
print(f"\t\tUsing the {pub_key_path} file")
|
||||
with open(pub_key_path) as f:
|
||||
key = f.readline()
|
||||
print("\t\tThe SSH KEY has been LOADED")
|
||||
return key
|
||||
|
||||
|
||||
def create_key(client, key_name, key_folder, pub_key_name):
|
||||
def create_key(client, key_name, pub_key_path):
|
||||
print("The SSH KEY has been...")
|
||||
key_of_power = load_key(key_folder, pub_key_name)
|
||||
key_of_power = load_key(pub_key_path)
|
||||
key = client.ssh_keys.create(name=key_name, public_key=key_of_power)
|
||||
print("\tCREATED")
|
||||
return key
|
||||
@ -231,10 +230,11 @@ if __name__ == "__main__":
|
||||
|
||||
client = create_client("../tokens/token_file")
|
||||
|
||||
ssh_path = sys.argv[-2]
|
||||
action = sys.argv[-1]
|
||||
|
||||
if action == "--create":
|
||||
ssh_key = create_key(client, key_name, ".ssh", "id_ed25519.pub")
|
||||
ssh_key = create_key(client, key_name, ssh_path)
|
||||
vnet = create_network(client, net_name, "10.10.10.0/24")
|
||||
volume = create_volume(client, volume_name, location)
|
||||
db = create_db(client, db_name, ssh_key, vnet, location, INIT_DB_CONTENT)
|
||||
|
Loading…
Reference in New Issue
Block a user