add ssh key init param for server
This commit is contained in:
parent
08d6edb790
commit
ea3c023d21
|
@ -21,6 +21,8 @@ cmd_status = cmd.add_parser("status")
|
||||||
cmd_init = cmd.add_parser("init")
|
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("-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_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 = cmd.add_parser("add")
|
||||||
cmd_add.add_argument("-n", "--name", type=str, help="Name of the node to add", required=True)
|
cmd_add.add_argument("-n", "--name", type=str, help="Name of the node to add", required=True)
|
||||||
|
|
|
@ -48,10 +48,10 @@ class Database:
|
||||||
|
|
||||||
self.conn.commit()
|
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:
|
if self.get_node(SERVER_NODE_ID) is not None:
|
||||||
raise Exception("there is already a server node defined")
|
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:
|
def get_subnet(self) -> ipaddress.IPv4Interface:
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
|
|
Loading…
Reference in New Issue