cloudstack-cli 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ class Router < Thor
11
11
  option :listall, type: :boolean
12
12
  option :text, type: :boolean, desc: "text output (only the instance name)"
13
13
  option :command, desc: "command to execute for each router: START or STOP"
14
+ option :reverse, type: :boolean, default: false, desc: "reverse listing of routers"
14
15
  def list
15
16
  cs_cli = CloudstackCli::Helper.new(options[:config])
16
17
  if options[:project]
@@ -45,6 +46,7 @@ class Router < Thor
45
46
  end
46
47
  end
47
48
 
49
+ routers.reverse! if options[:reverse]
48
50
  if options[:text]
49
51
  puts routers.map {|r| r['name']}.join(" ")
50
52
  else
@@ -80,14 +82,16 @@ class Router < Thor
80
82
  when "start"
81
83
  exit unless yes?("Start the routers above? [y/N]:", :magenta)
82
84
  routers.each do |router|
83
- say "Start router #{router['name']}"
85
+ print "Start router #{router['name']}"
84
86
  cs_cli.start_router router['id']
87
+ puts
85
88
  end
86
89
  when "stop"
87
90
  exit unless yes?("Stop the routers above? [y/N]:", :magenta)
88
91
  routers.each do |router|
89
- say "Stop router #{router['name']}"
92
+ print "Stop router #{router['name']}"
90
93
  cs_cli.stop_router router['id']
94
+ puts
91
95
  end
92
96
  else
93
97
  say "Command #{options[:command]} not supported", :red
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -740,7 +740,12 @@ module CloudstackClient
740
740
  params['state'] = args[:status] if args[:status]
741
741
  params['name'] = args[:name] if args[:name]
742
742
  if args[:account]
743
- params['domainid'] = list_accounts({name: args[:account]}).first["domainid"]
743
+ account = list_accounts({name: args[:account]}).first
744
+ unless account
745
+ puts "Error: Account #{args[:account]} not found."
746
+ exit 1
747
+ end
748
+ params['domainid'] = account["domainid"]
744
749
  params['account'] = args[:account]
745
750
  end
746
751
 
@@ -756,7 +761,6 @@ module CloudstackClient
756
761
  'command' => 'destroyRouter',
757
762
  'id' => id
758
763
  }
759
-
760
764
  json = send_request(params)
761
765
  json['router'].first
762
766
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-22 00:00:00.000000000 Z
12
+ date: 2013-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc