nixos/lib/test-driver: set defaults in __init__ instead of class level

Just a minor code style nit to avoid potential footguns
This commit is contained in:
K900 2021-10-19 16:29:19 +03:00
parent a874235dff
commit 9611041ef5

View file

@ -405,14 +405,14 @@ class Machine:
keep_vm_state: bool keep_vm_state: bool
allow_reboot: bool allow_reboot: bool
process: Optional[subprocess.Popen] = None process: Optional[subprocess.Popen]
pid: Optional[int] = None pid: Optional[int]
monitor: Optional[socket.socket] = None monitor: Optional[socket.socket]
shell: Optional[socket.socket] = None shell: Optional[socket.socket]
serial_thread: Optional[threading.Thread] serial_thread: Optional[threading.Thread]
booted: bool = False booted: bool
connected: bool = False connected: bool
# Store last serial console lines for use # Store last serial console lines for use
# of wait_for_console_text # of wait_for_console_text
last_lines: Queue = Queue() last_lines: Queue = Queue()
@ -445,8 +445,15 @@ class Machine:
self.cleanup_statedir() self.cleanup_statedir()
self.state_dir.mkdir(mode=0o700, exist_ok=True) self.state_dir.mkdir(mode=0o700, exist_ok=True)
self.process = None
self.pid = None
self.monitor = None
self.shell = None
self.serial_thread = None self.serial_thread = None
self.booted = False
self.connected = False
@staticmethod @staticmethod
def create_startcommand(args: Dict[str, str]) -> StartCommand: def create_startcommand(args: Dict[str, str]) -> StartCommand:
rootlog.warning( rootlog.warning(