2016-04-16 35 views
1

安裝廚師客戶端和DK在Windows服務器上,試圖用一個配方,在本地模式下的Windows功能不能獲得基本的廚師方案在Windows上工作有了食譜

冉以下

C:\chef>mkdir cookbooks 
C:\chef>cd cookbooks 
C:\chef\cookbooks>chef generate cookbook test_chef 

把下面的C:\廚師\食譜\ test_chef \ Berksfile

source 'https://supermarket.chef.io' 

metadata 
cookbook 'windows', '~> 1.39.2' 

把下面的C:\廚師\食譜\ test_chef \食譜\ default.rb

windows_feature "NetFx3" do 
    action :install 
    all true 
end 

運行以下

C:\chef\cookbooks\test_chef>berks vendor install 
Resolving cookbook dependencies... 
Fetching 'test_chef' from source at . 
Using chef_handler (1.3.0) 
Using test_chef (0.1.0) from source at . 
Using windows (1.39.2) 
Vendoring chef_handler (1.3.0) to install/chef_handler 
Vendoring test_chef (0.1.0) to install/test_chef 
Vendoring windows (1.39.2) to install/windows 

C:\chef\cookbooks\test_chef>chef-client --local-mode --runlist 'recipe[test_chef] 
[2016-04-16T04:44:06+00:00] WARN: No config file found or specified on command line, using command line options. 
Starting Chef Client, version 12.8.1 
resolving cookbooks for run list: ["test_chef"] 
Synchronizing Cookbooks: 
    - test_chef (0.1.0) 
Installing Cookbook Gems: 
Compiling Cookbooks... 
←[0m 
================================================================================ 
Recipe Compile Error in C:/Users/admin/.chef/local-mode-cache/cache/cookbooks/test_chef/recipes/default.rb 
================================================================================ 

NoMethodError 
------------- 
No resource or method named `windows_feature' for `Chef::Recipe "default"' 

←[0m 
Running handlers: 
[2016-04-16T04:44:10+00:00] ERROR: Running exception handlers 
Running handlers complete 
[2016-04-16T04:44:10+00:00] ERROR: Exception handlers complete 
Chef Client failed. 0 resources updated in 03 seconds 
[2016-04-16T04:44:10+00:00] FATAL: Stacktrace dumped to C:/Users/admin/.chef/local-mode-cache/cache/chef-stacktrace.out 
[2016-04-16T04:44:10+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report 
[2016-04-16T04:44:10+00:00] FATAL: NoMethodError: No resource or method named `windows_feature' for `Chef::Recipe "defau 
lt"' 

所以,儘管我使用伯克斯安裝供應商,它的成功下載窗口食譜到食譜文件夾,廚師客戶端仍然炸彈就試圖使用windows_feature。

我基本上是遵循一個在線的例子逐字。

回答

1

,而不是添加下面一行到你的Berksfile

cookbook 'windows', '~> 1.39.2' 

的這一行添加到您的metadata.rb

depends 'windows', '~> 1.39.2' 

Berkshelf將仍然能夠從超市下載這種依賴性(因爲它是添加爲source),但不是chef-client將在您的食譜之前加載食譜,並因此加載窗口 reso urce將被認識。

+0

這是什麼實際的區別? – Jeff

+0

Missing Cookbooks: ------------------ 沒有這樣的食譜:windows – Jeff

+0

我還需要berksfile嗎? – Jeff