vmpooler 0.14.1 → 0.14.2

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
  SHA256:
3
- metadata.gz: 3a97df538d5070e9eb9854084473c50efdd3b18427dc6909e6bfadaeea0f329e
4
- data.tar.gz: 930c7c450fcee1429d18a8b72a48cd9c199d659bdb430a5ef5933eb6911cc1ca
3
+ metadata.gz: 2b0e071edb016f25c0379ebc2d7768e945096333d9be2f1f31ce66fc32474fd1
4
+ data.tar.gz: 1bbac7250090c48a74bf671d316cb9aa45d1dc55af1f69351e9afd27f7c4ed9d
5
5
  SHA512:
6
- metadata.gz: a9706740f3aca1a51fecc17550a1d75275849148c658622ca05f9f177dd1bfd8e84ba681701c9074215057e65854026395e765d5b346305772f572a4f6bf6a9e
7
- data.tar.gz: e1e8f8687342676d40d75c5771b62a28b8f865208882d8ae0d7f0548f218cc6134cce5e53190c46197d56892eda687e1798a5e7c91f35b27510fa84bd9eb1f68
6
+ metadata.gz: 21bc1b2a3c83e82a2e4f3ad6f54a41a380a76a331ca8613b49acf0f7cd2df6ff69162e600f7d449e482e110d1ac7e3e5d9534cd1479d990dd4ff4f8c2c079b74
7
+ data.tar.gz: 109ae1cbfa75cc80a3afff19938677856f9ac0fd858cb546d6ea42b8dbbddf515cad3cdb6cfcb340addbe863c5ee1fc9c4025704bdb298584a7ab8696dd27de9
@@ -150,8 +150,11 @@ module Vmpooler
150
150
  redis.pipelined do
151
151
  redis.hset("vmpooler__active__#{pool}", vm, Time.now)
152
152
  redis.hset("vmpooler__vm__#{vm}", 'checkout', Time.now)
153
- redis.hset("vmpooler__vm__#{vm}", 'token:token', ondemandrequest_hash['token:token']) if ondemandrequest_hash['token:token']
154
- redis.hset("vmpooler__vm__#{vm}", 'token:user', ondemandrequest_hash['token:user']) if ondemandrequest_hash['token:user']
153
+ if ondemandrequest_hash['token:token']
154
+ redis.hset("vmpooler__vm__#{vm}", 'token:token', ondemandrequest_hash['token:token'])
155
+ redis.hset("vmpooler__vm__#{vm}", 'token:user', ondemandrequest_hash['token:user'])
156
+ redis.hset("vmpooler__vm__#{vm}", 'lifetime', $config[:config]['vm_lifetime_auth'].to_i)
157
+ end
155
158
  redis.sadd("vmpooler__#{request_id}__#{pool_alias}__#{pool}", vm)
156
159
  end
157
160
  move_vm_queue(pool, vm, 'pending', 'running', redis)
@@ -536,15 +539,14 @@ module Vmpooler
536
539
  def purge_unused_vms_and_folders
537
540
  global_purge = $config[:config]['purge_unconfigured_folders']
538
541
  providers = $config[:providers].keys
539
- providers.each do |provider|
540
- provider_purge = $config[:providers][provider]['purge_unconfigured_folders']
541
- provider_purge = global_purge if provider_purge.nil?
542
+ providers.each do |provider_key|
543
+ provider_purge = $config[:providers][provider_key]['purge_unconfigured_folders'] || global_purge
542
544
  if provider_purge
543
545
  Thread.new do
544
546
  begin
545
- purge_vms_and_folders($providers[provider.to_s])
547
+ purge_vms_and_folders(provider_key)
546
548
  rescue StandardError => e
547
- $logger.log('s', "[!] failed while purging provider #{provider} VMs and folders with an error: #{e}")
549
+ $logger.log('s', "[!] failed while purging provider #{provider_key} VMs and folders with an error: #{e}")
548
550
  end
549
551
  end
550
552
  end
@@ -553,14 +555,13 @@ module Vmpooler
553
555
  end
554
556
 
555
557
  # Return a list of pool folders
556
- def pool_folders(provider)
557
- provider_name = provider.name
558
+ def pool_folders(provider_name)
558
559
  folders = {}
559
560
  $config[:pools].each do |pool|
560
- next unless pool['provider'] == provider_name
561
+ next unless pool['provider'] == provider_name.to_s
561
562
 
562
563
  folder_parts = pool['folder'].split('/')
563
- datacenter = provider.get_target_datacenter_from_config(pool['name'])
564
+ datacenter = $providers[provider_name.to_s].get_target_datacenter_from_config(pool['name'])
564
565
  folders[folder_parts.pop] = "#{datacenter}/vm/#{folder_parts.join('/')}"
565
566
  end
566
567
  folders
@@ -574,8 +575,9 @@ module Vmpooler
574
575
  base.uniq
575
576
  end
576
577
 
577
- def purge_vms_and_folders(provider)
578
- configured_folders = pool_folders(provider)
578
+ def purge_vms_and_folders(provider_name)
579
+ provider = $providers[provider_name.to_s]
580
+ configured_folders = pool_folders(provider_name)
579
581
  base_folders = get_base_folders(configured_folders)
580
582
  whitelist = provider.provider_config['folder_whitelist']
581
583
  provider.purge_unconfigured_folders(base_folders, configured_folders, whitelist)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vmpooler
4
- VERSION = '0.14.1'
4
+ VERSION = '0.14.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmpooler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pickup