Comments (6)
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.
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: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: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:in
block (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:in
run_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:in
run'
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:in
load'
from /usr/local/rbenv/versions/1.9.2-p290/bin/knife:23:in `
from knife-vsphere.
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.
Hi, is this still happening? Happy to help debug if so.
from knife-vsphere.
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.
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)
- Restoring Files of the VM in vCenter Level HOT 2
- Restoring files from the VM in vCenter level HOT 1
- Remove deprecated template_file and distro options HOT 3
- Setting a winrm_user in knife.rb breaks linux bootstrapping in certain cases
- Hostname is not assigned to the VM HOT 3
- upgrade ESX with chef HOT 2
- VM Migrate HOT 5
- knife vsphere vm execute fails with no program args HOT 1
- vm state --state suspended may not be suspending HOT 7
- Not able to run knife vsphere command HOT 16
- IP and hostname not assigned if using open-vm-tools HOT 4
- Dependabot can't parse your Gemfile
- knife vsphere vm vmdk add error HOT 1
- vm list recursive - bug! HOT 6
- knife-vsphere with SSL (knife ssl) help! HOT 1
- enhancing doc around resource pool settings w.r.t standalone managed esxi hosts HOT 2
- clone gives Exception: NameError: undefined local variable or method `connection' HOT 12
- Does "knife vsphere vm execute VMNAME COMMAND ARGS" work for Windows Guest?
- How to find the slowness on knife vsphere vm vmdk add? HOT 1
- Content Libraries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knife-vsphere.