cloudstack_client 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/4.5.msgpack +0 -0
- data/lib/cloudstack_client/api.rb +16 -2
- data/lib/cloudstack_client/cli.rb +11 -2
- data/lib/cloudstack_client/client.rb +1 -0
- data/lib/cloudstack_client/connection.rb +1 -1
- data/lib/cloudstack_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908b77c3fa4065282abe3a2ef5f2a48952618919
|
4
|
+
data.tar.gz: dcf47dca5f020ff59b9d7048f3158b847bf2e37b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8a64dbb06a0130f92c03e368296ddf9f6e6b9cc351668b8f6471c813d30cc0378fd060fc4e7b5d71e081f188f4c27ad66044bb89fb34d73e07c34c08aeae09f
|
7
|
+
data.tar.gz: 61f29d0710140c0dbcdd73c2ea78e63caac9b641611fbc82ac812c61261c25f5486934b6aa21704b6e9185ba9621cd47ff25c8389408d079d4dd4b6e5e8d3d93
|
data/config/4.5.msgpack
ADDED
Binary file
|
@@ -3,9 +3,20 @@ require "msgpack"
|
|
3
3
|
module CloudstackClient
|
4
4
|
class Api
|
5
5
|
|
6
|
-
DEFAULT_API_VERSION = "4.
|
6
|
+
DEFAULT_API_VERSION = "4.5"
|
7
7
|
|
8
8
|
attr_reader :commands
|
9
|
+
attr_reader :api_version
|
10
|
+
|
11
|
+
def self.versions
|
12
|
+
Dir["#{self.config_path}/*.msgpack"].map do |path|
|
13
|
+
File.basename(path, ".msgpack")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.config_path
|
18
|
+
File.expand_path("../../../config/", __FILE__)
|
19
|
+
end
|
9
20
|
|
10
21
|
def initialize(options = {})
|
11
22
|
if options[:api_file]
|
@@ -13,7 +24,10 @@ module CloudstackClient
|
|
13
24
|
@api_version = File.basename(@api_file, ".msgpack")
|
14
25
|
else
|
15
26
|
@api_version = options[:api_version] || DEFAULT_API_VERSION
|
16
|
-
|
27
|
+
unless Api.versions.include? @api_version
|
28
|
+
raise "API definition not found for #{@api_version}"
|
29
|
+
end
|
30
|
+
@api_file = File.join(Api.config_path, "#{@api_version}.msgpack")
|
17
31
|
end
|
18
32
|
@commands = load_commands
|
19
33
|
end
|
@@ -69,13 +69,22 @@ module CloudstackClient
|
|
69
69
|
end
|
70
70
|
|
71
71
|
desc "console", "Cloudstack Client interactive shell"
|
72
|
+
option :api_version,
|
73
|
+
desc: 'API version to use',
|
74
|
+
default: CloudstackClient::Api::DEFAULT_API_VERSION
|
75
|
+
option :api_file,
|
76
|
+
desc: 'specify a custom API definition file'
|
72
77
|
def console
|
73
|
-
|
78
|
+
cs_client = client(options)
|
79
|
+
|
80
|
+
print "cloudstack_client version #{CloudstackClient::VERSION}"
|
81
|
+
puts " (CloudStack API version #{cs_client.api.api_version})"
|
74
82
|
puts ' try: list_virtual_machines state: "Started"'
|
83
|
+
|
75
84
|
ARGV.clear
|
76
85
|
env = options[:env] ? options[:env] : load_configuration.last
|
77
86
|
Ripl.config[:prompt] = "#{env} >> "
|
78
|
-
Ripl.start binding:
|
87
|
+
Ripl.start binding: cs_client.instance_eval('binding')
|
79
88
|
end
|
80
89
|
|
81
90
|
no_commands do
|
@@ -105,7 +105,7 @@ module CloudstackClient
|
|
105
105
|
when 1
|
106
106
|
return data['jobresult']
|
107
107
|
when 2
|
108
|
-
raise JobError, "Request failed (#{data['jobresultcode']})
|
108
|
+
raise JobError, "Request failed (#{data['jobresultcode']}): #{data['jobresult']['errortext']}."
|
109
109
|
end
|
110
110
|
|
111
111
|
STDOUT.flush if @verbose
|
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: 1.0.
|
4
|
+
version: 1.0.4
|
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-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- bin/cloudstack_client
|
112
112
|
- cloudstack_client.gemspec
|
113
113
|
- config/4.2.msgpack
|
114
|
+
- config/4.5.msgpack
|
114
115
|
- lib/cloudstack_client.rb
|
115
116
|
- lib/cloudstack_client/api.rb
|
116
117
|
- lib/cloudstack_client/cli.rb
|