[Libguestfs] [PATCH] GuestOS: Reload augeas after rpm installation and removal
Richard W.M. Jones
rjones at redhat.com
Fri Feb 19 09:51:26 UTC 2010
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.6
I'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
More information about the Libguestfs
mailing list