Class: Dployr::Commands::StopDestroy
- Defined in:
- lib/dployr/commands/stop_destroy.rb
Instance Method Summary collapse
- #action ⇒ Object
-
#initialize(options, action) ⇒ StopDestroy
constructor
A new instance of StopDestroy.
Methods inherited from Base
#create, #create_compute_client, #get_config, #get_region_config
Methods included from Utils
parse_attributes, parse_flags, parse_matrix
Constructor Details
#initialize(options, action) ⇒ StopDestroy
Returns a new instance of StopDestroy.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dployr/commands/stop_destroy.rb', line 8 def initialize(, action) super @action = action puts "Connecting to #{@provider}...".yellow @client = Dployr::Compute.const_get(@provider.to_sym).new @options, @p_attrs if @p_attrs["type"] == "network" puts "Destroying network in #{@options[:provider]}: #{@options[:region]}...".yellow @network = @client.delete_network(@p_attrs["name"], @p_attrs["private_net"], @p_attrs["firewalls"], []) else puts "Looking for #{@p_attrs["name"]} in #{@options[:region]}...".yellow @ip = @client.get_ip if @ip puts "#{@p_attrs["name"]} found with IP #{@ip}".yellow else puts "#{@p_attrs["name"]} not found".yellow end Dployr::Scripts::Default_Hooks.new @ip, @config, action, self end end |
Instance Method Details
#action ⇒ Object
32 33 34 35 36 37 |
# File 'lib/dployr/commands/stop_destroy.rb', line 32 def action puts "#{@action.capitalize}ing #{@p_attrs["name"]} in #{@options[:region]}...".yellow @client.send @action.to_sym puts "#{@p_attrs["name"]} #{@action}ed sucesfully".yellow @ip end |