我遵循此tutorial并从我的桌面运行到使用opsworks部署的EC2实例:
chef-run root@ec2instance-foobar /opt/aws/opsworks/current/merged-cookbooks/opsworks_custom_cookbooks/recipes/default.rb
但是出现语法错误:
Please provide a recipe in the form 'path/to/recipe/file.rb',
'path/to/cookbook', 'cookbook_name' or 'cookbook_name::recipe_name'.
You provided '/opt/aws/opsworks/current/merged-cookbooks/opsworks_custom_cookbooks/recipes/default.rb'.
chef-run <TARGET[S]> <RESOURCE> <RESOURCE_NAME> [PROPERTIES] [FLAGS]
chef-run <TARGET[S]> <RECIPE> [FLAGS]
我也尝试过这一点,没有更多玩chef-run
的运气了:
$ chef-run user@instance-ec2 opsworks_custom_cookbooks::default
[✔] Packaging cookbook... done!
[✖] Could not create local Policyfile bundle.
CHEFPOLICY001
Could not create local Policyfile bundle.
The following error was reported:
Failed to generate Policyfile.lock
If you are not able to resolve this issue, please contact Chef support
at beta@chef.io and include the log file and stack trace from the
locations below:
/home/me/.chef-workstation/logs/default.log
/home/me/.chef-workstation/logs/stack-trace.log
我想念什么?
错误日志:
$ cat .chef-workstation/logs/stack-trace.log
--------------------------------------------------------------------------------
2018-10-02 18:05:13 +0200: Error encountered while running the following:
root@instance-ec2
Backtrace:
ChefApply::CLI::OptionValidationError: ChefApply::CLI::OptionValidationError
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/cli/validation.rb:31:in `validate_params'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/cli.rb:108:in `perform_run'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/cli.rb:71:in `block in run'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/telemeter.rb:85:in `block in timed_capture'
/opt/chef-workstation/embedded/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/telemeter.rb:85:in `timed_capture'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/telemeter.rb:74:in `timed_run_capture'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/cli.rb:69:in `run'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/startup.rb:174:in `start_chef_apply'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/lib/chef_apply/startup.rb:61:in `run'
/opt/chef-workstation/embedded/lib/ruby/gems/2.5.0/gems/chef-apply-0.1.21/bin/chef-run:23:in `<top (required)>'
/usr/bin/chef-run:288:in `load'
/usr/bin/chef-run:288:in `<main>'