cloudstack_client 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b83801bc8c3a8bc4db5a1c0b29545b731bb4a11
4
- data.tar.gz: d5066cc41f9828ea1669c39092bc5926c55d8007
3
+ metadata.gz: 39c173ca823d6854201b4a0a0cec06c6c13b7dd0
4
+ data.tar.gz: 3a3e5aba0008e878e880f77ade688faa283f7dc6
5
5
  SHA512:
6
- metadata.gz: 4ec071ae7e95ac25fed11fb81eec2603e962018ac21234292334b16801cf9d5aacb497ecb3667afc27b15e4e441cbab4a9b3f8d967efdf7a1532e12feff232fe
7
- data.tar.gz: b12be877c52c2a23b546b39bfe747aa2ff8208842d96d55fca78e8e03800e471ddb1da44ccab18952de2c03a2c50072285b3e1af9cb4c334466c654a123fc89f
6
+ metadata.gz: d0953872f60e21184d8660ca37badb74f27162065088618176d84e7f0d60deac390a97038a77535dbf3a926b27272fc9c6d03cbc1667737e40349fe2b05b0be5
7
+ data.tar.gz: fa51954d741badaf6fc3fa7690ba9bd29dae344677964abc7777c7769dcf136779b8c5a222b1eee3aa003878afa1fd2f4f336385624a2550bea2f037bf46acd9
@@ -14,13 +14,14 @@ module CloudstackClient
14
14
  @@async_timeout = 400
15
15
 
16
16
  # include all commands
17
- Dir.glob(File.dirname(__FILE__) + "/commands/*.rb").each do |file|
17
+ Dir.glob(File.dirname(__FILE__) + "/commands/*.rb").each do |file|
18
18
  require file
19
19
  module_name = File.basename(file, '.rb').split('_').map{|f| f.capitalize}.join
20
20
  include Object.const_get("CloudstackClient").const_get(module_name)
21
21
  end
22
22
 
23
23
  attr_accessor :verbose
24
+ attr_accessor :debug
24
25
 
25
26
  def initialize(api_url, api_key, secret_key, opts = {})
26
27
  @api_url = api_url
@@ -56,7 +57,7 @@ module CloudstackClient
56
57
 
57
58
  uri = URI.parse(url)
58
59
  http = Net::HTTP.new(uri.host, uri.port)
59
-
60
+
60
61
  if uri.scheme == 'https'
61
62
  http.use_ssl = true
62
63
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -70,9 +71,9 @@ module CloudstackClient
70
71
  exit 1
71
72
  end
72
73
 
73
-
74
+
74
75
  if response.is_a? Net::HTTPOK
75
- begin
76
+ begin
76
77
  json = JSON.parse(response.body)
77
78
  json = json[params['command'].downcase + 'response']
78
79
  rescue JSON::ParserError
@@ -81,7 +82,7 @@ module CloudstackClient
81
82
  exit 2
82
83
  end
83
84
  else
84
- begin
85
+ begin
85
86
  json = JSON.parse(response.body)
86
87
  puts "Error executing command..."
87
88
  puts json if @debug
@@ -137,11 +138,11 @@ module CloudstackClient
137
138
 
138
139
  def debug_output(output, seperator = '-' * 80)
139
140
  puts
140
- puts seperator
141
+ puts seperator
141
142
  puts output
142
143
  puts seperator
143
144
  puts
144
145
  end
145
146
 
146
147
  end # class
147
- end
148
+ end
@@ -11,7 +11,7 @@ module CloudstackClient
11
11
  'listall' => 'true',
12
12
  'name' => name
13
13
  }
14
- params['projectid'] = project_id if project_id
14
+ params['projectid'] = project_id if project_id
15
15
 
16
16
  json = send_request(params)
17
17
  json['router'] ? json['router'].first : nil
@@ -28,11 +28,11 @@ module CloudstackClient
28
28
  }
29
29
  if args[:zone]
30
30
  zone = get_zone(args[:zone])
31
- unless zone
31
+ unless zone
32
32
  puts "Error: Zone #{args[:zone]} not found"
33
33
  exit 1
34
34
  end
35
- params['zoneid'] = zone['id']
35
+ params['zoneid'] = zone['id']
36
36
  end
37
37
  params['projectid'] = args[:projectid] if args[:projectid]
38
38
  params['state'] = args[:status] if args[:status]
@@ -84,6 +84,17 @@ module CloudstackClient
84
84
  opts[:async] ? send_async_request(params)['router'] : send_request(params)
85
85
  end
86
86
 
87
+ ##
88
+ # Reboot virtual router.
89
+
90
+ def reboot_router(id, opts = {async: true})
91
+ params = {
92
+ 'command' => 'rebootRouter',
93
+ 'id' => id
94
+ }
95
+ opts[:async] ? send_async_request(params)['router'] : send_request(params)
96
+ end
97
+
87
98
  end
88
99
 
89
- end
100
+ end
@@ -116,7 +116,7 @@ module CloudstackClient
116
116
  'command' => 'listVirtualMachines',
117
117
  'listAll' => true
118
118
  }
119
- params.merge!(args[:custom]) if args.key?(:custom)
119
+ params.merge!(args[:custom]) if args[:custom]
120
120
 
121
121
  params['state'] = args[:state] if args[:state]
122
122
  params['state'] = args[:status] if args[:status]
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc