opennebula-cli 4.9.80.beta → 4.10.0

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: 751cd526db8f21c281fd935cef7f1be0b5aec0ce
4
- data.tar.gz: ec2aa2b08bb3f73ad0ee15262a4ac3e51d9727d8
3
+ metadata.gz: 05fa308b8f2c58298b60be958f695dccc82e6c36
4
+ data.tar.gz: 395c2eb2342e174591e5ebeac94fd4e858c261f9
5
5
  SHA512:
6
- metadata.gz: acb5b7a32bb0a16c1acc42844a4e14c57a54ef518caa0d6d1e25c55cd70dfffa5dd14d8cc0b45aeb685ff85a168527a70bb2cbdc0efe6aee48d19e3183ae4d91
7
- data.tar.gz: 0ceb58e0181f649b89f6c858a1da819e214699b94b9cccbc201ee834196525d59409baccb4f612cc9aaf4c7162be31f8901c439ccf8068d3d1fa84bf70c5d861
6
+ metadata.gz: b953cd8e8fd60c8ede738615546e3837e492573c0c6a954e5e409b84549ad5fc62afe7fb89c540e5e601d263aa4efdddad2129f8b28935513f7c9af13e1d4be6
7
+ data.tar.gz: b4424db533f4082e05d52beefdb45a79a423590234a66905edcf9b8c5b42550abf7731a89deb1e131cee6f8460263b112560533bb4510a35a736ccc55a87dafa
data/bin/onetemplate CHANGED
@@ -196,7 +196,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
196
196
  on_hold = options[:hold] != nil
197
197
 
198
198
  extra_template = ""
199
- t.info
199
+ rc = t.info
200
+
201
+ if OpenNebula.is_error?(rc)
202
+ STDERR.puts rc.message
203
+ exit(-1)
204
+ end
200
205
 
201
206
  if args[1]
202
207
  extra_template = File.read(args[1])
data/bin/onevcenter CHANGED
File without changes
data/bin/onevnet CHANGED
@@ -112,43 +112,49 @@ cmd=CommandParser::CmdParser.new(ARGV) do
112
112
  Adds an address range to the Virtual Network
113
113
  EOT
114
114
 
115
- command :addar, addar_desc, :vnetid,
115
+ command :addar, addar_desc, :vnetid, [:file, nil],
116
116
  :options => STD_OPTIONS + OneVNetHelper::ADDAR_OPTIONS do
117
117
  helper.perform_action(args[0],options,"lease added") do |vn|
118
- ar = "AR = [ "
119
-
120
- if options[:ip]
121
- if options[:ip6_global] || options[:ip6_ula]
122
- ar << "TYPE=\"IP4_6\""
118
+ if args[1]
119
+ ar = File.read(args[1])
120
+ else
121
+ ar = "AR = [ "
122
+
123
+ if options[:ip]
124
+ if options[:ip6_global] || options[:ip6_ula]
125
+ ar << "TYPE=\"IP4_6\""
126
+ else
127
+ ar << "TYPE=\"IP4\""
128
+ end
123
129
  else
124
- ar << "TYPE=\"IP4\""
130
+ if options[:ip6_global] || options[:ip6_ula]
131
+ ar << "TYPE=\"IP6\""
132
+ else
133
+ ar << "TYPE=\"ETHER\""
134
+ end
125
135
  end
126
- else
127
- if options[:ip6_global] || options[:ip6_ula]
128
- ar << "TYPE=\"IP6\""
136
+
137
+ if options[:size]
138
+ ar << ", SIZE = " << options[:size]
129
139
  else
130
- ar << "TYPE=\"ETHER\""
140
+ STDERR.puts "Address range needs to specify size (-s size)"
141
+ exit -1
131
142
  end
132
- end
133
143
 
134
- if options[:size]
135
- ar << ", SIZE = " << options[:size]
136
- else
137
- STDERR.puts "Address range needs to specify size (-s size)"
138
- exit -1
144
+ ar << ", IP = " << options[:ip] if options[:ip]
145
+ ar << ", MAC = " << options[:mac] if options[:mac]
146
+ ar << ", GLOBAL_PREFIX = " <<
147
+ options[:ip6_global] if options[:ip6_global]
148
+ ar << ", ULA_PREFIX = " <<
149
+ options[:ip6_ula] if options[:ip6_ula]
150
+ ar << ", GATEWAY = " << options[:gateway] if options[:gateway]
151
+ ar << ", MASK = " << options[:netmask] if options[:netmask]
152
+ ar << ", VLAN = YES" if options[:vlan]
153
+ ar << ", VLAN_ID = " << options[:vlanid] if options[:vlanid]
154
+
155
+ ar << "]"
139
156
  end
140
157
 
141
- ar << ", IP = " << options[:ip] if options[:ip]
142
- ar << ", MAC = " << options[:mac] if options[:mac]
143
- ar << ", GLOBAL_PREFIX = " << options[:ip6_global] if options[:ip6_global]
144
- ar << ", ULA_PREFIX = " << options[:ip6_ula] if options[:ip6_ula]
145
- ar << ", GATEWAY = " << options[:gateway] if options[:gateway]
146
- ar << ", MASK = " << options[:netmask] if options[:netmask]
147
- ar << ", VLAN = YES" if options[:vlan]
148
- ar << ", VLAN_ID = " << options[:vlanid] if options[:vlanid]
149
-
150
- ar << "]"
151
-
152
158
  vn.add_ar(ar)
153
159
  end
154
160
  end
@@ -299,7 +305,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
299
305
  EOT
300
306
 
301
307
  command :show, show_desc, :vnetid,
302
- :options=>OpenNebulaHelper::XML do
308
+ :options=>[OpenNebulaHelper::XML, OneVNetHelper::SHOW_AR] do
303
309
  helper.show_resource(args[0],options)
304
310
  end
305
311
 
@@ -15,7 +15,6 @@
15
15
  #--------------------------------------------------------------------------- #
16
16
 
17
17
  require 'optparse'
18
- require 'optparse/time'
19
18
  require 'pp'
20
19
 
21
20
  class String
@@ -29,17 +28,6 @@ class String
29
28
  end
30
29
  end
31
30
 
32
- if RUBY_VERSION > '1.8.7'
33
- OptionParser.accept(Time) do |s,|
34
- begin
35
- (Time.strptime(s, "%m/%d/%Y %H:%M:%S")) if s
36
- rescue
37
- raise OptionParser::InvalidArgument, s
38
- end
39
- end
40
- end
41
-
42
-
43
31
  module CommandParser
44
32
  OPTIONS = [
45
33
  VERBOSE={
data/lib/one_helper.rb CHANGED
@@ -370,7 +370,7 @@ EOT
370
370
  endpoint=options[:endpoint]
371
371
  end
372
372
 
373
- @@client=OpenNebula::Client.new(secret, endpoint)
373
+ @@client=OpenNebula::Client.new(secret, endpoint, :sync => true)
374
374
  end
375
375
  end
376
376
 
@@ -15,6 +15,7 @@
15
15
  #--------------------------------------------------------------------------- #
16
16
 
17
17
  require 'one_helper'
18
+ require 'optparse/time'
18
19
 
19
20
  class AcctHelper < OpenNebulaHelper::OneHelper
20
21
  START_TIME = {
@@ -163,7 +163,9 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
163
163
  # authentication token for the user
164
164
  #-----------------------------------------------------------------------
165
165
  token = auth.login_token(username, options[:time])
166
- login_client = OpenNebula::Client.new("#{username}:#{token}")
166
+ login_client = OpenNebula::Client.new("#{username}:#{token}",
167
+ nil,
168
+ :sync => true)
167
169
 
168
170
  user = OpenNebula::User.new(User.build_xml, login_client)
169
171
 
@@ -15,6 +15,7 @@
15
15
  #--------------------------------------------------------------------------- #
16
16
 
17
17
  require 'one_helper'
18
+ require 'optparse/time'
18
19
 
19
20
  class OneVMHelper < OpenNebulaHelper::OneHelper
20
21
  MULTIPLE={
@@ -26,6 +26,12 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
26
26
  :description => "ID of the address range"
27
27
  }
28
28
 
29
+ SHOW_AR = {
30
+ :name => "show_ar",
31
+ :large => "--show-ar",
32
+ :description => "Show also AR templates"
33
+ }
34
+
29
35
  MAC = {
30
36
  :name => "mac",
31
37
  :short => "-m mac",
@@ -163,6 +169,19 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
163
169
  table
164
170
  end
165
171
 
172
+ def show_ar(vn, ar_id)
173
+ CLIHelper.print_header("%-80s" % ["TEMPLATE FOR AR #{ar_id}"], false)
174
+
175
+ begin
176
+ template = vn.template_like_str("AR_POOL/AR[AR_ID=#{ar_id}]")
177
+ rescue
178
+ STDERR.puts "Can not get template for AR #{ar_id}"
179
+ return
180
+ end
181
+
182
+ puts template
183
+ end
184
+
166
185
  private
167
186
 
168
187
  def factory(id=nil)
@@ -179,6 +198,8 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
179
198
  end
180
199
 
181
200
  def format_resource(vn, options = {})
201
+ vn_hash = vn.to_hash
202
+
182
203
  str_h1="%-80s"
183
204
  CLIHelper.print_header(str_h1 %
184
205
  ["VIRTUAL NETWORK #{vn.id.to_s} INFORMATION"])
@@ -217,8 +238,8 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
217
238
 
218
239
  CLIHelper.print_header(str_h1 % ["ADDRESS RANGE POOL"], false)
219
240
 
220
- if !vn.to_hash['VNET']['AR_POOL']['AR'].nil?
221
- arlist = [vn.to_hash['VNET']['AR_POOL']['AR']].flatten
241
+ if !vn_hash['VNET']['AR_POOL']['AR'].nil?
242
+ arlist = [vn_hash['VNET']['AR_POOL']['AR']].flatten
222
243
  end
223
244
 
224
245
  CLIHelper::ShowTable.new(nil, self) do
@@ -255,12 +276,16 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
255
276
  puts
256
277
  CLIHelper.print_header(str_h1 % ["LEASES"], false)
257
278
 
258
- if !vn.to_hash['VNET']['AR_POOL']['AR'].nil?
259
- lease_list = [vn.to_hash['VNET']['AR_POOL']['AR']].flatten
279
+ ar_list = []
280
+
281
+ if !vn_hash['VNET']['AR_POOL']['AR'].nil?
282
+ lease_list = [vn_hash['VNET']['AR_POOL']['AR']].flatten
260
283
  leases = Array.new
261
284
 
262
285
  lease_list.each do |ar|
263
286
  id = ar['AR_ID']
287
+ ar_list << id
288
+
264
289
  if ar['LEASES'] && !ar['LEASES']['LEASE'].nil?
265
290
  lease = [ar['LEASES']['LEASE']].flatten
266
291
  lease.each do |l|
@@ -294,9 +319,16 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
294
319
  d["IP"]||"-"
295
320
  end
296
321
 
297
- column :IP6_GLOBAL, "", :size=>31 do |d|
322
+ column :IP6_GLOBAL, "", :donottruncate, :size=>31 do |d|
298
323
  d["IP6_GLOBAL"]||"-"
299
324
  end
300
325
  end.show(leases, {})
326
+
327
+ if options[:show_ar]
328
+ ar_list.each do |ar_id|
329
+ puts
330
+ show_ar(vn, ar_id)
331
+ end
332
+ end
301
333
  end
302
334
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.80.beta
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2014-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.9.80.beta
19
+ version: 4.10.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.9.80.beta
26
+ version: 4.10.0
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.org
29
29
  executables:
@@ -79,7 +79,8 @@ files:
79
79
  - lib/one_helper/onevnet_helper.rb
80
80
  - lib/one_helper/onezone_helper.rb
81
81
  homepage: http://opennebula.org
82
- licenses: []
82
+ licenses:
83
+ - Apache-2.0
83
84
  metadata: {}
84
85
  post_install_message:
85
86
  rdoc_options: []
@@ -92,9 +93,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  requirements:
95
- - - ">"
96
+ - - ">="
96
97
  - !ruby/object:Gem::Version
97
- version: 1.3.1
98
+ version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
101
  rubygems_version: 2.2.2