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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 223de42a595049a562c56526c1e49771e9e1a77e719cad4a723684789696275b
4
- data.tar.gz: a02723085f655b501f07a97366cb7ddce9e336e8eed79ea793159cc3312967b4
3
+ metadata.gz: 4639acfdbff32bdcaf38e6b7300572aa51191fbaaaa44f4b4c1d37a549c83183
4
+ data.tar.gz: 8323c80277bd0cd70d319a1830859d48662afa83bcf575813349153d48dee8e6
5
5
  SHA512:
6
- metadata.gz: 4e2caf0ffa211cd69aacdcbbd4dbbbed37188fefdc6a8736f68bcc46525f8e7397fb9dda8d36513c1150a51dfc33aedbdc87903922032893e940ff9e5a0332ef
7
- data.tar.gz: 199a06a461a5bfa165282bd89cb8fb6f707999a02f89fe9a583196f7d0e222318ee97860aed8bde3edab81d45ac4cd067ffffc6a277b6f844e7fac565c65e40b
6
+ metadata.gz: 0d660f035aaf0a9886dac34a75c5b66ed386828d195ce0f44a0a392eb47f9ece4b546ea66897aed59ab7ebf01ded5a23862b8b6aad9cc3f160ef6244f3383649
7
+ data.tar.gz: e2a26f58a34c7dfe821895f58a0c3ccbb1d060b0090b8e90cf0578f0d5b10289a58427ea8e69f607796f6b46e7933704ccf4d7afa0a5313fbe560ea1a4f0523c
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.20.1"
2
+ VERSION = "0.20.2"
3
3
  end
@@ -192,54 +192,20 @@ module Gogetit
192
192
 
193
193
  logger.info("Calling to deploy...")
194
194
 
195
- if options[:distro].nil? or options[:distro].empty?
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
- system_id = maas.get_system_id(name)
230
-
231
- info = {}
232
- info[:machine] = \
233
- maas.conn.request(:get, ['machines', system_id])
234
-
235
- if maas.machine_exists?(name)
236
- if maas.get_machine_state(system_id) == 'Deployed'
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.machine_exists?(name)
323
- if maas.get_machine_state(system_id) == 'Deployed'
324
- logger.info("Calling to release...")
325
- maas.conn.request(:post, ['machines', system_id], {'op' => 'release'})
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.")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gogetit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Draper