VMware {code} Community
stumpr
Virtuoso
Virtuoso
Jump to solution

Perl vSphere SDK on OS X

I may be an audience of one in this regard, but I recently decided to upgrade and try the vSphere Perl SDK on Mac OSX. Typically I just copy the VMware modules from the Linux install into my /System/Library/Perl/5.8.8/ path and CPAN any dependencies.

However, the new VICredStore.pm module is giving me problems. The fix is pretty simple (the error is also likely an oversight). When doing the get_os() subroutine call in the get_default_path() subroutine, OSX is actually being detected as WINDOWS. Smiley Wink

Turns out in the get_os() subroutine the case insensitive regex /Win/i is matching 'darwin' which is the string returned by $^O. Smiley Sad

# ------------------------------------------------------------------------------
# Description: Query the OS name.
# Input:  Subroutine style:  VICredStore::get_os
# Output: String containing name of OS.
# ------------------------------------------------------------------------------
sub get_os
{
   my $os = $^O;
   if    ($os =~ /Win/i)     { $os = 'WINDOWS'; }
   elsif ($os =~ /vms/i)     { $os = 'VMS'; }
   elsif ($os =~ /^MacOS$/i) { $os = 'MACINTOSH'; }
   elsif ($os =~ /os2/i)     { $os = 'OS2'; }
   else                      { $os = 'UNIX'; }
   return ($os);
}

I patched it manually to get around the issue, I included the patch file if it might benefit anyone.

cp VICredStore.pm VICresStore.pm-distrib
patch VICredStore.pm < VICredStore-OSXFix.patch

Obviously not supported by VMware. However this does seem to proceed past the new credential store feature successfully.

Now I'm looking into Error: Server version unavailable at 'https://<esx host>/sdk/vimService.wsdl' complaints when running my scripts.

I thought this might be of assistance to someone.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
1 Solution

Accepted Solutions
jnhall
Enthusiast
Enthusiast
Jump to solution

Hmm, good catch. I'll file a bug for this. Among other things the One True Way to detect Windows is to see if $^O matches exactly the string 'MSWin32'. (Period.)

View solution in original post

Reply
0 Kudos
2 Replies
stumpr
Virtuoso
Virtuoso
Jump to solution

The Error: Server version unavailable at 'https://<esx host>/sdk/vimService.wsdl' error seems related to SSL. After changing the proxy to httpAndHttps I was able to use an http string to connect.

Anyone else spend any time on this issue?

==Update==

I just updated my Crypt::SSLeay, must have been a bug in my version. Looks like everything is working as expected (after the darwin detection fix posted above).

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

Hmm, good catch. I'll file a bug for this. Among other things the One True Way to detect Windows is to see if $^O matches exactly the string 'MSWin32'. (Period.)

Reply
0 Kudos