vSphere

 View Only
  • 1.  Perl vSphere SDK on OS X

    Posted Jun 17, 2009 11:51 PM

    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. :smileywink:

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

    # ------------------------------------------------------------------------------
    # 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.



  • 2.  RE: Perl vSphere SDK on OS X

    Posted Jun 17, 2009 11:57 PM

    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).



  • 3.  RE: Perl vSphere SDK on OS X
    Best Answer

    Posted Jun 24, 2009 09:52 PM

    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.)