Class: LogicalConstruct::Default::ChefConfig
- Inherits:
-
Mattock::Tasklib
- Object
- Mattock::Tasklib
- LogicalConstruct::Default::ChefConfig
- Includes:
- Mattock::CommandLineDSL, Mattock::TemplateHost
- Defined in:
- lib/logical-construct/target/platforms/default/chef-config.rb
Overview
XXX Should get broken into at least 2 smaller tasklibs
Instance Method Summary collapse
- #default_configuration(provision, resolution) ⇒ Object
- #define ⇒ Object
-
#resolve_configuration ⇒ Object
XXX Hints about decomposing this Tasklib: there are settings for chef/solo.rb, which are only incidentally related to the tarball unpacking tasks - which are themselves closely related.
Instance Method Details
#default_configuration(provision, resolution) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/logical-construct/target/platforms/default/chef-config.rb', line 30 def default_configuration(provision, resolution) super self.construct_dir = provision.construct_dir self.valise = provision.valise self.resolution = resolution end |
#define ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/logical-construct/target/platforms/default/chef-config.rb', line 79 def define in_namespace do directory etc_chef directory file_cache_path Mattock::CommandTask.new(:unpack_cookbooks => :cookbook_tarball) do |task| task.command = cmd("cd", file_cache_path) & cmd("tar", "-xzf", cookbook_tarball_path) end Mattock::CommandTask.new(:unpack_secret_data => :secret_data_tarball) do |task| task.command = cmd("cd", file_cache_path) & cmd("tar", "-xzf", secret_data_tarball_path) end Mattock::CommandTask.new(:unpack_normal_data => :normal_data_tarball) do |task| task.command = cmd("cd", file_cache_path) & cmd("tar", "-xzf", normal_data_tarball_path) end file solo_rb => [etc_chef, :json_attribs, :unpack_cookbooks, :unpack_secret_data, :unpack_normal_data] do File::open(solo_rb, "w") do |file| file.write(render("chef.rb.erb")) end end resolution.add_file(SatisfiableFileTask.new(:json_attribs => file_cache_path) do |task| task.target_path = json_attribs end) resolution.add_file(SatisfiableFileTask.new(:cookbook_tarball => file_cache_path) do |task| task.target_path = cookbook_tarball_path end) resolution.add_file(SatisfiableFileTask.new(:secret_data_tarball => file_cache_path) do |task| task.target_path = secret_data_tarball_path end) resolution.add_file(SatisfiableFileTask.new(:normal_data_tarball => file_cache_path) do |task| task.target_path = normal_data_tarball_path end) unless role_path.nil? directory role_path file solo_rb => role_path end desc "Delete all the chef config files (to re-provision)" task :clobber do cmd("rm", "-rf", file_cache_path) end end file solo_rb => resolution[:Manifest] task :build_configs => solo_rb end |
#resolve_configuration ⇒ Object
XXX Hints about decomposing this Tasklib: there are settings for chef/solo.rb, which are only incidentally related to the tarball unpacking tasks - which are themselves closely related
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/logical-construct/target/platforms/default/chef-config.rb', line 40 def resolve_configuration if unset?(file_cache_path) self.file_cache_path = File::('chef', construct_dir) end self.file_cache_path = File::(file_cache_path) if unset?(cookbook_path) and !cookbook_relpath.nil? self.cookbook_path = File::(cookbook_relpath, file_cache_path) end if unset?(data_bags_path) and !data_bags_relpath.nil? self.data_bags_path = File::(data_bags_relpath, file_cache_path) end if unset?(cookbook_tarball_path) and !cookbook_tarball_relpath.nil? self.cookbook_tarball_path = File::(cookbook_tarball_relpath, file_cache_path) end if unset?(secret_data_tarball_path) and !secret_data_tarball_relpath.nil? self.secret_data_tarball_path = File::(secret_data_tarball_relpath, file_cache_path) end if unset?(normal_data_tarball_path) and !normal_data_tarball_relpath.nil? self.normal_data_tarball_path = File::(normal_data_tarball_relpath, file_cache_path) end self.solo_rb = File::(solo_rb, file_cache_path) if unset?(json_attribs) and !json_attribs_relpath.nil? self.json_attribs = File::(json_attribs_relpath, file_cache_path) end if role_path.nil? and !role_relpath.nil? self.role_path = File::(role_relpath, file_cache_path) end super end |