opennebula-cli 5.7.90.pre → 5.8.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: 140ee7b9d1fe1f1f0398855476b9725fa3504d83
4
- data.tar.gz: f8e03bfed912972e084abcc72d133474b8aedc52
3
+ metadata.gz: fe049a40201dabb3ab6af5af5a94dfe86c3bd260
4
+ data.tar.gz: 26e453a1dbc3b0501da198b80a481d4fa6c5a99a
5
5
  SHA512:
6
- metadata.gz: b838c7dbba2a7edc7277630fa870ab72fc9fa140b8e6378cb62afe6c4a1984f95f0679d7560c961216e24b274f6ebb6323c84e79bc5b7862b093055a7467a36e
7
- data.tar.gz: c81ef184f9e28f34f1c1e86dfb621edcbfa41d6e2d3044759cdbac5f5c08b38feacd91a202a58a4b453c111da966b10868a8422ef19a3aae0f33c22645b8a251
6
+ metadata.gz: 910e873ea0a7024ef4eaa70c6247b7c09c2a92c2e1e04b726eea74ab1cf5700e0f522c9c84d576f8d97b7c79d5c859e071d2abac46294b9488dda866fbed1a4d
7
+ data.tar.gz: bf953b9791f13555de9ee1818f92fb429859c391d510ff1fb614d22dbfc3cbd430c3b2222055770c04441ffd428a49d40eb73bdc9e9a1a19a3bba7ba09dcb2de
data/NOTICE CHANGED
@@ -1,6 +1,6 @@
1
1
  OpenNebula Open Source Project
2
2
  --------------------------------------------------------------------------------
3
- Copyright 2002-2018, OpenNebula Project, OpenNebula Systems (formerly C12G Labs)
3
+ Copyright 2002-2019, OpenNebula Project, OpenNebula Systems (formerly C12G Labs)
4
4
  --------------------------------------------------------------------------------
5
5
 
6
6
  You can find more information about the project, release notes and
@@ -363,8 +363,10 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
363
363
  sync_cmd = "rsync -Laz --delete #{REMOTES_LOCATION}" \
364
364
  " #{host['NAME']}:#{remote_dir}"
365
365
  else
366
- sync_cmd = "scp -rp #{REMOTES_LOCATION}/. " \
367
- "#{host['NAME']}:#{remote_dir} 2> /dev/null"
366
+ sync_cmd = "ssh #{host['NAME']}" \
367
+ " mkdir -p '#{remote_dir}' 2>/dev/null &&" \
368
+ " scp -rp #{REMOTES_LOCATION}/*" \
369
+ " #{host['NAME']}:#{remote_dir} 2> /dev/null"
368
370
  end
369
371
 
370
372
  `#{sync_cmd} 2>/dev/null`
@@ -85,47 +85,103 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
85
85
  provision.create(config)
86
86
  end
87
87
 
88
- def configure(provision_id, options)
88
+ def configure(provision_id, force)
89
89
  provision = OneProvision::Provision.new(provision_id)
90
90
 
91
91
  provision.refresh
92
92
 
93
- provision.configure((options.key? :force))
93
+ provision.configure(force)
94
94
  end
95
95
 
96
- def delete(provision_id)
96
+ def delete(provision_id, cleanup)
97
97
  provision = OneProvision::Provision.new(provision_id)
98
98
 
99
99
  provision.refresh
100
100
 
101
- provision.delete
101
+ provision.delete(cleanup)
102
102
  end
103
103
 
104
104
  #######################################################################
105
105
  # Helper host functions
106
106
  #######################################################################
107
107
 
108
- def hosts_operation(hosts, operation, options)
108
+ def host_operation(host, operation, options, args)
109
+ host = OneProvision::Host.new(host['ID'])
110
+
111
+ case operation[:operation]
112
+ when 'resume'
113
+ host.resume
114
+ when 'poweroff'
115
+ host.poweroff
116
+ when 'reboot'
117
+ host.reboot((options.key? :hard))
118
+ when 'delete'
119
+ host.delete
120
+ when 'configure'
121
+ host.configure((options.key? :force))
122
+ when 'ssh'
123
+ host.ssh(args)
124
+ end
125
+ end
126
+
127
+ #######################################################################
128
+ # Helper datastore functions
129
+ #######################################################################
130
+
131
+ def datastore_operation(datastore, operation)
132
+ case operation[:operation]
133
+ when 'delete'
134
+ msg = "Deleting datastore #{datastore['ID']}"
135
+
136
+ OneProvision::OneProvisionLogger.info(msg)
137
+
138
+ datastore.delete
139
+ end
140
+ end
141
+
142
+ #######################################################################
143
+ # Helper vnet functions
144
+ #######################################################################
145
+
146
+ def vnet_operation(vnet, operation)
147
+ case operation[:operation]
148
+ when 'delete'
149
+ msg = "Deleting vnet #{vnet['ID']}"
150
+
151
+ OneProvision::OneProvisionLogger.info(msg)
152
+
153
+ vnet.delete
154
+ end
155
+ end
156
+
157
+ #######################################################################
158
+ # Helper resource functions
159
+ #######################################################################
160
+
161
+ def resources_operation(args, operation, options, type)
109
162
  parse_options(options)
110
163
 
111
- host_helper = OneHostHelper.new
112
- host_helper.set_client(options)
113
- host_helper.perform_actions(hosts,
114
- options,
115
- operation[:message]) do |host|
116
- host = OneProvision::Host.new(host['ID'])
117
-
118
- case operation[:operation]
119
- when 'resume'
120
- host.resume
121
- when 'poweroff'
122
- host.poweroff
123
- when 'reboot'
124
- host.reboot((options.key? :hard))
125
- when 'delete'
126
- host.delete
127
- when 'configure'
128
- host.configure((options.key? :force))
164
+ helper = nil
165
+
166
+ case type
167
+ when 'HOST' then helper = OneHostHelper.new
168
+ when 'DATASTORE' then helper = OneDatastoreHelper.new
169
+ when 'VNET' then helper = OneVNetHelper.new
170
+ end
171
+
172
+ objects = names_to_ids(args[0], type)
173
+
174
+ helper.set_client(options)
175
+ helper.perform_actions(objects,
176
+ options,
177
+ operation[:message]) do |obj|
178
+ case type
179
+ when 'HOST' then host_operation(obj,
180
+ operation,
181
+ options,
182
+ args[1])
183
+ when 'DATASTORE' then datastore_operation(obj, operation)
184
+ when 'VNET' then vnet_operation(obj, operation)
129
185
  end
130
186
  end
131
187
  end
@@ -157,6 +213,14 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
157
213
  ids
158
214
  end
159
215
 
216
+ def names_to_ids(objects, type)
217
+ objects = [objects].flatten.map do |obj|
218
+ OpenNebulaHelper.rname_to_id(obj.to_s, type)[1]
219
+ end
220
+
221
+ objects
222
+ end
223
+
160
224
  def get_list(columns, provision_list)
161
225
  ret = []
162
226
  ids = provision_ids
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.7.90.pre
4
+ version: 5.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-12 00:00:00.000000000 Z
11
+ date: 2019-02-26 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: 5.7.90.pre
19
+ version: 5.8.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: 5.7.90.pre
26
+ version: 5.8.0
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.org
29
29
  executables:
@@ -118,9 +118,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>'
121
+ - - '>='
122
122
  - !ruby/object:Gem::Version
123
- version: 1.3.1
123
+ version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
126
  rubygems_version: 2.0.14.1