[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] Check for, and uninstall, VMware Tools installed from tarball



On Tue, Feb 01, 2011 at 04:19:03PM +0000, Matthew Booth wrote:
> VMware Tools can be installed by RPM or from a tarball. We were only
> looking for the RPM. If it was installed by tarball, we would end up
> leaving it in place. If VMware Tools detects that it is not running
> on a VMware platform when it starts, it will clumsily try to
> uninstall itself, leading to misconfiguration.  This patch looks for
> tarball-installed VMware Tools and uninstalls it.
>
> Fixes RHBZ#623571
> ---
>  lib/Sys/VirtV2V/Converter/RedHat.pm |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/Sys/VirtV2V/Converter/RedHat.pm b/lib/Sys/VirtV2V/Converter/RedHat.pm
> index 762ee0e..114d876 100644
> --- a/lib/Sys/VirtV2V/Converter/RedHat.pm
> +++ b/lib/Sys/VirtV2V/Converter/RedHat.pm
> @@ -756,6 +756,24 @@ sub _unconfigure_vmware
>              _remove_application($name, $g);
>          }
>      }
> +
> +    # VMwareTools may have been installed from tarball, in which case the above
> +    # won't detect it. Look for the uninstall tool, and run it if it's present.
> +    #
> +    # Note that it's important we do this early in the conversion process, as
> +    # this uninstallation script naively overwrites configuration files with
> +    # versions it cached from prior to installation.
> +    my $vmwaretools = '/usr/bin/vmware-uninstall-tools.pl';
> +    if ($g->exists($vmwaretools)) {

I might use '$g->is_file' here, although that would fail if it was a
symlink.

> +        eval { $g->command([$vmwaretools]) };
> +        warn user_message(__x('VMware Tools was detected, but uninstallation '.
> +                              'failed. The error message was: {error}',
> +                              error => $@)) if $@;
> +
> +        # Reload augeas to detect changed made by vmware tools uninstallation

s/changed/changes/

> +        eval { $g->aug_load() };
> +        augeas_error($g, $@) if $@;
> +    }
>  }

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]