rubiojr / knife-esx

@maintux's FORK IS NOW OFFICIAL: https://github.com/maintux/knife-esx
https://github.com/maintux/knife-esx
Apache License 2.0
35 stars 10 forks source link

NoMethodError when running vm list #2

Open bradmontgomery opened 12 years ago

bradmontgomery commented 12 years ago

Hi,

I'm getting a NoMethodError when running knife esx vm list. I've got the appropriate settings in my knife.rb file (I can log into my vsphere client with these). Any idea why I'm getting the error below? Am I doing something wrong?

Thanks in advance!

My knife.rb contains:

knife[:esx_host] = "10.1.2.3"
knife[:esx_username] = "myusername"
knife[:esx_password] = "mypassword"

And now for the output:

$ knife esx vm list --esx-host 10.1.2.3 --esx-username myusername --esx-password mypassword
Connecting to ESX host 10.1.2.3... 
ERROR: knife encountered an unexpected error
This may be a bug in the 'esx vm list' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
Exception: NoMethodError: undefined method `summary' for Folder("group-v85"):RbVmomi::VIM::Folder

Verbose output:

$ knife esx vm list -VV --esx-host 10.1.2.3 --esx-username myusername --esx-password mypassword
DEBUG: Using configuration from /Users/brad/coroutine/chef-coroutine/.chef/knife.rb
Connecting to ESX host 10.1.2.3... 
/Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/esx-0.3.2/lib/esx.rb:320:in `wrap': undefined method `summary' for Folder("group-v85"):RbVmomi::VIM::Folder (NoMethodError)
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/esx-0.3.2/lib/esx.rb:210:in `block in virtual_machines'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/esx-0.3.2/lib/esx.rb:209:in `each'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/esx-0.3.2/lib/esx.rb:209:in `virtual_machines'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/knife-esx-0.1.4/lib/chef/knife/esx_vm_list.rb:33:in `block in run'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/terminal-table-1.4.4/lib/terminal-table/table.rb:211:in `yield_or_eval'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/terminal-table-1.4.4/lib/terminal-table/table.rb:17:in `initialize'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/terminal-table-1.4.4/lib/terminal-table/table_helper.rb:5:in `new'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/terminal-table-1.4.4/lib/terminal-table/table_helper.rb:5:in `table'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/knife-esx-0.1.4/lib/chef/knife/esx_vm_list.rb:31:in `run'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/chef-0.10.8/lib/chef/knife.rb:391:in `run_with_pretty_exceptions'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/chef-0.10.8/lib/chef/knife.rb:166:in `run'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/chef-0.10.8/lib/chef/application/knife.rb:128:in `run'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/gems/chef-0.10.8/bin/knife:25:in `<top (required)>'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/bin/knife:19:in `load'
    from /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/bin/knife:19:in `<main>'
rubiojr commented 12 years ago

Thanks @bradmontgomery

I wonder if it's related to the privileges of your user. Are you using root? If not, can you try with root?

If you could send me the following info so I can try to reproduce the issue I would greatly appreciate it:

  1. ESX version
  2. ESX license type you have
  3. Output from the 'gem env' command
  4. Output from 'gem list' command
  5. Is it a standalone ESX or connected to vCenter?

Thanks!

bradmontgomery commented 12 years ago

Are you using root? If not, can you try with root? Do you mean locally, or with a root account on the vSphere server? I've been assured that my account has "God" privileges... it is the only account I have available, though.

ESX version - 4.1.0

ESX license type you have - Standard License

Output from the 'gem env' command

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.10
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-darwin11.2.0]
  - INSTALLATION DIRECTORY: /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef
  - RUBY EXECUTABLE: /Users/brad/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-11
  - GEM PATHS:
     - /Users/brad/.rvm/gems/ruby-1.9.3-p0@chef
     - /Users/brad/.rvm/gems/ruby-1.9.3-p0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :sources => ["http://rubygems.org/", "http://gems.github.com/"]
  - REMOTE SOURCES:
     - http://rubygems.org/
     - http://gems.github.com/

Output from 'gem list' command

$ gem list

*** LOCAL GEMS ***

alchemist (0.1.2.1)
builder (3.0.0)
bundler (1.0.21)
bunny (0.7.8)
capistrano (2.9.0)
chef (0.10.8)
clamp (0.3.0)
erubis (2.7.0)
esx (0.3.2)
excon (0.9.4, 0.7.12, 0.6.6)
fog (1.0.0)
formatador (0.2.1)
highline (1.6.9)
json (1.6.1)
knife-esx (0.1.4)
knife-linode (0.1.0)
librarian (0.0.12)
looksee (1.0.3)
mime-types (1.17.2)
mixlib-authentication (1.1.4)
mixlib-cli (1.2.2)
mixlib-config (1.1.2)
mixlib-log (1.3.0)
moneta (0.6.0)
multi_json (1.0.4)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.1.4)
net-ssh-gateway (1.1.0)
net-ssh-multi (1.1)
nokogiri (1.5.0)
ohai (0.6.10)
ori (0.1.0)
polyglot (0.3.3)
rbvmomi (1.5.0)
rest-client (1.6.7)
ruby-hmac (0.4.0)
systemu (2.2.0)
terminal-table (1.4.4)
thor (0.14.6)
treetop (1.4.10)
trollop (1.16.2)
uuidtools (2.1.2)
wirble (0.1.3)
yajl-ruby (1.1.0)

Is it a standalone ESX or connected to vCenter? - VMware vCenter server 4.1.0

I appreciate your help!

bradmontgomery commented 12 years ago

Update: I got a chance to use someone else's credentials, and knife esx vm list worked just fine, so you were right. It was a problem with user privileges. Thanks again!

rubiojr commented 12 years ago

Great news @bradmontgomery, thanks for the feedbak. I guess esx gem should handle that error better so I'm reopening the bug as a reminder.

bradmontgomery commented 12 years ago

Cool! Let me know if I can do anything to help or do any testing.