kitchen-vmpool 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kitchen-vmpool.gemspec +1 -1
- data/lib/kitchen/driver/vmpool.rb +13 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba43fce6af2f6b5d3e8169ce88c85b23264cf443
|
4
|
+
data.tar.gz: 47cfe3bc7f7d189cbe64a9208d0e21fcb06a42d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc037d0dfb9125d2ebaba3d776e17b8ff8ac5954358e2e5e90f1d17ec0d827ba7eb7eacdb1b06a145482c1c4421b89dc408468a64971ae02a33cdb6ddaf31e2c
|
7
|
+
data.tar.gz: ccc435a6f48212d3b3cfc8cf6d743aacca971d134900d2dbe20b25aabb684a3ca42fb2f5be94c681592af68ea0d19149c6ba2d716e9472cf1280b8a8adba2cb8
|
data/kitchen-vmpool.gemspec
CHANGED
@@ -22,15 +22,18 @@ require "kitchen/version"
|
|
22
22
|
require 'kitchen/driver/base'
|
23
23
|
module Kitchen
|
24
24
|
module Driver
|
25
|
+
|
26
|
+
class PoolMemberNotFound < Exception; end
|
27
|
+
|
25
28
|
class Vmpool < Kitchen::Driver::Base
|
26
|
-
plugin_version "0.1.
|
29
|
+
plugin_version "0.1.1"
|
27
30
|
|
28
31
|
default_config :pool_name, 'pool1'
|
29
32
|
default_config :pool_file, 'vmpool.yaml'
|
30
33
|
default_config :state_store, 'file'
|
31
34
|
default_config :store_options, {}
|
32
|
-
|
33
|
-
|
35
|
+
default_config :reuse_instances, false
|
36
|
+
default_config :create_command, nil
|
34
37
|
default_config :destroy_command, nil
|
35
38
|
|
36
39
|
no_parallel_for :create, :destroy
|
@@ -52,6 +55,7 @@ module Kitchen
|
|
52
55
|
# @return [String] - a random host from the list of systems
|
53
56
|
def pool_member
|
54
57
|
sample = pool_hosts.sample
|
58
|
+
raise PoolMemberNotFound.new("No pool members exist for #{config[:pool_name]}, please create some pool members") unless sample
|
55
59
|
member = pool_hosts.delete(sample)
|
56
60
|
mark_used(member)
|
57
61
|
return member
|
@@ -76,7 +80,11 @@ module Kitchen
|
|
76
80
|
|
77
81
|
# @return Array[String] - a list of host names in the pool
|
78
82
|
def pool_hosts
|
79
|
-
|
83
|
+
if config[:reuse_instances]
|
84
|
+
pool['pool_instances'] + pool['used_instances'].to_a
|
85
|
+
else
|
86
|
+
pool['pool_instances']
|
87
|
+
end
|
80
88
|
end
|
81
89
|
|
82
90
|
# @param name [String] - the hostname to mark not used
|
@@ -106,7 +114,7 @@ module Kitchen
|
|
106
114
|
klass = Object.const_get("Kitchen::Driver::VmpoolStores::#{store}")
|
107
115
|
# create a new instance of the store with the provided options
|
108
116
|
store_opts = config[:store_options]
|
109
|
-
# convert everything key to strings
|
117
|
+
# convert everything key to strings
|
110
118
|
store_opts.tap do |h|
|
111
119
|
h.keys.each { |k| h[k.to_s] = h.delete(k) }
|
112
120
|
end
|