Strange behavior - Knife vsphere


I have been trying to automate the process of “mass” cloning VMs.

I wrote a wrapper script that pulls all the necessary variables from an ‘inputs’ file and feeds them to the ‘knife vsphere vm clone’ command.

I am receiving the following error:
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rbvmomi-1.5.1/lib/rbvmomi/trivial_soap.rb:63: in soap_envelope : uninitialized constant rbvmomi::TrivialSoap::Builder (NameError) from …"
And goes on to list the following ruby:
connection.rb::82::in 'call’
basic_types.rb::203::in '_call’
basic_types.rb::74::in 'block (2 levels) in init’
vim.rb::64::in 'serviceContent’
vim.rb::35::in 'block in connect’
vim.rb::34::in 'tap’
vim.rb::34::in 'connect’
And finally,
base_vsphere_command.rb:112:in ‘get_vim_connection’

I ‘echo’ the actual command so I can see if all the variables assigned their values accurately and they do.
I copy/paste the echoed information and it runs just fine from line command. But, continues to fail when executed from the script with above message.
I struggled finding any info and did not find any ‘constants’ that had not been initialized within the script.

Logic indicates when something runs in script and not on line command or vice versa, the explanation is the environment.
So, I captured the environment settings ‘right before’ the line in the script is executed and the environment when at my shell prompt.
Not much to go on…
-The only variable in ‘my’ env that does not exist in the ‘script’ env is ‘OLDPWD’

  • In the ‘script’ env, there are several, mostly the variables used to run the script plus
    all of which include the various paths for gems and ruby code.
    I wish I could ‘copy/paste’ the values but I work where I do not have Internet access so I have to type this all in manually which can result in false/positive troubleshooting ideas.

‘maybe’ I have the various paths in the 'wrong’
and ‘maybe’ if I remove the variables defining Ruby and Gem paths, it will work.
Logically, if the command executed without them declared in my shell, it should work without them declared within the script.
But that is my last idea to go on. Anyone else have any suggestions??

Thanks in advance

Sent from my iPhone