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

Andrea Bolognani posted 1 patch 5 years, 11 months ago
Failed in applying to current master (apply log)
guests/tasks/base.yml | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
[libvirt] [jenkins-ci PATCH] guests: Fix os_version for development branches
Posted by Andrea Bolognani 5 years, 11 months ago
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@redhat.com>
---
 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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH] guests: Fix os_version for development branches
Posted by Andrea Bolognani 5 years, 11 months ago
On Wed, 2018-05-09 at 15:50 +0200, Andrea Bolognani wrote:
> 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@redhat.com>
> ---
>  guests/tasks/base.yml | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)

Ping :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH] guests: Fix os_version for development branches
Posted by Andrea Bolognani 5 years, 10 months ago
On Tue, 2018-05-22 at 14:15 +0200, Andrea Bolognani wrote:
> On Wed, 2018-05-09 at 15:50 +0200, Andrea Bolognani wrote:
> > 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@redhat.com>
> > ---
> >  guests/tasks/base.yml | 20 ++++++++++++++------
> >  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> Ping :)

ping²

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH] guests: Fix os_version for development branches
Posted by Daniel P. Berrangé 5 years, 10 months ago
On Wed, May 09, 2018 at 03:50:28PM +0200, Andrea Bolognani wrote:
> 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@redhat.com>
> ---
>  guests/tasks/base.yml | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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