2017-03-08 2 views
0

Ich führe das Koch Kochbuch Rezept im lokalen Modus, habe ich die Vorlage .erb-Datei unter Kochbücher Vorlagen Ordner platziert. Es gibt Fehler und Chef :: Ausnahmen :: CookbookNotFoundChef-Client lokalen Modus nicht in der Lage, Aktion auf Vorlagenressource auf Windows-Rechner

Befestigung Ausführungsprotokoll

PS C:\chef-repo> chef-client -z -r "recipe[my_cookbook::test1]" 
Starting Chef Client, version 12.18.31 
resolving cookbooks for run list: ["my_cookbook::test1"] 
Synchronizing Cookbooks: 
    - test (0.1.0) 
Installing Cookbook Gems: 
Compiling Cookbooks... 
Converging 1 resources 
Recipe: test::test1 
    * template[c:\test-template.txt] action create 

    ================================================================================ 
    Error executing action `create` on resource 'template[c:\test-template.txt]' 
    ================================================================================ 

    Chef::Exceptions::CookbookNotFound 
    ---------------------------------- 
    Cookbook test not found. If you're loading test from another cookbook, make sure you configure the dependency in you 
r metadata 

    Resource Declaration: 
    --------------------- 
    # In c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/test/recipes/test1.rb 

     1: template "c:\\test-template.txt" do 
     2: source "test-template.txt.erb" 
     3: mode '0755' 
     4: variables({ 
     5:  test: node['cloud']['public_ipv4'] 
     6: }) 
     7: end 

    Compiled Resource: 
    ------------------ 
    # Declared in c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/test/recipes/test1.rb:1:in `from_file' 

    template("c:\test-template.txt") do 
     action [:create] 
     retries 0 
     retry_delay 2 
     default_guard_interpreter :default 
     source "test-template.txt.erb" 
     variables {:test=>"1.1.1.1"} 
     declared_type :template 
     cookbook_name "test" 
     recipe_name "test1" 
     mode "0755" 
     path "c:\\test-template.txt" 
    end 

    Platform: 
    --------- 
    x64-mingw32 


Running handlers: 
[2017-03-08T12:32:35+00:00] ERROR: Running exception handlers 
Running handlers complete 
[2017-03-08T12:32:35+00:00] ERROR: Exception handlers complete 
Chef Client failed. 0 resources updated in 05 seconds 
[2017-03-08T12:32:35+00:00] FATAL: Stacktrace dumped to c:/chef-repo/.chef/local-mode-cache/cache/chef-stacktrace.out 
[2017-03-08T12:32:35+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report 
[2017-03-08T12:32:35+00:00] FATAL: Chef::Exceptions::CookbookNotFound: template[c:\test-template.txt] (test::test1 line 
1) had an error: Chef::Exceptions::CookbookNotFound: Cookbook test not found. If you're loading test from another cookbo 
ok, make sure you configure the dependency in your metadata 

test1.rb 

template "c:\\test-template.txt" do 
source "test-template.txt.erb" 
mode '0755' 
variables({ 
    test: node['cloud']['public_ipv4'] 
}) 
end 

My chef-repo tree : C:. ├───.chef │ └───local-mode-cache │ └───cache │ └───cookbooks │ └───test │ ├───attributes │ ├───recipes │ └───templates | |___test-template.txt.erb ├───cookbooks │ └───my_cookbook │ ├───attributes │ ├───definitions │ ├───files │ │ └───default │ ├───libraries │ ├───providers │ ├───recipes │ ├───resources │ └───templates │ └───default | |___test-template.txt.erb
├───data_bags │ └───example ├───environments ├───nodes └───roles

+0

Ich habe Rezept Inhalte sowie Baum hinzugefügt. – Bhushan

Antwort

1

nur eine Vermutung, aber hier ist, was ich denke, ist falsch:

Die Vorlagenressource sucht nach einer Quelle f ile in c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/test/templates/test-template.txt.erb.

mit denen Logzeile:

resolving cookbooks for run list: ["my_cookbook::test1"] 
... 
Converging 1 resources 
Recipe: test::test1 

Das macht mich denken taht entweder:

  • Ihre eigentliche Kochbuch-Vorlage ist bei „c: /chef-repo/.chef/local-mode -cache/cache/Kochbücher/my_cookbook/templates/test-template.txt.erb "und deine metadata.rb verwenden das falsche Attribut name.

  • Sie haben einen Tippfehler irgendwo in der Vorlage Name oder Ort, während Sie mit einem Wrapper Kochbuch spielen.

+1

Danke checked metadata.rb, hatte dort falsches Attribut name. – Bhushan

Verwandte Themen