[libvirt] [jenkins-ci PATCH 4/3] guests: Remove ad-hoc package installation

Andrea Bolognani abologna at redhat.com
Wed Mar 21 12:19:57 UTC 2018


There is a small number of packages that we install as part of
the 'base' task with an ad-hoc call to the package module.

Since we have generic facilities for installing packages and a
generic 'base' pseudo-project that we use for all packages that
are not related to any specific project, we can fold everything
into it and have a single source of truth.

The change requires us to delay user creation, though, because
as part of that we edit the sudoers file, which doesn't exist
until the sudo package has been installed.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 guests/site.yml               |  7 +++++--
 guests/tasks/base.yml         | 11 -----------
 guests/vars/mappings.yml      | 15 +++++++++++++++
 guests/vars/projects/base.yml |  5 +++++
 4 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/guests/site.yml b/guests/site.yml
index 4207d4e..d057116 100644
--- a/guests/site.yml
+++ b/guests/site.yml
@@ -14,16 +14,19 @@
 
   tasks:
 
-    # Prepare the base environment
+    # Prepare environment. None of the actions performed here might
+    # depend on packages being installed
     - include: tasks/base.yml
     - include: tasks/compat.yml
-    - include: tasks/user.yml
 
     # Install base packages
     - include: tasks/packages.yml
       vars:
         project: base
 
+    # Create users. This needs to happen after installing base packages
+    - include: tasks/user.yml
+
     # Install build dependencies for each project
     - include: tasks/packages.yml
       with_items:
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 8d7ff44..5379bf6 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -115,17 +115,6 @@
   when:
     - package_format == 'pkg'
 
-- name: Install base packages
-  package:
-    name: '{{ item }}'
-    state: present
-  with_items:
-    - bash
-    - git
-    - screen
-    - sudo
-    - vim
-
 - name: Remove unwanted packages
   package:
     name: '{{ item }}'
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index 190013e..f6ac801 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -53,6 +53,9 @@ mappings:
     pkg: avahi
     rpm: avahi-devel
 
+  bash:
+    default: bash
+
   bash-completion:
     default: bash-completion
     CentOS6:
@@ -107,6 +110,9 @@ mappings:
   gettext:
     default: gettext
 
+  git:
+    default: git
+
   glib2:
     deb: libglib2.0-dev
     pkg: glib
@@ -635,6 +641,9 @@ mappings:
     rpm: sanlock-devel
     Ubuntu12:
 
+  screen:
+    default: screen
+
   scrub:
     default: scrub
     FreeBSD: diskscrub
@@ -654,6 +663,9 @@ mappings:
     rpm: spice-gtk3-devel
     CentOS6:
 
+  sudo:
+    default: sudo
+
   unzip:
     default: unzip
     FreeBSD:
@@ -667,6 +679,9 @@ mappings:
     deb: valac
     CentOS6:
 
+  vim:
+    default: vim
+
   wget:
     default: wget
 
diff --git a/guests/vars/projects/base.yml b/guests/vars/projects/base.yml
index d82f6b9..94644e4 100644
--- a/guests/vars/projects/base.yml
+++ b/guests/vars/projects/base.yml
@@ -3,10 +3,12 @@ packages:
   - autoconf
   - automake
   - autopoint
+  - bash
   - ccache
   - cppi
   - gcc
   - gettext
+  - git
   - glibc
   - libtool
   - libtoolize
@@ -15,3 +17,6 @@ packages:
   - perl
   - pkg-config
   - rpmbuild
+  - screen
+  - sudo
+  - vim
-- 
2.14.3




More information about the libvir-list mailing list