[Libguestfs] [PATCH] GuestOS: Reload augeas after rpm installation and removal

David Lutterkort lutter at redhat.com
Fri Feb 19 17:38:46 UTC 2010


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







More information about the Libguestfs mailing list