Chef infra 厨师配方组不工作

Chef infra 厨师配方组不工作,chef-infra,chef-recipe,Chef Infra,Chef Recipe,当我尝试运行我的厨师食谱时,我得到了以下错误,我不知道我做错了什么。我才刚刚真正开始 ================================================================================ Recipe Compile Error in /var/chef/cache/cookbooks/app/recipes/default.rb =====================================================

当我尝试运行我的厨师食谱时,我得到了以下错误,我不知道我做错了什么。我才刚刚真正开始

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/app/recipes/default.rb
================================================================================

Chef::Exceptions::ValidationFailed
----------------------------------
Option group's value #<Chef::Node::Attribute:0x7f5282d15700> does not match regular expression [/^([-a-zA-Z0-9_.\\ ]+)$/, /^\d+$/]

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/app/recipes/default.rb:25:in `from_file'
  /var/chef/cache/cookbooks/app/recipes/default.rb:23:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/app/recipes/default.rb:

  1:  #
  2:  # Cookbook Name:: app
  3:  # Recipe:: default
  4:  #
  5:
  6:  group node[:app][:group][:name] do
  7:      gid node[:app][:group][:gid]
  8:      append true
  9:  end

[2014-02-03T09:42:24+00:00] ERROR: Running exception handlers
[2014-02-03T09:42:24+00:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[2014-02-03T09:42:24+00:00] ERROR: Exception handlers complete
[2014-02-03T09:42:24+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-02-03T09:42:24+00:00] FATAL: Chef::Exceptions::ValidationFailed: Option group's value #<Chef::Node::Attribute:0x7f5282d15700> does not match regular expression [/^([-a-zA-Z0-9_.\\ ]+)$/, /^\d+$/]
我已将其更改为代码中的值,但仍然会得到相同的错误:

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/app/recipes/default.rb
================================================================================

Chef::Exceptions::ValidationFailed
----------------------------------
Option group's value #<Chef::Node::Attribute:0x7fa2b7ef2ef8> does not match regular expression [/^([-a-zA-Z0-9_.\\ ]+)$/, /^\d+$/]

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/app/recipes/default.rb:25:in `from_file'
  /var/chef/cache/cookbooks/app/recipes/default.rb:23:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/app/recipes/default.rb:

  1:  #
  2:  # Cookbook Name:: app
  3:  # Recipe:: default
  4:  #
  5:
  6:  group "nginx" do
  7:      gid 123456
  8:      append true
  9:  end

[2014-02-03T09:53:35+00:00] ERROR: Running exception handlers
[2014-02-03T09:53:35+00:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[2014-02-03T09:53:35+00:00] ERROR: Exception handlers complete
[2014-02-03T09:53:35+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-02-03T09:53:35+00:00] FATAL: Chef::Exceptions::ValidationFailed: Option group's value #<Chef::Node::Attribute:0x7fa2b7ef2ef8> does not match regular expression [/^([-a-zA-Z0-9_.\\ ]+)$/, /^\d+$/]
================================================================================
/var/chef/cache/cookbooks/app/recipes/default.rb中的配方编译错误
================================================================================
Chef::异常::验证失败
----------------------------------
选项组的值#与正则表达式[/^([-a-zA-Z0-9.\\]+)$/,/^\d+$/]不匹配
食谱跟踪:
---------------
/var/chef/cache/cookbooks/app/recipes/default.rb:25:in“from_file”
/var/chef/cache/cookbooks/app/recipes/default.rb:23:in'from_file'
相关文件内容:
----------------------
/var/chef/cache/cookbooks/app/recipes/default.rb:
1:  #
2:#食谱名称::应用程序
3:#配方::默认值
4:  #
5:
6:组“nginx”do
7:gid 123456
8:追加true
9:完
[2014-02-03T09:53:35+00:00]错误:正在运行异常处理程序
[2014-02-03T09:53:35+00:00]致命:将节点信息保存到/var/chef/cache/failed-run-data.json
[2014-02-03T09:53:35+00:00]错误:异常处理程序已完成
[2014-02-03T09:53:35+00:00]致命:Stacktrace转储到/var/chef/cache/chef-Stacktrace.out
[2014-02-03T09:53:35+00:00]致命:Chef::Exceptions::ValidationFailed:选项组的值#与正则表达式[/^([-a-zA-Z0-9.\\]+)$/,/^\d+$/]不匹配

将我的代码更改为以下代码有效:

default[:app][:group]                    = "nginx"


由于某些原因,它不喜欢节点[:app][:group][:name]

有时,当您在/etc/hosts中没有主机名时,会出现相同的错误

即使该计算机可能不属于某个域,也应在环回地址
127.0.0.1
旁边添加主机名

希望有帮助

default[:app][:group]                    = "nginx"
group node[:app][:group] do
    append true
end