[jenkins-ci PATCH] guests: Fix os_version for development branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We currently know about three development branches: Fedora
Rawhide, Debian sid and FreeBSD -CURRENT.

For all three, we use the name of the development branch in
the guest name; however, the value of os_version is not set
consistently, making it awkward to create package mappings
specific to these development branches.

As an added bonus, this makes the code setting os_name and
os_version more straightforward by simplifying conditionals
and removing regexp-based string replacement.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 guests/tasks/base.yml | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 70d5abc..9f27470 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -2,25 +2,33 @@
 - name: Set additional facts (OS)
   set_fact:
     os_name: '{{ ansible_distribution }}'
+
+- name: Set additional facts (OS)
+  set_fact:
     os_version: '{{ ansible_distribution_major_version }}'
   when:
-    - ansible_distribution != 'FreeBSD'
-    - ansible_distribution_release != 'Rawhide'
+    - ansible_distribution_major_version is defined
 
 - name: Set additional facts (OS)
   set_fact:
-    os_name: '{{ ansible_distribution }}'
     os_version: Rawhide
   when:
-    - ansible_distribution != 'FreeBSD'
+    - os_name == 'Fedora'
     - ansible_distribution_release == 'Rawhide'
 
 - name: Set additional facts (OS)
   set_fact:
-    os_name: '{{ ansible_distribution }}'
-    os_version: '{{ ansible_distribution_release|regex_replace("^(\d+)\.\d+-.*$", "\1") }}'
+    os_version: Sid
+  when:
+    - os_name == 'Debian'
+    - '{{ ansible_distribution_major_version|match("^.*/sid$") }}'
+
+- name: Set additional facts (OS)
+  set_fact:
+    os_version: Current
   when:
     - ansible_distribution == 'FreeBSD'
+    - '{{ ansible_distribution_release|match("^.*-CURRENT$") }}'
 
 - name: Set additional facts (package format)
   set_fact:
-- 
2.17.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux