make ssh key optional
This commit is contained in:
parent
e2a968073d
commit
291a287141
|
@ -16,7 +16,7 @@ class Node(NamedTuple):
|
|||
public_ip: Optional[ipaddress.IPv4Address]
|
||||
ip: ipaddress.IPv4Address
|
||||
seckey: str
|
||||
ssh_key: str
|
||||
ssh_key: Optional[str]
|
||||
|
||||
|
||||
class Database:
|
||||
|
@ -29,7 +29,7 @@ class Database:
|
|||
self.conn.execute(
|
||||
"""CREATE TABLE IF NOT EXISTS nodes (id INTEGER PRIMARY KEY, name TEXT NOT NULL,
|
||||
public_ip TEXT, ip TEXT NOT NULL, seckey TEXT NOT NULL,
|
||||
ssh_key TEXT NOT NULL)""")
|
||||
ssh_key TEXT)""")
|
||||
self.conn.execute(
|
||||
"""CREATE TABLE IF NOT EXISTS node_resources
|
||||
(node INTEGER NOT NULL, resource TEXT NOT NULL, PRIMARY KEY (node, resource),
|
||||
|
@ -44,7 +44,7 @@ class Database:
|
|||
def init_server(self, name: str, public_ip: ipaddress.IPv4Address) -> 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, "lol no")
|
||||
self.add_node(name, public_ip, None)
|
||||
|
||||
def get_subnet(self) -> ipaddress.IPv4Interface:
|
||||
cur = self.conn.cursor()
|
||||
|
@ -69,7 +69,8 @@ class Database:
|
|||
raise Exception("no more ips left to allocate!")
|
||||
return next(subnets[0].hosts())
|
||||
|
||||
def add_node(self, name: str, public_ip: Optional[ipaddress.IPv4Address], ssh_key: str) -> None:
|
||||
def add_node(self, name: str, public_ip: Optional[ipaddress.IPv4Address],
|
||||
ssh_key: Optional[str]) -> None:
|
||||
cur = self.conn.cursor()
|
||||
ip = self._get_free_ip()
|
||||
|
||||
|
|
Loading…
Reference in New Issue