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 +4 -4
- data/lib/vmpooler/pool_manager.rb +15 -13
- data/lib/vmpooler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b0e071edb016f25c0379ebc2d7768e945096333d9be2f1f31ce66fc32474fd1
|
4
|
+
data.tar.gz: 1bbac7250090c48a74bf671d316cb9aa45d1dc55af1f69351e9afd27f7c4ed9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
154
|
-
|
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 |
|
540
|
-
provider_purge = $config[:providers][
|
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(
|
547
|
+
purge_vms_and_folders(provider_key)
|
546
548
|
rescue StandardError => e
|
547
|
-
$logger.log('s', "[!] failed while purging provider #{
|
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(
|
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 =
|
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(
|
578
|
-
|
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)
|
data/lib/vmpooler/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pickup
|