tests/vm: change scripts to use self._config

This change converts existing scripts to using for example self.ROOT_PASS,
to self._config['root_pass'].
We made similar changes for GUEST_USER, and GUEST_PASS.
This allows us also to remove the change in basevm.py,
which adds __getattr__ for backwards compatibility.

Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Peter Puhov <peter.puhov@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200601211421.1277-8-robert.foley@linaro.org>
Message-Id: <20200701135652.1366-12-alex.bennee@linaro.org>
This commit is contained in:
Robert Foley 2020-07-01 14:56:23 +01:00 committed by Alex Bennée
parent d322fe2daf
commit df00168039
5 changed files with 38 additions and 42 deletions

View file

@ -183,13 +183,6 @@ class BaseVM(object):
self.console_init(timeout=timeout)
self.console_wait(wait_string)
def __getattr__(self, name):
# Support direct access to config by key.
# for example, access self._config['cpu'] by self.cpu
if name.lower() in self._config.keys():
return self._config[name.lower()]
return object.__getattribute__(self, name)
def _download_with_cache(self, url, sha256sum=None, sha512sum=None):
def check_sha256sum(fname):
if not sha256sum:
@ -239,13 +232,13 @@ class BaseVM(object):
return r
def ssh(self, *cmd):
return self._ssh_do(self.GUEST_USER, cmd, False)
return self._ssh_do(self._config["guest_user"], cmd, False)
def ssh_root(self, *cmd):
return self._ssh_do("root", cmd, False)
def ssh_check(self, *cmd):
self._ssh_do(self.GUEST_USER, cmd, True)
self._ssh_do(self._config["guest_user"], cmd, True)
def ssh_root_check(self, *cmd):
self._ssh_do("root", cmd, True)