kitchen-vmpool 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/kitchen-vmpool/version.rb +1 -1
- data/lib/kitchen/driver/vmpool_stores/file_base_store.rb +17 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1e59ffbabc5a41955d430e1773dc01a14a6647b
|
4
|
+
data.tar.gz: 6bd5deaa4b6e9a570883f06fc1f0f4de4695fecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2896cefb67f74121f15d394a7d89b33393f895382968b6e284979b2d3063e05257a71c87a0c76b7609967c67715518b3b9593ea3bda0074a1aa6167bcd8b2a27
|
7
|
+
data.tar.gz: ddaf01bd4cbfd0a32bcfb2bdec312ba3fb5cb92d0108b85f88580829fda70b2cca61d66ffa45d37b32b26e9a59a51fc1c21da65b4bb7bff1e957c9f1490cde8d
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,11 +23,13 @@ module Kitchen
|
|
23
23
|
# @param pool_name [String] a VM pool
|
24
24
|
# @param reuse_instances [Boolean] whether or not to mark used VM instances as unused
|
25
25
|
def cleanup(pool_member:, pool_name:, reuse_instances:)
|
26
|
-
used_status = '
|
27
|
-
|
26
|
+
used_status = 'garbage'
|
28
27
|
if reuse_instances
|
29
28
|
mark_unused(pool_member, pool_name)
|
30
29
|
used_status = 'unused'
|
30
|
+
else
|
31
|
+
used_hosts(pool_name).delete(pool_member)
|
32
|
+
add_to_garbage(pool_member, pool_name)
|
31
33
|
end
|
32
34
|
yield(pool_member, used_status) if block_given?
|
33
35
|
end
|
@@ -38,19 +40,16 @@ module Kitchen
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def update(content = nil)
|
41
|
-
#info("Updating vmpool data")
|
42
43
|
write_content(content)
|
43
44
|
read
|
44
45
|
end
|
45
46
|
|
46
47
|
def create
|
47
|
-
#info("Creating new vmpool data")
|
48
48
|
write_content(base_content)
|
49
49
|
read
|
50
50
|
end
|
51
51
|
|
52
52
|
def read
|
53
|
-
#info("Reading vmpool data")
|
54
53
|
read_content
|
55
54
|
end
|
56
55
|
|
@@ -59,13 +58,21 @@ module Kitchen
|
|
59
58
|
end
|
60
59
|
|
61
60
|
def save
|
62
|
-
#info("Saving vmpool data")
|
63
61
|
write_content
|
64
62
|
read
|
65
63
|
end
|
66
64
|
|
67
65
|
private
|
68
66
|
|
67
|
+
# @param pool_member [String]
|
68
|
+
# @return Array[String] - list of instances in the garbage
|
69
|
+
def add_to_garbage(pool_member, pool_name)
|
70
|
+
return if garbage_hosts(pool_name).include?(pool_member)
|
71
|
+
garbage_hosts(pool_name) << pool_member
|
72
|
+
save
|
73
|
+
garbage_hosts(pool_name)
|
74
|
+
end
|
75
|
+
|
69
76
|
# @param name [String] - the hostname to mark used
|
70
77
|
# @return Array[String] - list of used instances
|
71
78
|
def mark_used(name, pool_name)
|
@@ -86,7 +93,6 @@ module Kitchen
|
|
86
93
|
pool_hosts(pool_name)
|
87
94
|
end
|
88
95
|
|
89
|
-
|
90
96
|
# @return Array[String] - a list of pool names
|
91
97
|
def pool_names
|
92
98
|
pool_data.keys
|
@@ -108,6 +114,10 @@ module Kitchen
|
|
108
114
|
pool(pool_name)['pool_instances'] ||= []
|
109
115
|
end
|
110
116
|
|
117
|
+
def garbage_hosts(pool_name)
|
118
|
+
pool(pool_name)['garbage_collection'] ||= []
|
119
|
+
end
|
120
|
+
|
111
121
|
# @return Array[String] - a list of used host names in the pool
|
112
122
|
def used_hosts(pool_name)
|
113
123
|
pool(pool_name)['used_instances'] ||= []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-vmpool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|