opennebula-cli 5.11.90.pre → 5.12.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,6 @@
13
13
  # See the License for the specific language governing permissions and #
14
14
  # limitations under the License. #
15
15
  #--------------------------------------------------------------------------- #
16
-
17
16
  require 'one_helper'
18
17
  require 'one_helper/onevm_helper'
19
18
 
@@ -215,6 +214,71 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
215
214
  orphans
216
215
  end
217
216
 
217
+ # Update VNet address range
218
+ #
219
+ # @param vnet_id [Intenger] Virtual Network ID
220
+ # @param ar_id [Intenger] Address Range ID
221
+ # @param file [String] Path to file to read
222
+ # @param options [Hash] User CLI options
223
+ def update_ar(vnet_id, ar_id, file, options)
224
+ perform_action(vnet_id, options, 'AR updated') do |obj|
225
+ rc = obj.info
226
+
227
+ if OpenNebula.is_error?(rc)
228
+ STDERR.puts rc.message
229
+ exit(-1)
230
+ end
231
+
232
+ obj.delete_element("AR_POOL/AR[AR_ID!=#{ar_id}]")
233
+ obj.delete_element('AR_POOL/AR/LEASES')
234
+ obj.delete_element('AR_POOL/AR/USED_LEASES')
235
+ obj.delete_element('AR_POOL/AR/MAC_END')
236
+ obj.delete_element('AR_POOL/AR/IP_END')
237
+ obj.delete_element('AR_POOL/AR/IP6_ULA')
238
+ obj.delete_element('AR_POOL/AR/IP6_ULA_END')
239
+ obj.delete_element('AR_POOL/AR/IP6_GLOBAL')
240
+ obj.delete_element('AR_POOL/AR/IP6_GLOBAL_END')
241
+
242
+ if obj.template_like_str('AR_POOL').empty?
243
+ STDERR.puts "Address Range #{ar_id} does not exist for " \
244
+ "Virtual Network #{vnet_id}"
245
+ exit(-1)
246
+ end
247
+
248
+ xpath = "AR_POOL/AR[AR_ID=#{ar_id}]"
249
+
250
+ if options[:append]
251
+ str = OpenNebulaHelper.append_template(vnet_id,
252
+ obj,
253
+ file,
254
+ xpath)
255
+ else
256
+ str = OpenNebulaHelper.update_template(vnet_id,
257
+ obj,
258
+ file,
259
+ xpath)
260
+ end
261
+
262
+ if options[:append]
263
+ # Insert element in current template
264
+ parts = obj.template_like_str('AR_POOL').split("\n")
265
+
266
+ # Insert it in second position, OpenNebula will sort it
267
+ parts.insert(1, "#{str.strip},")
268
+
269
+ parts = parts.join("\n")
270
+ str = parts
271
+ else
272
+ # Use the information from user
273
+ unless str.gsub(' ', '').match(/AR=\[/)
274
+ str = "AR=[\n#{str.split("\n").join(",\n")}]"
275
+ end
276
+ end
277
+
278
+ obj.update_ar(str)
279
+ end
280
+ end
281
+
218
282
  private
219
283
 
220
284
  def factory(id=nil)
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: 5.11.90.pre
4
+ version: 5.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-01 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,18 +16,19 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.11.90.pre
19
+ version: 5.12.3
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: 5.11.90.pre
26
+ version: 5.12.3
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.io
29
29
  executables:
30
30
  - oneacct
31
+ - onevcenter
31
32
  - oneacl
32
33
  - onecluster
33
34
  - onedatastore
@@ -43,7 +44,6 @@ executables:
43
44
  - oneshowback
44
45
  - onetemplate
45
46
  - oneuser
46
- - onevcenter
47
47
  - onevdc
48
48
  - onevm
49
49
  - onevmgroup
@@ -55,6 +55,7 @@ extensions: []
55
55
  extra_rdoc_files: []
56
56
  files:
57
57
  - bin/oneacct
58
+ - bin/onevcenter
58
59
  - bin/oneacl
59
60
  - bin/onecluster
60
61
  - bin/onedatastore
@@ -70,7 +71,6 @@ files:
70
71
  - bin/oneshowback
71
72
  - bin/onetemplate
72
73
  - bin/oneuser
73
- - bin/onevcenter
74
74
  - bin/onevdc
75
75
  - bin/onevm
76
76
  - bin/onevmgroup
@@ -81,19 +81,15 @@ files:
81
81
  - lib/cli_helper.rb
82
82
  - lib/command_parser.rb
83
83
  - lib/one_helper.rb
84
- - lib/one_helper/oneacct_helper.rb
85
84
  - lib/one_helper/oneacl_helper.rb
86
85
  - lib/one_helper/onecluster_helper.rb
87
86
  - lib/one_helper/onedatastore_helper.rb
88
- - lib/one_helper/oneflow_helper.rb
89
- - lib/one_helper/oneflowtemplate_helper.rb
90
87
  - lib/one_helper/onegroup_helper.rb
91
88
  - lib/one_helper/onehook_helper.rb
92
89
  - lib/one_helper/onehost_helper.rb
93
90
  - lib/one_helper/oneimage_helper.rb
94
91
  - lib/one_helper/onemarket_helper.rb
95
92
  - lib/one_helper/onemarketapp_helper.rb
96
- - lib/one_helper/oneprovision_helper.rb
97
93
  - lib/one_helper/onequota_helper.rb
98
94
  - lib/one_helper/onesecgroup_helper.rb
99
95
  - lib/one_helper/onetemplate_helper.rb
@@ -106,6 +102,10 @@ files:
106
102
  - lib/one_helper/onevntemplate_helper.rb
107
103
  - lib/one_helper/onevrouter_helper.rb
108
104
  - lib/one_helper/onezone_helper.rb
105
+ - lib/one_helper/oneacct_helper.rb
106
+ - lib/one_helper/oneflow_helper.rb
107
+ - lib/one_helper/oneflowtemplate_helper.rb
108
+ - lib/one_helper/oneprovision_helper.rb
109
109
  - NOTICE
110
110
  - LICENSE
111
111
  homepage: http://opennebula.io
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - '>'
126
+ - - '>='
127
127
  - !ruby/object:Gem::Version
128
- version: 1.3.1
128
+ version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
131
  rubygems_version: 2.0.14.1