[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 11/40] tests/vm: change scripts to use self._config
From: |
Alex Bennée |
Subject: |
Re: [PATCH v4 11/40] tests/vm: change scripts to use self._config |
Date: |
Fri, 10 Jul 2020 19:16:46 +0100 |
User-agent: |
mu4e 1.5.4; emacs 28.0.50 |
Alex Bennée <alex.bennee@linaro.org> writes:
> From: Robert Foley <robert.foley@linaro.org>
>
> 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>
> ---
> tests/vm/basevm.py | 11 ++---------
> tests/vm/fedora | 17 +++++++++--------
> tests/vm/freebsd | 16 ++++++++--------
> tests/vm/netbsd | 19 ++++++++++---------
> tests/vm/openbsd | 17 +++++++++--------
> 5 files changed, 38 insertions(+), 42 deletions(-)
>
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 5fd66f6b26a..f716798b405 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -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)
> diff --git a/tests/vm/fedora b/tests/vm/fedora
> index a9195670f4b..b2b478fdbca 100755
> --- a/tests/vm/fedora
> +++ b/tests/vm/fedora
> @@ -108,20 +108,20 @@ class FedoraVM(basevm.BaseVM):
>
> self.console_wait_send("7) [!] Root password", "7\n")
> self.console_wait("Password:")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
> self.console_wait("Password (confirm):")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
>
> self.console_wait_send("8) [ ] User creation", "8\n")
> self.console_wait_send("1) [ ] Create user", "1\n")
> self.console_wait_send("3) User name", "3\n")
> - self.console_wait_send("ENTER:", "%s\n" % self.GUEST_USER)
> + self.console_wait_send("ENTER:", "%s\n" % self._config["guest_user"])
> self.console_wait_send("4) [ ] Use password", "4\n")
> self.console_wait_send("5) Password", "5\n")
> self.console_wait("Password:")
> - self.console_send("%s\n" % self.GUEST_PASS)
> + self.console_send("%s\n" % self._config["guest_pass"])
> self.console_wait("Password (confirm):")
> - self.console_send("%s\n" % self.GUEST_PASS)
> + self.console_send("%s\n" % self._config["guest_pass"])
> self.console_wait_send("7) Groups", "c\n")
>
> while True:
> @@ -139,7 +139,7 @@ class FedoraVM(basevm.BaseVM):
> if good:
> break
> time.sleep(10)
> - self.console_send("r\n" % self.GUEST_PASS)
> + self.console_send("r\n" % self._config["guest_pass"])
>
> self.console_wait_send("'b' to begin install", "b\n")
>
> @@ -150,12 +150,13 @@ class FedoraVM(basevm.BaseVM):
>
> # setup qemu user
> prompt = " ~]$"
> - self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
> + self.console_ssh_init(prompt, self._config["guest_user"],
> + self._config["guest_pass"])
> self.console_wait_send(prompt, "exit\n")
>
> # setup root user
> prompt = " ~]#"
> - self.console_ssh_init(prompt, "root", self.ROOT_PASS)
> + self.console_ssh_init(prompt, "root", self._config["root_pass"])
> self.console_sshd_config(prompt)
>
> # setup virtio-blk #1 (tarfile)
> diff --git a/tests/vm/freebsd b/tests/vm/freebsd
> index f87db2b126e..29252fa4a64 100755
> --- a/tests/vm/freebsd
> +++ b/tests/vm/freebsd
> @@ -113,9 +113,9 @@ class FreeBSDVM(basevm.BaseVM):
>
> # post-install configuration
> self.console_wait("New Password:")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
> self.console_wait("Retype New Password:")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
>
> self.console_wait_send("Network Configuration", "\n")
> self.console_wait_send("IPv4", "y")
> @@ -134,9 +134,9 @@ class FreeBSDVM(basevm.BaseVM):
> # qemu user
> self.console_wait_send("Add User Accounts", "y")
> self.console_wait("Username")
> - self.console_send("%s\n" % self.GUEST_USER)
> + self.console_send("%s\n" % self._config["guest_user"])
> self.console_wait("Full name")
> - self.console_send("%s\n" % self.GUEST_USER)
> + self.console_send("%s\n" % self._config["guest_user"])
> self.console_wait_send("Uid", "\n")
> self.console_wait_send("Login group", "\n")
> self.console_wait_send("Login group", "\n")
> @@ -148,9 +148,9 @@ class FreeBSDVM(basevm.BaseVM):
> self.console_wait_send("Use an empty password", "\n")
> self.console_wait_send("Use a random password", "\n")
> self.console_wait("Enter password:")
> - self.console_send("%s\n" % self.GUEST_PASS)
> + self.console_send("%s\n" % self._config["guest_pass"])
> self.console_wait("Enter password again:")
> - self.console_send("%s\n" % self.GUEST_PASS)
> + self.console_send("%s\n" % self._config["guest_pass"])
> self.console_wait_send("Lock out", "\n")
> self.console_wait_send("OK", "yes\n")
> self.console_wait_send("Add another user", "no\n")
> @@ -164,12 +164,12 @@ class FreeBSDVM(basevm.BaseVM):
>
> # setup qemu user
> prompt = "$"
> - self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
> + self.console_ssh_init(prompt, self._config["guest_user"],
> self._config["guest_pass"])
> self.console_wait_send(prompt, "exit\n")
>
> # setup root user
> prompt = "root@freebsd:~ #"
> - self.console_ssh_init(prompt, "root", self.ROOT_PASS)
> + self.console_ssh_init(prompt, "root", self._config["root_pass"])
> self.console_sshd_config(prompt)
>
> # setup serial console
> diff --git a/tests/vm/netbsd b/tests/vm/netbsd
> index cdac502dad8..dc0e45c1d45 100755
> --- a/tests/vm/netbsd
> +++ b/tests/vm/netbsd
> @@ -120,24 +120,24 @@ class NetBSDVM(basevm.BaseVM):
> self.console_wait_send("d: Change root password", "d\n")
> self.console_wait_send("a: Yes", "a\n")
> self.console_wait("New password:")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
> self.console_wait("New password:")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
> self.console_wait("Retype new password:")
> - self.console_send("%s\n" % self.ROOT_PASS)
> + self.console_send("%s\n" % self._config["root_pass"])
>
> self.console_wait_send("o: Add a user", "o\n")
> self.console_wait("username")
> - self.console_send("%s\n" % self.GUEST_USER)
> + self.console_send("%s\n" % self._config["guest_pass"])
Can you see where we went wrong ;-)
<snip>
--
Alex Bennée
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, (continued)
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, Philippe Mathieu-Daudé, 2020/07/01
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, Alex Bennée, 2020/07/01
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, Philippe Mathieu-Daudé, 2020/07/01
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, Philippe Mathieu-Daudé, 2020/07/01
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, Philippe Mathieu-Daudé, 2020/07/01
- Re: [PATCH v4 01/40] hw/isa: check for current_cpu before generating IRQ, Philippe Mathieu-Daudé, 2020/07/01
[PATCH v4 04/40] util/coroutine: Cleanup start_switch_fiber_ for TSAN., Alex Bennée, 2020/07/01
[PATCH v4 12/40] python/qemu: Add ConsoleSocket for optional use in QEMUMachine, Alex Bennée, 2020/07/01
[PATCH v4 10/40] tests/vm: Added a new script for centos.aarch64., Alex Bennée, 2020/07/01
[PATCH v4 11/40] tests/vm: change scripts to use self._config, Alex Bennée, 2020/07/01
- Re: [PATCH v4 11/40] tests/vm: change scripts to use self._config,
Alex Bennée <=
[PATCH v4 07/40] tests/vm: Added configuration file support, Alex Bennée, 2020/07/01
[PATCH v4 09/40] tests/vm: Added a new script for ubuntu.aarch64., Alex Bennée, 2020/07/01
[PATCH v4 08/40] tests/vm: Add common Ubuntu python module, Alex Bennée, 2020/07/01
[PATCH v4 05/40] tests/vm: pass args through to BaseVM's __init__, Alex Bennée, 2020/07/01
[PATCH v4 25/40] tests/docker: add packages needed for check-acceptance, Alex Bennée, 2020/07/01
[PATCH v4 06/40] tests/vm: Add configuration to basevm.py, Alex Bennée, 2020/07/01
[PATCH v4 24/40] tests/docker: add --registry support to tooling, Alex Bennée, 2020/07/01
[PATCH v4 21/40] gitlab: build all container images during CI, Alex Bennée, 2020/07/01
[PATCH v4 20/40] gitlab: introduce explicit "container" and "build" stages, Alex Bennée, 2020/07/01
[PATCH v4 19/40] gitlab-ci: Fix the change rules after moving the YML files, Alex Bennée, 2020/07/01