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 ctrlchnlname: control channel name
|
||||
"""
|
||||
self.name = name
|
||||
self.ctrlchnlname = ctrlchnlname
|
||||
self.name: str = name
|
||||
self.ctrlchnlname: str = ctrlchnlname
|
||||
|
||||
def _verify_connection(self) -> None:
|
||||
"""
|
||||
|
|
|
@ -2,7 +2,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
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.emulator.distributed import DistributedServer
|
||||
|
@ -17,10 +17,10 @@ if TYPE_CHECKING:
|
|||
|
||||
class DockerClient:
|
||||
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
||||
self.name = name
|
||||
self.image = image
|
||||
self.run = run
|
||||
self.pid = None
|
||||
self.name: str = name
|
||||
self.image: str = image
|
||||
self.run: Callable[..., str] = run
|
||||
self.pid: Optional[str] = None
|
||||
|
||||
def create_container(self) -> str:
|
||||
self.run(
|
||||
|
@ -95,7 +95,7 @@ class DockerNode(CoreNode):
|
|||
"""
|
||||
if image is None:
|
||||
image = "ubuntu"
|
||||
self.image = image
|
||||
self.image: str = image
|
||||
super().__init__(session, _id, name, nodedir, start, server)
|
||||
|
||||
def create_node_net_client(self, use_ovs: bool) -> LinuxNetClient:
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import os
|
||||
import time
|
||||
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.emulator.distributed import DistributedServer
|
||||
|
@ -18,10 +18,10 @@ if TYPE_CHECKING:
|
|||
|
||||
class LxdClient:
|
||||
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
||||
self.name = name
|
||||
self.image = image
|
||||
self.run = run
|
||||
self.pid = None
|
||||
self.name: str = name
|
||||
self.image: str = image
|
||||
self.run: Callable[..., str] = run
|
||||
self.pid: Optional[int] = None
|
||||
|
||||
def create_container(self) -> int:
|
||||
self.run(f"lxc launch {self.image} {self.name}")
|
||||
|
@ -92,7 +92,7 @@ class LxcNode(CoreNode):
|
|||
"""
|
||||
if image is None:
|
||||
image = "ubuntu"
|
||||
self.image = image
|
||||
self.image: str = image
|
||||
super().__init__(session, _id, name, nodedir, start, server)
|
||||
|
||||
def alive(self) -> bool:
|
||||
|
|
|
@ -19,7 +19,7 @@ class LinuxNetClient:
|
|||
|
||||
:param run: function to run commands with
|
||||
"""
|
||||
self.run = run
|
||||
self.run: Callable[..., str] = run
|
||||
|
||||
def set_hostname(self, name: str) -> None:
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue