Class: Fhcap::Tasks::Chef::Provisioning::ChefProvisioningTaskBase
- Inherits:
-
ChefServerTask
- Object
- TaskBase
- ChefTaskBase
- ChefServerTask
- Fhcap::Tasks::Chef::Provisioning::ChefProvisioningTaskBase
- Defined in:
- lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cluster_config ⇒ Object
readonly
Returns the value of attribute cluster_config.
-
#cluster_filepath ⇒ Object
readonly
Returns the value of attribute cluster_filepath.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from ChefServerTask
#chef_repo, #chef_server, #repos
Attributes inherited from TaskBase
#config, #options, #thor, #verbose
Instance Method Summary collapse
- #do_chef_run(run_list) ⇒ Object
-
#initialize(options) ⇒ ChefProvisioningTaskBase
constructor
A new instance of ChefProvisioningTaskBase.
- #seed_cookbooks ⇒ Object
Methods inherited from ChefServerTask
#delete_chef_object, #knife_data_bag_delete, #knife_download, #knife_environment_delete, #knife_upload, #local_chef_server?, #with_chef_server, #with_local_chef_server
Methods inherited from ChefTaskBase
#knife_config_dir, #knife_config_file_for, #run_chef_client_cmd, #run_knife_cmd, #run_knife_ssh_cmd
Methods inherited from TaskBase
#ask_config, #color_pad, #exit_with_error, #set_color, #suppress_stdout, #table_header, #table_row, #with_progress
Methods included from KnifeHelper
#chef_server_config_for, #chef_server_config_hash_for, #chef_server_names, #knife_config, #knife_config_dir, #knife_config_file_for
Methods included from ProvidersHelper
#provider_availability_zones, #provider_config, #provider_credentials, #provider_for, #provider_names, #provider_names_for, #provider_regions, #provider_type, #providers_config
Methods included from ReposHelper
#find_cluster, #find_cluster_pwds, #find_cluster_pwds_with_repo, #find_cluster_with_repo, #find_data_bag, #find_data_bag_item, #find_environment, #find_repo_item, #find_role, #get_cookbook_deps, #get_cookbook_meta, #get_cookbook_versions, #get_cookbooks, #get_entry_dependencies, #get_modified_cookbooks, #is_dirty?, #modified?, #repo_cfg, #repo_clusters_dir, #repo_cookbook_paths, #repo_dir, #repo_names, #repo_paths, #repos_config, #repos_dir, #run_inside_repo_dir
Methods included from FhcapHelper
Constructor Details
#initialize(options) ⇒ ChefProvisioningTaskBase
Returns a new instance of ChefProvisioningTaskBase.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb', line 13 def initialize() super @name = [:name] @cluster_filepath = find_cluster(name) if @cluster_filepath @cluster_config = JSON.parse(IO.read(@cluster_filepath), {:symbolize_names => true}) @cluster_config.merge!({ local_repo_path: repo_dir(@chef_repo), local_repo_clusters_dir: repo_clusters_dir(@chef_repo), chef_server_config: chef_server_config_hash_for(@chef_server), provider_credentials: provider_credentials(@cluster_config[:provider_id]), max_simultaneous: [:series] ? 1 : nil }) else exit_with_error("Unknown cluster #{@name}") end end |
Instance Attribute Details
#cluster_config ⇒ Object (readonly)
Returns the value of attribute cluster_config.
11 12 13 |
# File 'lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb', line 11 def cluster_config @cluster_config end |
#cluster_filepath ⇒ Object (readonly)
Returns the value of attribute cluster_filepath.
11 12 13 |
# File 'lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb', line 11 def cluster_filepath @cluster_filepath end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb', line 11 def name @name end |
Instance Method Details
#do_chef_run(run_list) ⇒ Object
38 39 40 41 42 |
# File 'lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb', line 38 def do_chef_run(run_list) cookbook_path = File.join(Fhcap.source_root, 'lib', 'cookbooks') private_key_paths = [File.join(cluster_config[:local_repo_path], cluster_config[:local_repo_clusters_dir], 'key_pairs')] Fhcap::ChefRunner.new(cookbook_path, run_list, cluster_config, private_key_paths).converge end |
#seed_cookbooks ⇒ Object
31 32 33 34 35 36 |
# File 'lib/fhcap/tasks/chef/provisioning/chef_provisioning_task_base.rb', line 31 def seed_cookbooks archive_task = Chef::Cookbook::Archive.new(.dup.merge({:'skip-repo-checkout' => true})) archive_task.run @cluster_config[:local_cookbook_archive] = archive_task.archive do_chef_run("provision::seed_cookbooks") end |