@@ -45,7 +45,10 @@ class CsServerList < Chef::Knife
4545 :short => "-a ACTION" ,
4646 :long => "--action ACTION" ,
4747 :description => "start, stop or destroy the instances in your result"
48-
48+
49+ option :expunge ,
50+ :long => "--expunge" ,
51+ :description => "If used with --action destroy, will cause the server to be expunged"
4952 option :public_ip ,
5053 :long => "--[no-]public-ip" ,
5154 :description => "Show or don't show the public IP for server in your result" ,
@@ -70,7 +73,9 @@ def run
7073 params [ 'listall' ] = locate_config_value ( :listall ) if locate_config_value ( :listall )
7174 params [ 'keyword' ] = locate_config_value ( :keyword ) if locate_config_value ( :keyword )
7275 params [ 'name' ] = locate_config_value ( :name ) if locate_config_value ( :name )
73-
76+ params [ 'expunge' ] = locate_config_value ( :expunge ) if locate_config_value ( :expunge )
77+ params [ 'expunge' ] = false if params [ 'expunge' ] . nil?
78+
7479 ##
7580 # Get the public IP address if possible, except when the option --no-public-ip is given.
7681
@@ -89,7 +94,7 @@ def run
8994 # Executing actions against the list results that are returned.
9095
9196 if locate_config_value ( :action )
92- connection_result . each do |r |
97+ result . each do |r |
9398 hostname = r [ 'name' ]
9499 case locate_config_value ( :action ) . downcase
95100 when "start" then
@@ -115,7 +120,7 @@ def run
115120 result = confirm_action ( "Do you really want to destroy this server " )
116121 if result then
117122 print "#{ ui . color ( "Waiting for demolition" , :magenta ) } "
118- connection . delete_server ( hostname )
123+ connection . delete_server ( hostname , params [ 'expunge' ] )
119124 puts "\n "
120125 ui . msg ( "Destroyed server #{ hostname } " )
121126 end
0 commit comments