Kompilierzeit vs. Laufzeit in Kochrezepten

Ich habe das folgende (vereinfachte) Rezept namens Java, um Java natürlich zu installieren.

Dateirezepte / default.rb

include_recipe "install_java"

File recipes / install_java.rb

# Install RPM from yum repo via yum_install library function
yum_install("jdk1.7.0_51")

# List the directories in /usr/java
jdk_dir = `ls -ld /usr/java/jdk1.* | sort | tail -1`
if jdk_dir.empty?
  raise "Missing JDK installation"
end

Wenn ich das Rezept von "chef-client -o recipe [java]" ausführe

Synchronizing Cookbooks:
  - java
Compiling Cookbooks...
ls: /usr/java/jdk1.*: No such file or directory

=============================================== ======================== Rezeptkompilierungsfehler in /var/chef/cache/cookbooks/java/recipes/default.rb ===== ================================================ ====================

RuntimeError
------------
Missing JDK installation

Es scheint, als würde die Funktion yum_install () NICHT aufgerufen. Wenn ich jedoch das Rezept install_java.rb so ändere, dass es nur @ enthä

# Install RPM from yum repo via yum_install library function
yum_install("jdk1.7.0_51")

Es klappt

Warum ist das

Antworten auf die Frage(2)

Ihre Antwort auf die Frage