当我尝试运行我的厨师食谱时,我收到以下错误,我不知道自己做错了什么。我只是真的开始使用它。
================================================================================
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+$/]
这些是attributes/default.rb
:
default[:app][:group][:name] = "nginx"
default[:app][:group][:gid] = 123456
我已更改它,因此值在代码中仍然会出现相同的错误:
================================================================================
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+$/]
答案 0 :(得分:2)
将我的代码更改为以下版本:
default[:app][:group] = "nginx"
和
group node[:app][:group] do
append true
end
出于某种原因,它不喜欢node[:app][:group][:name]
答案 1 :(得分:1)
有时,如果在/ etc / hosts中没有主机名,则会收到相同的错误。
即使该机器可能不属于某个域,您仍应在环回地址127.0.0.1
旁边添加主机名。
希望它有所帮助!