vmware-scripts icon indicating copy to clipboard operation
vmware-scripts copied to clipboard

guestOpsManagement.pl copyfromguest issue

Open ptroxell opened this issue 10 years ago • 1 comments

When I use "guestOpsManagement.pl --server vcenter --username x --password y --operation copyfromguest --vm name --guestusername z --guestpassword zz --filepath /home/user/test.txt"

I get the following messages: Validating guest credentials in name ... Successfully validated guest credentials! Downloading file "/home/user/test.txt" from guest ... Received download URL: https://IP:443/guestFile?id=97&token=string Downloading file: "test.txt"

Use of unintialized value $contents in print at ./guestOpsManagment.pl line 668.

The resulting test.txt file is empty.

In looking at the code 668 is using the result of the get($url) contained in $contents. When I use a browser to go the the URL that was provided, I do see the contents so the URL appears correct. Not being a PERL guy (gasp), I'm not sure how to resolve this issue.

Thoughts? Pete

ptroxell avatar Nov 10 '15 14:11 ptroxell

Further investigation showed this to be tied to the ESX host having self-signed certificates. Adding the following lines to the downloadFile function before the get($url) line resolved the issue:

use LWP::Simple qw( $ua get ); $ua->ssl_opts( verify_hostname => 0, SSL_verify_mode -> 0x00 );

ptroxell avatar Nov 11 '15 15:11 ptroxell