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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a292b2bf0b4134c9da983f663e16acbaa2f9582f
4
- data.tar.gz: 1b41ec5d409d1fb0446036b1368a62b6354bfab2
3
+ metadata.gz: c1e59ffbabc5a41955d430e1773dc01a14a6647b
4
+ data.tar.gz: 6bd5deaa4b6e9a570883f06fc1f0f4de4695fecf
5
5
  SHA512:
6
- metadata.gz: c8dd58b8dff118a7a95c3cee1e41859a3196eb2fb05d72cf04e0d105001cb05f68598b6d28af4d3d08c30e388d1c16632ff171abe373bb711e4e9bc88301b497
7
- data.tar.gz: 7b934a2d02593fc3ba9942b3e16e90e342079b61c5fcf8ab204377eed615a405a81eba81ce17eb15c54af90f0712660af4b8dd62ad7ddfadb8073dabfdde1f9d
6
+ metadata.gz: 2896cefb67f74121f15d394a7d89b33393f895382968b6e284979b2d3063e05257a71c87a0c76b7609967c67715518b3b9593ea3bda0074a1aa6167bcd8b2a27
7
+ data.tar.gz: ddaf01bd4cbfd0a32bcfb2bdec312ba3fb5cb92d0108b85f88580829fda70b2cca61d66ffa45d37b32b26e9a59a51fc1c21da65b4bb7bff1e957c9f1490cde8d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.5.0
6
+ * Fixes #4 - add ability to put systems in garbage collection array for pool
7
+ * Refactor test code
5
8
  ## 0.4.0
6
9
  * Adds vmpooler store for the ultimate in pool stores
7
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kitchen-vmpool (0.4.0)
4
+ kitchen-vmpool (0.5.0)
5
5
  gitlab (~> 4.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -233,6 +233,8 @@ module Kitchen
233
233
  if reuse_instances
234
234
  mark_unused(pool_member, pool_name)
235
235
  used_status = 'unused'
236
+ else
237
+ add_to_garbage(pool_member, pool_name)
236
238
  end
237
239
 
238
240
  block.call(pool_member, used_status)
@@ -1,3 +1,3 @@
1
1
  module KitchenVmpool
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -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 = 'used'
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.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-06 00:00:00.000000000 Z
11
+ date: 2017-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab