首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >chef-recipe ArgumentError未知指令:"\n“

chef-recipe ArgumentError未知指令:"\n“
EN

Stack Overflow用户
提问于 2015-08-24 20:13:33
回答 1查看 99关注 0票数 2

我正在使用chef-server 11并使用chef-provisioning gem来自动化云基础架构。我有一个从AMI创建实例的简单方法,但它失败了,并显示ArgumentError未知指令:"\n“error

我的厨师食谱是

代码语言:javascript
运行
复制
require 'chef/provisioning/aws_driver'
with_driver 'aws::us-east-1'
machine 'new-chef-instance' 
do 
   machine_options :ssh_username => 'root',
       :bootstrap_options => 
        {
         :key_name => 'mykeyname',
         :image_id => 'myamiid',
         :instance_type => 't2.micro',
         :subnet_id => 'mysubnetid',
         :security_group_ids => 'my-security-group' 
        }
end

在像这样执行这个食谱之后

代码语言:javascript
运行
复制
chef-client -z recipes/createserver.rb

在创建实例后,我得到以下错误

代码语言:javascript
运行
复制
[2015-08-24T11:42:17+00:00] INFO: Processing chef_node[new-chef-provision] action create (basic_chef_client::block line 57)

================================================================================
Error executing action `converge` on resource 'machine[new-chef-instance]'
================================================================================

ArgumentError
-------------
unknown directive: "\n"

Resource Declaration:
---------------------
# In /mypath/recipes/createserver.rb'
[2015-08-24T11:42:27+00:00] INFO: Running queued delayed notifications  before re-raising exception

Running handlers:
[2015-08-24T11:42:27+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-08-24T11:42:27+00:00] ERROR: Exception handlers complete
[2015-08-24T11:42:27+00:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 268.92955968 seconds
[2015-08-24T11:42:27+00:00] ERROR: machine[new-chef-provision]       (@recipe_files::/mypath/recipes/createserver.rb line 3) had an error: ArgumentError: unknown directive: "\n"
[2015-08-24T11:42:28+00:00] FATAL:    Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

虽然实例创建正确,并且我可以从命令行SSH它,但是完整的配方执行失败,我如何修复错误并且我的配方中没有额外的字符“\n

EN

回答 1

Stack Overflow用户

发布于 2015-08-27 06:28:31

在创建machine资源和启动其块的do之间有一个额外的换行符。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32182049

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档