我正在尝试使用chef-client
DSL在审核模式下运行control_group
,如此处所述,http://docs.chef.io/analytics/dsl_recipe.html
以下是我在本地模式下运行chef-client时获得的结果。
[vagrant@centos6 ~]$ sudo chef-client --audit-mode audit-only -z -o audit_centos -c client.rb
[2015-03-01T17:44:10-06:00] INFO: Started chef-zero at http://localhost:8889 with repository at /opt/chef, /root
One version per cookbook
environments at /var/chef/environments
[2015-03-01T17:44:10-06:00] INFO: Forking chef instance to converge...
Starting Chef Client, version 12.0.3
[2015-03-01T17:44:10-06:00] INFO: *** Chef 12.0.3 ***
[2015-03-01T17:44:10-06:00] INFO: Chef-client pid: 4192
[2015-03-01T17:44:16-06:00] WARN: Run List override has been provided.
[2015-03-01T17:44:16-06:00] WARN: Original Run List: []
[2015-03-01T17:44:16-06:00] WARN: Overridden Run List: [recipe[audit_centos]]
[2015-03-01T17:44:16-06:00] INFO: Run List is [recipe[audit_centos]]
[2015-03-01T17:44:16-06:00] INFO: Run List expands to [audit_centos]
[2015-03-01T17:44:16-06:00] INFO: Starting Chef Run for centos6
[2015-03-01T17:44:16-06:00] INFO: Running start handlers
[2015-03-01T17:44:16-06:00] INFO: Start handlers complete.
[2015-03-01T17:44:16-06:00] INFO: HTTP Request Returned 404 Not Found : Object not found: /reports/nodes/centos6/runs
resolving cookbooks for run list: ["audit_centos"]
[2015-03-01T17:44:16-06:00] INFO: Loading cookbooks [audit_centos@0.1.0]
[2015-03-01T17:44:16-06:00] INFO: Skipping removal of obsoleted cookbooks from the cache
Synchronizing Cookbooks:
- audit_centos
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/audit_centos/recipes/default.rb
================================================================================
NoMethodError
-------------
No resource or method named `control_group' for `Chef::Recipe "default"'
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/audit_centos/recipes/default.rb:8:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/audit_centos/recipes/default.rb:
1: #
2: # Cookbook Name:: audit_centos
3: # Recipe:: default
4: #
5: # Copyright (c) 2015 The Authors, All Rights Reserved.
6:
7: # Check for the latest OpenSSL
8>> control_group "Check OpenSSL" do
9: control "openssl" do
10: it "should be installed" do
11: expect(package("openssl")).to be_installed.with_version("1.0.1.e-30")
12: end
13: end
14: end
15:
16: # Check for the fstab file
17: control_group "Check the FSTab" do
Running handlers:
[2015-03-01T17:44:16-06:00] ERROR: Running exception handlers
Running handlers complete
[2015-03-01T17:44:16-06:00] ERROR: Exception handlers complete
[2015-03-01T17:44:16-06:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 6.719398287 seconds
[2015-03-01T17:44:16-06:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'
[2015-03-01T17:44:18-06:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
我不确定我错过了什么或做错了什么。这是一个独立的厨师 - 客户端安装,它不向厨师服务器报告。我也在我的git存储库上打开了一个问题。 https://github.com/predatorian3/audit_centos/issues/1 是否有任何示例烹饪书,或更多解释如何在食谱中使用这些方法?
答案 0 :(得分:1)
您需要最新的ChefDK候选版本(0.5.0)和最新的chef-client。然后,您可以kitchen converge
或knife bootstrap
节点。
.kitchen.yml应该有
driver_config:
require_chef_omnibus: latest
答案 1 :(得分:0)
原来,截至目前,Chef Analytics是一项高级功能,这意味着您需要Enterprise Chef,或支付远程托管费用。目前不支持Open Source Chef。长号。