lib/cloudstack-cli/commands/offering.rb in cloudstack-cli-0.0.1 vs lib/cloudstack-cli/commands/offering.rb in cloudstack-cli-0.0.2
- old
+ new
@@ -2,11 +2,11 @@
include CommandLineReporter
desc 'list', 'list offerings by type [compute|network|storage]'
option :domain
def list(type='compute')
- cs_cli = CloudstackCli::Helper.new
+ cs_cli = CloudstackCli::Helper.new(options[:config])
offerings = cs_cli.server_offerings(options[:domain])
offerings.group_by{|o| o["domain"]}.each_value do |offers|
offers.sort {
|oa, ob| [oa["cpunumber"], oa["memory"]] <=> [ob["cpunumber"], ob["memory"]]
@@ -45,23 +45,23 @@
option :domain
option :ha, type: :boolean
option :tags
def create(name)
options[:name] = name
- cs_cli = CloudstackCli::Helper.new
+ cs_cli = CloudstackCli::Helper.new(options[:config])
puts "OK" if cs_cli.create_offering(options)
end
desc 'delete ID', 'delete offering'
def delete(id)
- cs_cli = CloudstackCli::Helper.new
+ cs_cli = CloudstackCli::Helper.new(options[:config])
puts "OK" if cs_cli.delete_offering(id)
end
desc 'sort', 'sort by cpu and memory grouped by domain'
def sort
- cs_cli = CloudstackCli::Helper.new
+ cs_cli = CloudstackCli::Helper.new(options[:config])
offerings = cs_cli.server_offerings(options[:domain])
sortkey = -1
offerings.group_by{|o| o["domain"]}.each_value do |offers|
offers.sort {
|oa, ob| [oa["cpunumber"], oa["memory"]] <=> [ob["cpunumber"], ob["memory"]]
\ No newline at end of file