Class: DependencyResolvers::Chef
- Defined in:
- lib/dependency_resolvers/chef.rb
Class Attribute Summary collapse
-
.base_cookbook_directory ⇒ Object
readonly
Returns the value of attribute base_cookbook_directory.
-
.cookbook_directory ⇒ Object
readonly
Returns the value of attribute cookbook_directory.
Class Method Summary collapse
- .after_compile(o) ⇒ Object
- .before_compile ⇒ Object
- .compile_command ⇒ Object
-
.compile_resource(res) ⇒ Object
compile the resources Compiles the resource appropriately against the type If the resource is a variable, then we don’t have any output as the output will be handled in after_compile with compile_variables If the resource is a file, then add it to the files array and run the compile_resource command (on super) for the output.
- .require_chef_only_resources ⇒ Object
Methods inherited from Base
caller, compile, compile_method_name, compile_to, inherited
Class Attribute Details
.base_cookbook_directory ⇒ Object (readonly)
Returns the value of attribute base_cookbook_directory.
9 10 11 |
# File 'lib/dependency_resolvers/chef.rb', line 9 def base_cookbook_directory @base_cookbook_directory end |
.cookbook_directory ⇒ Object (readonly)
Returns the value of attribute cookbook_directory.
9 10 11 |
# File 'lib/dependency_resolvers/chef.rb', line 9 def cookbook_directory @cookbook_directory end |
Class Method Details
.after_compile(o) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/dependency_resolvers/chef.rb', line 18 def after_compile(o) compile_default_recipe(o) compile_variables compile_files compile_recipes write_dna_json write_solo_dot_rb end |
.before_compile ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dependency_resolvers/chef.rb', line 11 def before_compile @cookbook_directory = compile_directory/"cookbooks"/"poolparty" @base_cookbook_directory = compile_directory/"cookbooks" raise PoolParty::PoolPartyError.create("ChefCompileError", "No compile_directory is specified. Please specify one.") unless compile_directory FileUtils.mkdir_p cookbook_directory unless ::File.directory?(cookbook_directory) end |
.compile_command ⇒ Object
28 29 30 |
# File 'lib/dependency_resolvers/chef.rb', line 28 def compile_command "/usr/bin/chef-solo -c /etc/chef/solo.rb -j /etc/chef/dna.json#{ " -l debug" if very_debugging?}" end |
.compile_resource(res) ⇒ Object
compile the resources Compiles the resource appropriately against the type If the resource is a variable, then we don’t have any output as the output will be handled in after_compile with compile_variables If the resource is a file, then add it to the files array and run the compile_resource command (on super) for the output. The file will later be turned into a .erb template file in the compile_directory Otherwise just run the output to get the default.rb recipe
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/dependency_resolvers/chef.rb', line 40 def compile_resource(res) # Apply meta_functions here o = case res when PoolParty::Resources::Variable # do variable stuff variables << res "" when PoolParty::Resources::FileResource files << res super when PoolParty::Resources::ChefAttributesFile attribute_files << res "" when PoolParty::Resources::ChefRecipe recipes << res super else super end (res, o) if res.is_a?(PoolParty::Resource) && res.print_to_chef != :no_print end |
.require_chef_only_resources ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/dependency_resolvers/chef.rb', line 68 def require_chef_only_resources # Require the chef-only resources $:.unshift("#{File.dirname(__FILE__)}/chef") to_define_resoures = [] %w( http_request remote_directory remote_file route script chef_attributes_file chef_recipe).each do |res| require "resources/#{res}" PoolParty::Resource.define_resource("PoolParty::Resources::#{res.classify}".constantize) end end |