[libvirt] [jenkins-ci PATCH 0/8] lcitool: Rewrite in Python

While the previous implementation has served us well, it was very quickly cobbled together using a language that's not really suitable for the purpose; the fact that we had to embed a Perl (previously Python) script in there is a clear indication that we had outgrown the language pretty much from the get go, and while I'm weirdly proud of the hackish way I implemented inventory handling I'll take a proper YAML parser instead any day :) The new implementation is not quite a drop-in replacement, but getting used to it should take very little time; most importantly, the new command line syntax lends itself to being extended in ways that had simply been impossible previously, and we're going to take advantage of the fact very soon when we integrate the Dockerfile generator (see [1]) and [secret feature redacted]. We also get some minor but neat improvements like much better host list handling and XDG_CONFIG_HOME support. The script is compatible with both Python 2.7 and Python 3, and doesn't rely on any downstream patch being applied to the former. I'm absolutely not great at Python, so any input on style and such will be greatly appreciated. [1] https://www.redhat.com/archives/libvir-list/2018-June/msg01238.html Andrea Bolognani (8): lcitool: Drop shell implementation lcitool: Stub out Python implementation lcitool: Add tool configuration handling lcitool: Add inventory handling lcitool: Implement the 'list' action lcitool: Implement the 'install' action lcitool: Implement the 'update' action guests: Update documentation guests/README.markdown | 8 +- guests/lcitool | 585 +++++++++++++++++++++++++---------------- 2 files changed, 366 insertions(+), 227 deletions(-) -- 2.17.1

We're going to rewrite the script completely, and getting the current implementation out of the way firts will make the diffs more reasonable. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 227 ------------------------------------------------- 1 file changed, 227 deletions(-) delete mode 100755 guests/lcitool diff --git a/guests/lcitool b/guests/lcitool deleted file mode 100755 index 0c1520e..0000000 --- a/guests/lcitool +++ /dev/null @@ -1,227 +0,0 @@ -#!/bin/sh - -# ------------------- -# Utility functions -# ------------------- - -# die MESSAGE -# -# Abort the program after displaying $MESSAGE on standard error. -die() { - echo "$1" >&2 - exit 1 -} - -# hash_file PASS_FILE -# -# Generate a password hash from the contents of PASS_FILE. -hash_file() { - PASS_FILE="$1" - - perl -le ' - my @chars = ("A".."Z", "a".."z", "0".."9"); - my $salt; $salt .= $chars[rand @chars] for 1..16; - my $handle; open($handle, "'"$PASS_FILE"'"); - my $pass = <$handle>; chomp($pass); - print crypt("$pass", "\$6\$$salt\$");' -} - -# yaml_var FILE VAR -# -# Read $FILE and output the value of YAML variable $VAR. Only trivial YAML -# values are supported, eg. strings and numbers that don't depend on the -# value of other variables. That's enough for our use case. -yaml_var() { - grep "^$2:\\s*" "$1" 2>/dev/null | tail -1 | sed "s/$2:\\s*//g" -} - -# load_install_config FILE -# -# Read all known configuration variables from $FILE and set them in the -# environment. Configuration variables that have already been set in -# the environment will not be updated. -load_install_config() { - INSTALL_URL=${INSTALL_URL:-$(yaml_var "$1" install_url)} - INSTALL_CONFIG=${INSTALL_CONFIG:-$(yaml_var "$1" install_config)} - INSTALL_VIRT_TYPE=${INSTALL_VIRT_TYPE:-$(yaml_var "$1" install_virt_type)} - INSTALL_ARCH=${INSTALL_ARCH:-$(yaml_var "$1" install_arch)} - INSTALL_MACHINE=${INSTALL_MACHINE:-$(yaml_var "$1" install_machine)} - INSTALL_CPU_MODEL=${INSTALL_CPU_MODEL:-$(yaml_var "$1" install_cpu_model)} - INSTALL_VCPUS=${INSTALL_VCPUS:-$(yaml_var "$1" install_vcpus)} - INSTALL_MEMORY_SIZE=${INSTALL_MEMORY_SIZE:-$(yaml_var "$1" install_memory_size)} - INSTALL_DISK_SIZE=${INSTALL_DISK_SIZE:-$(yaml_var "$1" install_disk_size)} - INSTALL_STORAGE_POOL=${INSTALL_STORAGE_POOL:-$(yaml_var "$1" install_storage_pool)} - INSTALL_NETWORK=${INSTALL_NETWORK:-$(yaml_var "$1" install_network)} -} - -# load_config -# -# Read tool configuration and perform the necessary validation. -load_config() { - CONFIG_DIR="$HOME/.config/$PROGRAM_NAME" - - mkdir -p "$CONFIG_DIR" >/dev/null 2>&1 || { - die "$PROGRAM_NAME: $CONFIG_DIR: Unable to create config directory" - } - - FLAVOR_FILE="$CONFIG_DIR/flavor" - VAULT_PASS_FILE="$CONFIG_DIR/vault-password" - ROOT_PASS_FILE="$CONFIG_DIR/root-password" - - # Two flavors are supported: test (default) and jenkins. Read the - # flavor from configuration, validate it and write it back in case - # it was not present - FLAVOR="$(cat "$FLAVOR_FILE" 2>/dev/null)" - FLAVOR=${FLAVOR:-test} - test "$FLAVOR" = test || test "$FLAVOR" = jenkins || { - die "$PROGRAM_NAME: Invalid flavor '$FLAVOR'" - } - echo "$FLAVOR" >"$FLAVOR_FILE" || { - die "$PROGRAM_NAME: $FLAVOR_FILE: Unable to save flavor" - } - - test "$FLAVOR" = jenkins && { - # The vault password is only needed for the jenkins flavor, so only - # validate it in that case - test -f "$VAULT_PASS_FILE" && test "$(cat "$VAULT_PASS_FILE")" || { - die "$PROGRAM_NAME: $VAULT_PASS_FILE: Missing or invalid password" - } - } || { - # For other flavors, undefine the variable so that Ansible - # will not try to read the file at all - VAULT_PASS_FILE= - } - - # Make sure the root password has been configured properly - test -f "$ROOT_PASS_FILE" && test "$(cat "$ROOT_PASS_FILE")" || { - die "$PROGRAM_NAME: $ROOT_PASS_FILE: Missing or invalid password" - } - - ROOT_HASH_FILE="$CONFIG_DIR/.root-password.hash" - - # Regenerate root password hash. Ansible expects passwords as hashes but - # doesn't provide a built-in facility to generate one from plain text - hash_file "$ROOT_PASS_FILE" >"$ROOT_HASH_FILE" || { - die "$PROGRAM_NAME: Failure while hashing root password" - } -} - -# ---------------------- -# User-visible actions -# ---------------------- - -do_help() { - echo "\ -Usage: $CALL_NAME ACTION [OPTIONS] - -Actions: - list List known guests - install GUEST Install GUEST - prepare GUEST|all Prepare or update GUEST. Can be run multiple times - update GUEST|all Alias for prepare - help Display this help" -} - -do_list() { - # List all guests present in the inventory. Skip group names, - # comments and empty lines - grep -vE '^#|^\[|^$' inventory | sort -u -} - -do_install() -{ - GUEST="$1" - - test "$GUEST" || { - die "$(do_help)" - } - do_list | grep -q "$GUEST" || { - die "$PROGRAM_NAME: $GUEST: Unknown guest" - } - test -f "host_vars/$GUEST/install.yml" || { - die "$PROGRAM_NAME: $GUEST: Missing configuration, guest must be installed manually" - } - - load_config - - # Load configuration files. Values don't get overwritten after being - # set the first time, so loading the host-specific configuration before - # the group configuration ensures overrides work as expected - load_install_config "host_vars/$GUEST/install.yml" - load_install_config "group_vars/all/install.yml" - - # Both memory size and disk size use GiB as unit, but virt-install wants - # disk size in GiB and memory size in *MiB*, so perform conversion here - INSTALL_MEMORY_SIZE=$(expr "$INSTALL_MEMORY_SIZE" \* 1024 2>/dev/null) - - # preseed files must use a well-known name to be picked up by d-i; - # for kickstart files, we can use whatever name we please but we need - # to point anaconda in the right direction through a kernel argument - case "$INSTALL_CONFIG" in - *kickstart*|*ks*) EXTRA_ARGS="ks=file:/${INSTALL_CONFIG##*/}" ;; - esac - - # Only configure autostart for the guest for the jenkins flavor - test "$FLAVOR" = jenkins && { - AUTOSTART="--autostart" - } - - virt-install \ - --name "$GUEST" \ - --location "$INSTALL_URL" \ - --virt-type "$INSTALL_VIRT_TYPE" \ - --arch "$INSTALL_ARCH" \ - --machine "$INSTALL_MACHINE" \ - --cpu "$INSTALL_CPU_MODEL" \ - --vcpus "$INSTALL_VCPUS" \ - --memory "$INSTALL_MEMORY_SIZE" \ - --disk "size=$INSTALL_DISK_SIZE,pool=$INSTALL_STORAGE_POOL,bus=virtio" \ - --network "network=$INSTALL_NETWORK,model=virtio" \ - --graphics none \ - --console pty \ - --sound none \ - --initrd-inject "$INSTALL_CONFIG" \ - --extra-args "console=ttyS0 $EXTRA_ARGS" \ - $AUTOSTART \ - --wait 0 -} - -do_prepare() { - GUEST="$1" - - test "$GUEST" || { - die "$(do_help)" - } - do_list | grep -q "$GUEST" || test "$GUEST" = all || { - die "$PROGRAM_NAME: $GUEST: Unknown guest" - } - - load_config - - EXTRA_VARS="flavor=$FLAVOR root_password_file=$ROOT_HASH_FILE" - - ansible-playbook \ - --vault-password-file "$VAULT_PASS_FILE" \ - --extra-vars "$EXTRA_VARS" \ - -l "$GUEST" \ - site.yml -} - -# --------------------- -# Program entry point -# --------------------- - -CALL_NAME="$0" -PROGRAM_NAME="${0##*/}" - -test -f "$PROGRAM_NAME" || { - die "$PROGRAM_NAME: Must be run from the source directory" -} - -case "$1" in - list) do_list ;; - install) do_install "$2" ;; - prepare|update) do_prepare "$2" ;; - *help) do_help ;; - *) die "$(do_help)" ;; -esac -- 2.17.1

Doesn't do much right now, but it's a start :) Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 guests/lcitool diff --git a/guests/lcitool b/guests/lcitool new file mode 100755 index 0000000..1cba8ad --- /dev/null +++ b/guests/lcitool @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# lcitool - libvirt CI guest management tool +# Copyright (C) 2017-2018 Andrea Bolognani <abologna@redhat.com> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import argparse +import sys +import textwrap + +# This is necessary to maintain Python 2.7 compatibility +try: + import configparser +except ImportError: + import ConfigParser as configparser + +class Error(Exception): + + def __init__(self, message): + self.message = message + +class Application: + + def __init__(self): + self._parser = argparse.ArgumentParser( + conflict_handler = "resolve", + formatter_class = argparse.RawDescriptionHelpFormatter, + description = "libvirt CI guest management tool", + epilog = textwrap.dedent(""" + supported actions: + """), + ) + self._parser.add_argument( + "-a", + metavar = "ACTION", + required = True, + help = "action to perform (see below)", + ) + + def run(self): + cmdline = self._parser.parse_args() + action = cmdline.a + + method = "_action_{}".format(action.replace("-", "_")) + + if hasattr(self, method): + getattr(self, method).__call__() + else: + raise Error("Invalid action '{}'".format(action)) + +if __name__ == "__main__": + try: + Application().run() + except Error as e: + sys.stderr.write("{}: {}\n".format(sys.argv[0], e.message)) + sys.exit(1) -- 2.17.1

The on-disk configuration format and its behavior are fully backwards compatible with the previous implementation. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/guests/lcitool b/guests/lcitool index 1cba8ad..6d4010b 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -18,6 +18,10 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import argparse +import crypt +import os +import random +import string import sys import textwrap @@ -32,9 +36,114 @@ class Error(Exception): def __init__(self, message): self.message = message +class Config: + + def _mksalt(self): + alphabeth = string.ascii_letters + string.digits + salt = "".join(random.choice(alphabeth) for x in range(0, 16)) + return "$6${}$".format(salt) + + def _get_config_file(self, name): + try: + config_dir = os.environ["XDG_CONFIG_HOME"] + except KeyError: + config_dir = os.path.join(os.environ["HOME"], ".config/") + config_dir = os.path.join(config_dir, "lcitool/") + + # Create the directory if it doesn't already exist + if not os.path.exists(config_dir): + try: + os.mkdir(config_dir) + except: + raise Error( + "Can't create configuration directory ({})".format( + config_dir, + ) + ) + + return os.path.join(config_dir, name) + + def get_flavor(self): + flavor_file = self._get_config_file("flavor") + + try: + with open(flavor_file, "r") as f: + flavor = f.readline().strip() + except: + # If the flavor has not been configured, we choose the default + # and store it on disk to ensure consistent behavior from now on + flavor = "test" + try: + with open(flavor_file, "w") as f: + f.write("{}\n".format(flavor)) + except: + raise Error( + "Can't write flavor file ({})".format( + flavor_file, + ) + ) + + if flavor != "test" and flavor != "jenkins": + raise Error("Invalid flavor '{}'".format(flavor)) + + return flavor + + def get_vault_password_file(self): + vault_pass_file = None + + # The vault password is only needed for the jenkins flavor, but in + # that case we want to make sure there's *something* in there + if self.get_flavor() != "test": + vault_pass_file = self._get_config_file("vault-password") + + try: + with open(vault_pass_file, 'r') as f: + if len(f.readline().strip()) == 0: + raise ValueError + except: + raise Error( + "Missing or invalid vault password file ({})".format( + vault_pass_file, + ) + ) + + return vault_pass_file + + def get_root_password_file(self): + root_pass_file = self._get_config_file("root-password") + root_hash_file = self._get_config_file(".root-password.hash") + + try: + with open(root_pass_file, "r") as f: + root_pass = f.readline().strip() + except: + raise Error( + "Missing or invalid root password file ({})".format( + root_pass_file, + ) + ) + + # The hash will be different every time we run, but that doesn't + # matter - it will still validate the correct root password + root_hash = crypt.crypt(root_pass, self._mksalt()) + + try: + with open(root_hash_file, "w") as f: + f.write("{}\n".format(root_hash)) + except: + raise Error( + "Can't write hashed root password file ({})".format( + root_hash_file, + ) + ) + + return root_hash_file + class Application: def __init__(self): + self._config = Config() + self._parser = argparse.ArgumentParser( conflict_handler = "resolve", formatter_class = argparse.RawDescriptionHelpFormatter, -- 2.17.1

We use an actual YAML parser this time around, and bring the behavior more in line with what Ansible is doing, so interoperability should be more solid overall. New in this implementation is more flexibility in defining host lists, including support for explicit lists as well as glob patterns. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/guests/lcitool b/guests/lcitool index 6d4010b..3564eb8 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -19,11 +19,13 @@ import argparse import crypt +import fnmatch import os import random import string import sys import textwrap +import yaml # This is necessary to maintain Python 2.7 compatibility try: @@ -139,10 +141,95 @@ class Config: return root_hash_file +class Inventory: + + def __init__(self): + try: + parser = configparser.SafeConfigParser() + parser.read("./ansible.cfg") + inventory_path = parser.get("defaults", "inventory") + except: + raise Error("Can't find inventory location in ansible.cfg") + + self._facts = {} + try: + # We can only deal with trivial inventories, but that's + # all we need right now and we can expand support further + # later on if necessary + with open(inventory_path, "r") as f: + for line in f: + host = line.strip() + self._facts[host] = {} + except: + raise Error( + "Missing or invalid inventory ({})".format( + inventory_path, + ) + ) + + for host in self._facts: + try: + self._facts[host] = self._read_all_facts(host) + self._facts[host]["inventory_hostname"] = host + except: + raise Error("Can't load facts for '{}'".format(host)) + + def _add_facts_from_file(self, facts, yaml_path): + with open(yaml_path, "r") as f: + some_facts = yaml.load(f) + for fact in some_facts: + facts[fact] = some_facts[fact] + + def _read_all_facts(self, host): + facts = {} + + # We load from group_vars/ first and host_vars/ second, sorting + # files alphabetically; doing so should result in our view of + # the facts matching Ansible's + for source in ["./group_vars/all/", "./host_vars/{}/".format(host)]: + for item in sorted(os.listdir(source)): + yaml_path = os.path.join(source, item) + if not os.path.isfile(yaml_path): + continue + if not yaml_path.endswith(".yml"): + continue + self._add_facts_from_file(facts, yaml_path) + + return facts + + def expand_pattern(self, pattern): + if pattern == None: + raise Error("Missing host list") + + if pattern == "all": + pattern = "*" + + # This works correctly for single hosts as well as more complex + # cases such as explicit lists, glob patterns and any combination + # of the above + matches = [] + for partial_pattern in pattern.split(","): + + partial_matches = [] + for host in self._facts: + if fnmatch.fnmatch(host, partial_pattern): + partial_matches += [host] + + if len(partial_matches) == 0: + raise Error("Invalid host list '{}'".format(pattern)) + + matches += partial_matches + + return list(set(matches)) + + def get_facts(self, host): + return self._facts[host] + class Application: def __init__(self): self._config = Config() + self._inventory = Inventory() self._parser = argparse.ArgumentParser( conflict_handler = "resolve", -- 2.17.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guests/lcitool b/guests/lcitool index 3564eb8..1dd1ec8 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -237,6 +237,7 @@ class Application: description = "libvirt CI guest management tool", epilog = textwrap.dedent(""" supported actions: + list list all known hosts """), ) self._parser.add_argument( @@ -245,15 +246,25 @@ class Application: required = True, help = "action to perform (see below)", ) + self._parser.add_argument( + "-h", + metavar = "HOSTS", + help = "list of hosts to act on (glob patterns are supported)", + ) + + def _action_list(self, hosts): + for host in self._inventory.expand_pattern("all"): + print(host) def run(self): cmdline = self._parser.parse_args() action = cmdline.a + hosts = cmdline.h method = "_action_{}".format(action.replace("-", "_")) if hasattr(self, method): - getattr(self, method).__call__() + getattr(self, method).__call__(hosts) else: raise Error("Invalid action '{}'".format(action)) -- 2.17.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/guests/lcitool b/guests/lcitool index 1dd1ec8..cefce65 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -23,6 +23,7 @@ import fnmatch import os import random import string +import subprocess import sys import textwrap import yaml @@ -237,7 +238,8 @@ class Application: description = "libvirt CI guest management tool", epilog = textwrap.dedent(""" supported actions: - list list all known hosts + list list all known hosts + install perform unattended host installation """), ) self._parser.add_argument( @@ -256,6 +258,64 @@ class Application: for host in self._inventory.expand_pattern("all"): print(host) + def _action_install(self, hosts): + flavor = self._config.get_flavor() + + for host in self._inventory.expand_pattern(hosts): + facts = self._inventory.get_facts(host) + + # Both memory size and disk size are stored as GiB in the + # inventory, but virt-install expects the disk size in GiB + # and the memory size in *MiB*, so perform conversion here + memory_arg = str(int(facts["install_memory_size"]) * 1024) + + vcpus_arg = str(facts["install_vcpus"]) + + disk_arg = "size={},pool={},bus=virtio".format( + facts["install_disk_size"], + facts["install_storage_pool"], + ) + network_arg = "network={},model=virtio".format( + facts["install_network"], + ) + + # preseed files must use a well-known name to be picked up by + # d-i; for kickstart files, we can use whatever name we please + # but we need to point anaconda in the right direction through + # a kernel argument + extra_arg = "console=ttyS0 ks=file:/{}".format( + facts["install_config"], + ) + + cmd = [ + "virt-install", + "--name", host, + "--location", facts["install_url"], + "--virt-type", facts["install_virt_type"], + "--arch", facts["install_arch"], + "--machine", facts["install_machine"], + "--cpu", facts["install_cpu_model"], + "--vcpus", vcpus_arg, + "--memory", memory_arg, + "--disk", disk_arg, + "--network", network_arg, + "--graphics", "none", + "--console", "pty", + "--sound", "none", + "--initrd-inject", facts["install_config"], + "--extra-args", extra_arg, + "--wait", "0", + ] + + # Only configure autostart for the guest for the jenkins flavor + if flavor == "jenkins": + cmd += [ "--autostart" ] + + try: + subprocess.check_call(cmd) + except: + raise Error("Failed to install '{}'".format(host)) + def run(self): cmdline = self._parser.parse_args() action = cmdline.a -- 2.17.1

The 'prepare' alias was kinda redundant and offered dubious value, so it has been dropped. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/guests/lcitool b/guests/lcitool index cefce65..c17c174 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -240,6 +240,7 @@ class Application: supported actions: list list all known hosts install perform unattended host installation + update prepare hosts and keep them updated """), ) self._parser.add_argument( @@ -316,6 +317,35 @@ class Application: except: raise Error("Failed to install '{}'".format(host)) + def _action_update(self, hosts): + flavor = self._config.get_flavor() + vault_pass_file = self._config.get_vault_password_file() + root_pass_file = self._config.get_root_password_file() + + ansible_hosts = ",".join(self._inventory.expand_pattern(hosts)) + + extra_vars = "flavor={} root_password_file={}".format( + flavor, + root_pass_file, + ) + + cmd = [ "ansible-playbook" ] + + # Provide the vault password if available + if vault_pass_file is not None: + cmd += [ "--vault-password-file", vault_pass_file ] + + cmd += [ + "--limit", ansible_hosts, + "--extra-vars", extra_vars, + "./site.yml", + ] + + try: + subprocess.check_call(cmd) + except: + raise Error("Failed to update '{}'".format(hosts)) + def run(self): cmdline = self._parser.parse_args() action = cmdline.a -- 2.17.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/README.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guests/README.markdown b/guests/README.markdown index bc780f3..4a40619 100644 --- a/guests/README.markdown +++ b/guests/README.markdown @@ -6,16 +6,16 @@ of the guests used by the Jenkins-based libvirt CI environment. There are two steps to bringing up a guest: -* `./lcitool install $guest` will perform an unattended installation +* `./lcitool -a install -h $guest` will perform an unattended installation of `$guest`. Not all guests can be installed this way: see the "FreeBSD" section below; -* `./lcitool prepare $guest` will go through all the post-installation +* `./lcitool -a update -h $guest` will go through all the post-installation configuration steps required to make the newly-created guest usable; Once those steps have been performed, maintainance will involve running: -* `./lcitool update $guest` +* `./lcitool -a update -h $guest` periodically to ensure the guest configuration is sane and all installed packages are updated. @@ -40,7 +40,7 @@ you'll want to use the `libvirt_guest` variant of the plugin. To keep guests up to date over time, it's recommended to have an entry along the lines of - 0 0 * * * cd ~/libvirt-jenkins-ci/guests && ./lcitool update all + 0 0 * * * cd ~/libvirt-jenkins-ci/guests && ./lcitool -a update -h all in your crontab. -- 2.17.1
participants (1)
-
Andrea Bolognani