Class: Fhcap::Tasks::Cluster::DestroyEnvironment
- Inherits:
-
ClusterTaskBase
- Object
- TaskBase
- ClusterTaskBase
- Fhcap::Tasks::Cluster::DestroyEnvironment
- Defined in:
- lib/fhcap/tasks/cluster/destroy_environment.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#environment_config ⇒ Object
readonly
Returns the value of attribute environment_config.
-
#environment_name ⇒ Object
readonly
Returns the value of attribute environment_name.
Attributes inherited from ClusterTaskBase
#cluster_config, #cluster_file, #name
Attributes inherited from TaskBase
#config, #options, #thor, #verbose
Instance Method Summary collapse
-
#initialize(options) ⇒ DestroyEnvironment
constructor
A new instance of DestroyEnvironment.
- #run ⇒ Object
Methods inherited from ClusterTaskBase
#checkout_repos, #chef_task_options, #template_as_object
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, #delete_chef_object, #knife_config, #knife_config_dir, #knife_config_file_for, #knife_data_bag_delete, #knife_download, #knife_environment_delete, #knife_upload, #local_chef_server?, #with_chef_server, #with_local_chef_server
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_dirty_cookbooks, #get_entry_dependencies, #get_modified_cookbooks, #git_diff, #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) ⇒ DestroyEnvironment
Returns a new instance of DestroyEnvironment.
11 12 13 14 |
# File 'lib/fhcap/tasks/cluster/destroy_environment.rb', line 11 def initialize() super() @environment_name = [:'environment-name'] end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
9 10 11 |
# File 'lib/fhcap/tasks/cluster/destroy_environment.rb', line 9 def domain @domain end |
#environment_config ⇒ Object (readonly)
Returns the value of attribute environment_config.
9 10 11 |
# File 'lib/fhcap/tasks/cluster/destroy_environment.rb', line 9 def environment_config @environment_config end |
#environment_name ⇒ Object (readonly)
Returns the value of attribute environment_name.
9 10 11 |
# File 'lib/fhcap/tasks/cluster/destroy_environment.rb', line 9 def environment_name @environment_name end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/fhcap/tasks/cluster/destroy_environment.rb', line 16 def run thor.say "Cluster::DestroyEnvironment: cluster = #{name}, environment = #{environment_name}", :yellow cluster_config[:environments].delete environment_name.to_sym thor.create_file(cluster_file, JSON.pretty_generate(cluster_config), force: true) Chef::Environments::Destroy.new(@options.dup.merge({:name => environment_name}.merge())).run end |