generate-all-test-cases: use SSH keys instead of password for VMs

Previously passwords were used to log into provisioned QEMU VMs. This is
not practical if one would like to use e.g. rsync to transfer files from
and to the VM. The script now does not use passwords at all, but instead
configures the most recent SSH key from the system matching
'~/.ssh/id*.pub' as an authorized key on the VM. Alternatively the SSH
key to be used can be provided as an argument to the script.

In addition, the script no longer relies on external files for
cloud-init user-data. If no cloud-init user-data are provided as an
argument to the script creates default user-data file in a temporary
work directory and uses it. The reason for this change is mostly that the
default user-data became very short and need to be always extended with
the authorized SSH key anyway. In addition, this makes the script more
standalone by relying on fewer external file paths.

Delete the `tools/deploy/gen-test-data` which held the cloud-init
user-data previously used by default by the script.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-09-15 13:30:17 +02:00 committed by Ondřej Budai
parent 6f89cada2d
commit 94c2a6268c
2 changed files with 121 additions and 47 deletions

View file

@ -1,18 +0,0 @@
#cloud-config
yum_repos:
# Fetch osbuild packages from a repository served on the host.
#
# In qemu user networking, 10.0.2.2 always points to the host:
# https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29
osbuild:
name: osbuild
baseurl: "http://10.0.2.2:8000"
enabled: true
gpgcheck: false
skip_if_unavailable: true
user: admin
password: foobar
ssh_pwauth: True
chpasswd:
expire: False
sudo: 'ALL=(ALL) NOPASSWD:ALL'