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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c717a0dab3ed2016549deae5d529b9da29b1f083
4
- data.tar.gz: 13c959b12cbc809503910b5bfd97e910ab166946
3
+ metadata.gz: 908b77c3fa4065282abe3a2ef5f2a48952618919
4
+ data.tar.gz: dcf47dca5f020ff59b9d7048f3158b847bf2e37b
5
5
  SHA512:
6
- metadata.gz: c22640516a49e62f7346de350219097d9f155789435d9928b09c50c52e80bbf40584a42c3407516ca37a489862335657df6625214c18d857c459f30f846264a3
7
- data.tar.gz: 61e750a05e16187411fb5b26bf26e5f363a5b2728f0442ccb4aa5b73a663f6465d084fd3320efdf038764852f5a982e9d11ad01f59721609df9c179ec031cbb6
6
+ metadata.gz: c8a64dbb06a0130f92c03e368296ddf9f6e6b9cc351668b8f6471c813d30cc0378fd060fc4e7b5d71e081f188f4c27ad66044bb89fb34d73e07c34c08aeae09f
7
+ data.tar.gz: 61f29d0710140c0dbcdd73c2ea78e63caac9b641611fbc82ac812c61261c25f5486934b6aa21704b6e9185ba9621cd47ff25c8389408d079d4dd4b6e5e8d3d93
Binary file
@@ -3,9 +3,20 @@ require "msgpack"
3
3
  module CloudstackClient
4
4
  class Api
5
5
 
6
- DEFAULT_API_VERSION = "4.2"
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
- @api_file = File.expand_path("../../../config/#{@api_version}.msgpack", __FILE__)
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
- puts "cloudstack_client version #{CloudstackClient::VERSION}"
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: client.instance_eval('binding')
87
+ Ripl.start binding: cs_client.instance_eval('binding')
79
88
  end
80
89
 
81
90
  no_commands do
@@ -1,3 +1,4 @@
1
+ require "cloudstack_client/version"
1
2
  require "cloudstack_client/api"
2
3
  require "cloudstack_client/error"
3
4
  require "cloudstack_client/utils"
@@ -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']}). #{data['jobresult']}."
108
+ raise JobError, "Request failed (#{data['jobresultcode']}): #{data['jobresult']['errortext']}."
109
109
  end
110
110
 
111
111
  STDOUT.flush if @verbose
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
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: 1.0.3
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-05-04 00:00:00.000000000 Z
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