gogetit 0.20.1 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gogetit/version.rb +1 -1
- data/lib/providers/libvirt.rb +17 -49
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4639acfdbff32bdcaf38e6b7300572aa51191fbaaaa44f4b4c1d37a549c83183
|
|
4
|
+
data.tar.gz: 8323c80277bd0cd70d319a1830859d48662afa83bcf575813349153d48dee8e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d660f035aaf0a9886dac34a75c5b66ed386828d195ce0f44a0a392eb47f9ece4b546ea66897aed59ab7ebf01ded5a23862b8b6aad9cc3f160ef6244f3383649
|
|
7
|
+
data.tar.gz: e2a26f58a34c7dfe821895f58a0c3ccbb1d060b0090b8e90cf0578f0d5b10289a58427ea8e69f607796f6b46e7933704ccf4d7afa0a5313fbe560ea1a4f0523c
|
data/lib/gogetit/version.rb
CHANGED
data/lib/providers/libvirt.rb
CHANGED
|
@@ -192,54 +192,20 @@ module Gogetit
|
|
|
192
192
|
|
|
193
193
|
logger.info("Calling to deploy...")
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
distro = 'bionic'
|
|
197
|
-
else
|
|
198
|
-
distro = options[:distro]
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
maas.conn.request(:post, ['machines', system_id], \
|
|
202
|
-
{'op' => 'deploy', 'distro_series' => distro})
|
|
203
|
-
maas.wait_until_state(system_id, 'Deployed')
|
|
204
|
-
|
|
205
|
-
fqdn = name + '.' + maas.get_domain
|
|
206
|
-
distro_name = maas.get_distro_name(system_id)
|
|
207
|
-
wait_until_available(fqdn, distro_name)
|
|
208
|
-
|
|
209
|
-
# To enable serial console to use 'virsh console'
|
|
210
|
-
if distro_name == 'ubuntu'
|
|
211
|
-
commands = [
|
|
212
|
-
'sudo systemctl enable serial-getty@ttyS0.service',
|
|
213
|
-
'sudo systemctl start serial-getty@ttyS0.service'
|
|
214
|
-
]
|
|
215
|
-
run_through_ssh(fqdn, distro_name, commands)
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
logger.info("#{domain[:name]} has been created.")
|
|
219
|
-
puts "ssh #{distro_name}@#{name}"
|
|
220
|
-
|
|
221
|
-
domain[:default_user] = distro_name
|
|
222
|
-
|
|
223
|
-
{ result: true, info: domain }
|
|
195
|
+
deploy(name, options)
|
|
224
196
|
end
|
|
225
197
|
|
|
226
198
|
def destroy(name)
|
|
227
199
|
logger.info("Calling <#{__method__.to_s}>")
|
|
228
200
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
logger.info("Calling to release...")
|
|
238
|
-
maas.conn.request(:post, ['machines', system_id], {'op' => 'release'})
|
|
239
|
-
maas.wait_until_state(system_id, 'Ready')
|
|
240
|
-
end
|
|
241
|
-
maas.conn.request(:delete, ['machines', system_id])
|
|
242
|
-
end
|
|
201
|
+
info = release(name)[:info]
|
|
202
|
+
maas.conn.request(
|
|
203
|
+
:delete,
|
|
204
|
+
[
|
|
205
|
+
'machines',
|
|
206
|
+
info[:machine]['system_id']
|
|
207
|
+
]
|
|
208
|
+
)
|
|
243
209
|
|
|
244
210
|
pools = []
|
|
245
211
|
conn.list_storage_pools.each do |name|
|
|
@@ -313,18 +279,20 @@ module Gogetit
|
|
|
313
279
|
def release(name)
|
|
314
280
|
logger.info("Calling <#{__method__.to_s}>")
|
|
315
281
|
|
|
282
|
+
abort("Machine #{name} does not exist."\
|
|
283
|
+
" Please check both on MAAS and libvirt.") \
|
|
284
|
+
if not maas.machine_exists?(name)
|
|
285
|
+
|
|
316
286
|
system_id = maas.get_system_id(name)
|
|
317
287
|
|
|
318
288
|
info = {}
|
|
319
289
|
info[:machine] = \
|
|
320
290
|
maas.conn.request(:get, ['machines', system_id])
|
|
321
291
|
|
|
322
|
-
if maas.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
maas.wait_until_state(system_id, 'Ready')
|
|
327
|
-
end
|
|
292
|
+
if maas.get_machine_state(system_id) == 'Deployed'
|
|
293
|
+
logger.info("Calling to release...")
|
|
294
|
+
maas.conn.request(:post, ['machines', system_id], {'op' => 'release'})
|
|
295
|
+
maas.wait_until_state(system_id, 'Ready')
|
|
328
296
|
end
|
|
329
297
|
|
|
330
298
|
logger.info("#{name} has been released.")
|