Matthew Booth
2010-Feb-16 15:03 UTC
[Libguestfs] [PATCH] GuestOS: Reload augeas after rpm installation and removal
--- lib/Sys/VirtV2V/GuestOS/RedHat.pm | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm index cd2f8e6..380dacb 100644 --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm @@ -862,6 +862,9 @@ sub remove_application $g->command(['rpm', '-e', $name]); }; die($@) if($@); + + # Make augeas reload in case the removal changed anything + $g->aug_load(); } =item get_application_owner(file) @@ -902,6 +905,9 @@ sub _install_rpms # Propagate command failure die($@) if($@); + + # Reload augeas in case the rpm installation changed anything + $g->aug_load(); } # Get full, local path of a file on the transfer mount -- 1.6.6
Richard W.M. Jones
2010-Feb-19 09:51 UTC
[Libguestfs] [PATCH] GuestOS: Reload augeas after rpm installation and removal
On Tue, Feb 16, 2010 at 03:03:46PM +0000, Matthew Booth wrote:> --- > lib/Sys/VirtV2V/GuestOS/RedHat.pm | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm > index cd2f8e6..380dacb 100644 > --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm > +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm > @@ -862,6 +862,9 @@ sub remove_application > $g->command(['rpm', '-e', $name]); > }; > die($@) if($@); > + > + # Make augeas reload in case the removal changed anything > + $g->aug_load(); > } > > =item get_application_owner(file) > @@ -902,6 +905,9 @@ sub _install_rpms > > # Propagate command failure > die($@) if($@); > + > + # Reload augeas in case the rpm installation changed anything > + $g->aug_load(); > } > > # Get full, local path of a file on the transfer mount > -- > 1.6.6I've been staring at the Augeas documentation[1] and I'm not sure if this does what you think it does. Actually, I'm not sure _what_ it does when it is called a second time. I think it would be better to call $g->aug_init(path, flags) here instead. This should close the old handle and reopen it (see [2]). (CC'd to Lutter for advice). Rich. [1] http://augeas.net/docs/references/c_api/files/augeas-h.html#aug_load [2] http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/augeas.c;h=de325ded603e688f6ae84df109755f43b672157b;hb=HEAD#l63 -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
Possibly Parallel Threads
- [PATCH] GuestOS: Fix error when checking for rpm which isn't installed
- [PATCH] GuestOS: Delete blkid.tab if it's present
- [PATCH] GuestOS: Update XF86Config or xorg.conf as appropriate
- [PATCH 1/3] Build: Make changelog action call git directly without Git module
- [PATCH 1/6] Convert config file to XML, and translate networks/bridge for all connections