1616# limitations under the License.
1717#
1818
19+ require 'chef/knife/cs_base'
20+
1921module KnifeCloudstack
2022 class CsStackDelete < Chef ::Knife
2123
24+ include Chef ::Knife ::KnifeCloudstackBase
25+
2226 deps do
2327 require 'chef/json_compat'
2428 require 'chef/mash'
@@ -30,25 +34,11 @@ class CsStackDelete < Chef::Knife
3034
3135 banner "knife cs stack delete JSON_FILE (options)"
3236
33- option :cloudstack_url ,
34- :short => "-U URL" ,
35- :long => "--cloudstack-url URL" ,
36- :description => "The CloudStack endpoint URL" ,
37- :proc => Proc . new { |url | Chef ::Config [ :knife ] [ :cloudstack_url ] = url }
38-
39- option :cloudstack_api_key ,
40- :short => "-A KEY" ,
41- :long => "--cloudstack-api-key KEY" ,
42- :description => "Your CloudStack API key" ,
43- :proc => Proc . new { |key | Chef ::Config [ :knife ] [ :cloudstack_api_key ] = key }
44-
45- option :cloudstack_secret_key ,
46- :short => "-K SECRET" ,
47- :long => "--cloudstack-secret-key SECRET" ,
48- :description => "Your CloudStack secret key" ,
49- :proc => Proc . new { |key | Chef ::Config [ :knife ] [ :cloudstack_secret_key ] = key }
50-
5137 def run
38+ if @name_args . first . nil?
39+ ui . error "Please specify json file eg: knife cs stack delete JSON_FILE"
40+ exit 1
41+ end
5242 file_path = File . expand_path ( @name_args . first )
5343 unless File . exist? ( file_path ) then
5444 ui . error "Stack file '#{ file_path } ' not found. Please check the path."
0 commit comments