我使用Chef Workstation上的ScriptBuilder创建了一个shell脚本,并尝试使用相同的shell脚本运行。基本上我在shell脚本中有一个knife bootstrap命令。
computeService.runScriptOnNode(workstation.getId(), script, options)
我得到一个错误。但是,如果我进入框中并手动执行shell脚本,它就可以工作。我可能会遗漏那些东西。
我的Shell脚本看起来像这样..我正在使用root用户,所以没有sudo
Knife bootstrap 10.10.10.1 -x user -P pwd
我的脚本编译器在最后执行以下操作
sh ~/.chef/initialbootstrap.sh
响应错误#
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-cli-1.5.0/lib/mixlib/cli.rb:191:in `parse_options': invalid option: -x (OptionParser::InvalidOption)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef /application.rb:72:in `configure_chef'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application.rb:59:in `reconfigure'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application.rb:49:in `block in initialize'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `call'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife/cookbook_delete.rb:19:in `<top (required)>'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife/core/subcommand_loader.rb:34:in `load'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife/core/subcommand_loader.rb:34:in `block in load_commands'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife/core/subcommand_loader.rb:34:in `each'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife/core/subcommand_loader.rb:34:in `load_commands'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife.rb:120:in `load_commands'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/knife.rb:168:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/application/knife.rb:135:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/bin/knife:25:in `<top (required)>'
from /usr/bin/knife:23:in `load'
from /usr/bin/knife:23:in `<main>'
不确定发生了什么。我是Chef / jclouds / Ruby的新手。