Class: VagrantPlugins::Vrealize::Action::TerminateInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::Vrealize::Action::TerminateInstance
- Defined in:
- lib/vagrant-vrealize/action/terminate_instance.rb
Overview
This terminates the running instance.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ TerminateInstance
constructor
A new instance of TerminateInstance.
Constructor Details
#initialize(app, env) ⇒ TerminateInstance
Returns a new instance of TerminateInstance.
9 10 11 12 |
# File 'lib/vagrant-vrealize/action/terminate_instance.rb', line 9 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_vrealize::action::terminate_instance") end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vagrant-vrealize/action/terminate_instance.rb', line 14 def call(env) vra = env[:vra] vra.destroy(env[:machine].id) if env[:machine].id # Destroy action_provision action_provision_file = env[:machine].data_dir.join('action_provision') if action_provision_file.file? action_provision_file.delete end # Destroy creator_uid creator_uid_file = env[:machine].data_dir.join('creator_uid') if creator_uid_file.file? creator_uid_file.delete end # Destroy elastic_ip elastic_ip_file = env[:machine].data_dir.join('elastic_ip') if elastic_ip_file.file? elastic_ip_file.delete end # Destroy id id_file = env[:machine].data_dir.join('id') if id_file.file? id_file.delete end # Destroy index_uuid index_uuid_file = env[:machine].data_dir.join('index_uuid') if index_uuid_file.file? index_uuid_file.delete end # Destroy private_key private_key_file = env[:machine].data_dir.join('private_key') if private_key_file.file? private_key_file.delete end # Destroy synced_folders synced_folders_file = env[:machine].data_dir.join('synced_folders') if synced_folders_file.file? synced_folders_file.delete end @app.call(env) end |