add ssh key init param for server

This commit is contained in:
xenia 2021-06-15 05:53:27 -04:00
parent 08d6edb790
commit ea3c023d21
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,8 @@ cmd_status = cmd.add_parser("status")
cmd_init = cmd.add_parser("init")
cmd_init.add_argument("-n", "--name", type=str, help="Name of the server node", required=True)
cmd_init.add_argument("-i", "--ip", type=str, help="Public IP of the server node", required=True)
cmd_add.add_argument("-k", "--ssh-key", type=argparse.FileType("r"),
help="SSH private keyfile for the server", required=True)
cmd_add = cmd.add_parser("add")
cmd_add.add_argument("-n", "--name", type=str, help="Name of the node to add", required=True)

View File

@ -48,10 +48,10 @@ class Database:
self.conn.commit()
def init_server(self, name: str, public_ip: ipaddress.IPv4Address) -> None:
def init_server(self, name: str, public_ip: ipaddress.IPv4Address, ssh_key: str) -> None:
if self.get_node(SERVER_NODE_ID) is not None:
raise Exception("there is already a server node defined")
self.add_node(name, public_ip, None)
self.add_node(name, public_ip, ssh_key)
def get_subnet(self) -> ipaddress.IPv4Interface:
cur = self.conn.cursor()