Giter Site home page Giter Site logo

Comments (6)

mdfranz avatar mdfranz commented on August 24, 2024

I got that error until I quoted the command and specified the absolute path

knife vsphere vm execute database-test "/sbin/reboot" --exec-passwd "password" --exec-user "root" --exec-dir "/root" -VV

In general I've had to do WAY much more quoting than the examples showed.

from knife-vsphere.

vishalkatikineni avatar vishalkatikineni commented on August 24, 2024

It still doesn't work for me even with double quotes.

knife vsphere vm execute dbaici2.tnt17-zone1.aus1 -f tenant17/DBA "/sbin/reboot" --exec-passwd "changeme" --exec-user "root" --exec-dir "/root" -VV

/usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rbvmomi-1.5.1/lib/rbvmomi/connection.rb:61:in parse_response': NoPermission: Permission to perform this operation was denied. (RbVmomi::Fault) from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rbvmomi-1.5.1/lib/rbvmomi/connection.rb:90:incall'
from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rbvmomi-1.5.1/lib/rbvmomi/basic_types.rb:203:in _call' from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rbvmomi-1.5.1/lib/rbvmomi/basic_types.rb:74:inblock (2 levels) in init'
from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/knife-vsphere-0.5.0/lib/chef/knife/vsphere_vm_execute.rb:65:in run' from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife.rb:460:inrun_with_pretty_exceptions'
from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/knife.rb:173:in run' from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-11.4.4/lib/chef/application/knife.rb:123:inrun'
from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/chef-11.4.4/bin/knife:25:in <top (required)>' from /usr/local/rbenv/versions/1.9.2-p290/bin/knife:23:inload'
from /usr/local/rbenv/versions/1.9.2-p290/bin/knife:23:in `

'

from knife-vsphere.

mwrock avatar mwrock commented on August 24, 2024

I'm also unable to use Execute against an Ubuntu VM:

matt@precise64:/T3NDevOps/chef-repo$ knife vsphere vm execute QA1T3NLABTC "/bin/cat /etc/hosts" -f T3NDEVOPSLAB --exec-user root --exec-passwd XXXXXXXXX -VV
DEBUG: value for config item vsphere_host: XXXXXXXXXX
DEBUG: value for config item vshere_path:
DEBUG: value for config item vsphere_port: 443
DEBUG: value for config item vsphere_nossl:
DEBUG: value for config item vsphere_user: vmapi
DEBUG: value for config item vsphere_pass: XXXXXXXXX
DEBUG: value for config item vsphere_insecure: true
DEBUG: value for config item proxy_host:
DEBUG: value for config item proxy_port:
DEBUG: value for config item vsphere_dc: QA1
DEBUG: value for config item folder: T3NDEVOPSLAB
DEBUG: value for config item vsphere_dc: QA1
DEBUG: value for config item exec_dir:
/home/matt/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.5.1/lib/rbvmomi/connection.rb:61:in `parse_response': FileNotFound: File <unspecified filename> was not found (RbVmomi::Fault)
        from /home/matt/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.5.1/lib/rbvmomi/connection.rb:90:in `call'
        from /home/matt/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.5.1/lib/rbvmomi/basic_types.rb:203:in `_call'
        from /home/matt/.chefdk/gem/ruby/2.1.0/gems/rbvmomi-1.5.1/lib/rbvmomi/basic_types.rb:74:in `block (2 levels) in init'
        from /home/matt/.chefdk/gem/ruby/2.1.0/gems/knife-vsphere-1.0.0.pre/lib/chef/knife/vsphere_vm_execute.rb:63:in `run'
        from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:492:in `run_with_pretty_exceptions'
        from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:174:in `run'
        from /opt/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:135:in `run'
        from /opt/chefdk/embedded/apps/chef/bin/knife:25:in `<top (required)>'
        from /usr/bin/knife:30:in `load'
        from /usr/bin/knife:30:in `<main>'

from knife-vsphere.

swalberg avatar swalberg commented on August 24, 2024

Hi, is this still happening? Happy to help debug if so.

from knife-vsphere.

swalberg avatar swalberg commented on August 24, 2024

I was able to reproduce this locally. The argument parsing is a bit hairy.

If you have a command with an option, such as "/bin/cat /etc/hosts", then do not quote it. You want to run

knife vsphere vm execute VMNAME /bin/cat /etc/hosts --blah

What's happening is that the command is getting broken up into arguments and the command itself. If you quote it, it's trying to run the whole thing:

GuestProgramSpec(
  arguments: "",
  programPath: "/bin/ls /home",
  workingDirectory: "/root"
)

if you separate it out, it works better:

GuestProgramSpec(
  arguments: "/home",
  programPath: "/bin/ls",
  workingDirectory: "/root"
)

from knife-vsphere.

swalberg avatar swalberg commented on August 24, 2024

Hi, I'm closing this issue. If the problem persists, please reopen it and we can resume the conversation.

from knife-vsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.