daemon: finished class variable type hinting for core.nodes
This commit is contained in:
parent
452e0720f2
commit
6ee9590bdc
4 changed files with 15 additions and 15 deletions
|
@ -20,8 +20,8 @@ class VnodeClient:
|
||||||
:param name: name for client
|
:param name: name for client
|
||||||
:param ctrlchnlname: control channel name
|
:param ctrlchnlname: control channel name
|
||||||
"""
|
"""
|
||||||
self.name = name
|
self.name: str = name
|
||||||
self.ctrlchnlname = ctrlchnlname
|
self.ctrlchnlname: str = ctrlchnlname
|
||||||
|
|
||||||
def _verify_connection(self) -> None:
|
def _verify_connection(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,7 +2,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from typing import TYPE_CHECKING, Callable, Dict
|
from typing import TYPE_CHECKING, Callable, Dict, Optional
|
||||||
|
|
||||||
from core import utils
|
from core import utils
|
||||||
from core.emulator.distributed import DistributedServer
|
from core.emulator.distributed import DistributedServer
|
||||||
|
@ -17,10 +17,10 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
class DockerClient:
|
class DockerClient:
|
||||||
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
||||||
self.name = name
|
self.name: str = name
|
||||||
self.image = image
|
self.image: str = image
|
||||||
self.run = run
|
self.run: Callable[..., str] = run
|
||||||
self.pid = None
|
self.pid: Optional[str] = None
|
||||||
|
|
||||||
def create_container(self) -> str:
|
def create_container(self) -> str:
|
||||||
self.run(
|
self.run(
|
||||||
|
@ -95,7 +95,7 @@ class DockerNode(CoreNode):
|
||||||
"""
|
"""
|
||||||
if image is None:
|
if image is None:
|
||||||
image = "ubuntu"
|
image = "ubuntu"
|
||||||
self.image = image
|
self.image: str = image
|
||||||
super().__init__(session, _id, name, nodedir, start, server)
|
super().__init__(session, _id, name, nodedir, start, server)
|
||||||
|
|
||||||
def create_node_net_client(self, use_ovs: bool) -> LinuxNetClient:
|
def create_node_net_client(self, use_ovs: bool) -> LinuxNetClient:
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from typing import TYPE_CHECKING, Callable, Dict
|
from typing import TYPE_CHECKING, Callable, Dict, Optional
|
||||||
|
|
||||||
from core import utils
|
from core import utils
|
||||||
from core.emulator.distributed import DistributedServer
|
from core.emulator.distributed import DistributedServer
|
||||||
|
@ -18,10 +18,10 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
class LxdClient:
|
class LxdClient:
|
||||||
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
||||||
self.name = name
|
self.name: str = name
|
||||||
self.image = image
|
self.image: str = image
|
||||||
self.run = run
|
self.run: Callable[..., str] = run
|
||||||
self.pid = None
|
self.pid: Optional[int] = None
|
||||||
|
|
||||||
def create_container(self) -> int:
|
def create_container(self) -> int:
|
||||||
self.run(f"lxc launch {self.image} {self.name}")
|
self.run(f"lxc launch {self.image} {self.name}")
|
||||||
|
@ -92,7 +92,7 @@ class LxcNode(CoreNode):
|
||||||
"""
|
"""
|
||||||
if image is None:
|
if image is None:
|
||||||
image = "ubuntu"
|
image = "ubuntu"
|
||||||
self.image = image
|
self.image: str = image
|
||||||
super().__init__(session, _id, name, nodedir, start, server)
|
super().__init__(session, _id, name, nodedir, start, server)
|
||||||
|
|
||||||
def alive(self) -> bool:
|
def alive(self) -> bool:
|
||||||
|
|
|
@ -19,7 +19,7 @@ class LinuxNetClient:
|
||||||
|
|
||||||
:param run: function to run commands with
|
:param run: function to run commands with
|
||||||
"""
|
"""
|
||||||
self.run = run
|
self.run: Callable[..., str] = run
|
||||||
|
|
||||||
def set_hostname(self, name: str) -> None:
|
def set_hostname(self, name: str) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue