[libvirt] [jenkins-ci PATCH] guests: Clean up packages after update

The package cache can grow to eat up a lot of disk space, and not removing unused packages can lead to upgrade issues down the line for fast moving distributions such as Fedora Rawhide. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/tasks/base.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml index 53cbd65..f419433 100644 --- a/guests/tasks/base.yml +++ b/guests/tasks/base.yml @@ -117,6 +117,25 @@ when: - package_format == 'pkg' +- name: Clean up packages after update + command: yum clean packages -y + args: + warn: no + when: + - package_format == 'rpm' + +- name: Clean up packages after update + apt: + autoclean: yes + autoremove: yes + when: + - package_format == 'deb' + +- name: Clean up packages after update + shell: pkg clean -y && pkg autoremove -y + when: + - package_format == 'pkg' + - name: Configure hostname hostname: name: '{{ inventory_hostname }}' -- 2.14.3

On Mon, Apr 09, 2018 at 03:56:05PM +0200, Andrea Bolognani wrote:
The package cache can grow to eat up a lot of disk space, and not removing unused packages can lead to upgrade issues down the line for fast moving distributions such as Fedora Rawhide.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/tasks/base.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml index 53cbd65..f419433 100644 --- a/guests/tasks/base.yml +++ b/guests/tasks/base.yml @@ -117,6 +117,25 @@ when: - package_format == 'pkg'
+- name: Clean up packages after update + command: yum clean packages -y + args: + warn: no + when: + - package_format == 'rpm'
Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't have that command. Otherwise looks good. Pavel
+ +- name: Clean up packages after update + apt: + autoclean: yes + autoremove: yes + when: + - package_format == 'deb' + +- name: Clean up packages after update + shell: pkg clean -y && pkg autoremove -y + when: + - package_format == 'pkg' + - name: Configure hostname hostname: name: '{{ inventory_hostname }}' -- 2.14.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Thu, 2018-04-12 at 10:29 +0200, Pavel Hrdina wrote:
On Mon, Apr 09, 2018 at 03:56:05PM +0200, Andrea Bolognani wrote:
+- name: Clean up packages after update + command: yum clean packages -y + args: + warn: no + when: + - package_format == 'rpm'
Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't have that command.
Good point, I must not have found out about it because I was looking at CentOS 6 :) I'll post v2 in a bit. -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Apr 12, 2018 at 11:54:16AM +0200, Andrea Bolognani wrote:
On Thu, 2018-04-12 at 10:29 +0200, Pavel Hrdina wrote:
On Mon, Apr 09, 2018 at 03:56:05PM +0200, Andrea Bolognani wrote:
+- name: Clean up packages after update + command: yum clean packages -y + args: + warn: no + when: + - package_format == 'rpm'
Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't have that command.
Good point, I must not have found out about it because I was looking at CentOS 6 :) I'll post v2 in a bit.
"yum autoremove" is a command for reliably screwing up your system and should never be run without manual inspection of what it is going todo. 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 :|

On Thu, 2018-04-12 at 11:00 +0100, Daniel P. Berrangé wrote:
On Thu, Apr 12, 2018 at 11:54:16AM +0200, Andrea Bolognani wrote:
On Thu, 2018-04-12 at 10:29 +0200, Pavel Hrdina wrote:
Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't have that command.
Good point, I must not have found out about it because I was looking at CentOS 6 :) I'll post v2 in a bit.
"yum autoremove" is a command for reliably screwing up your system and should never be run without manual inspection of what it is going todo.
Is that so? The apt equivalent is usually pretty solid, and as I mention in the commit message getting rid of obsolete packages can really help when upgrading fast-moving targets. I'm also not *that* worried about potentially breaking builders to be honest, since with our current level of automation the worst case scenario is spending around an hour rebuilding them from scratch :) -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrangé
-
Pavel Hrdina