[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
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=de325ded... -- 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
On Fri, 2010-02-19 at 09:51 +0000, Richard W.M. Jones wrote:
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]).
It does what the comments indicate it should do - aug_load will throw away everything under /files and /augeas/files and reread all files it was told about from the filesystem. It's essentially a refresh of the tree with any changes that might have happened in the filesystem. You can do more with it, e.g., change what files should be read by changing entries in /augeas/load, but it doesn't seem that you'd want to do this here. David
On Fri, Feb 19, 2010 at 09:38:46AM -0800, David Lutterkort wrote:
On Fri, 2010-02-19 at 09:51 +0000, Richard W.M. Jones wrote:
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]).
It does what the comments indicate it should do - aug_load will throw away everything under /files and /augeas/files and reread all files it was told about from the filesystem.
It's essentially a refresh of the tree with any changes that might have happened in the filesystem. You can do more with it, e.g., change what files should be read by changing entries in /augeas/load, but it doesn't seem that you'd want to do this here.
David, thanks for clarifying. ACK to the patch then. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
participants (3)
-
David Lutterkort -
Matthew Booth -
Richard W.M. Jones