furnish 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 +7 -0
- data/CHANGELOG.md +16 -5
- data/lib/furnish/provisioner_group.rb +1 -1
- data/lib/furnish/scheduler.rb +38 -4
- data/lib/furnish/version.rb +1 -1
- data/test/mt_cases.rb +51 -1
- metadata +15 -36
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4d4afd9cd6de61bdd854e6d2f7a1a6872752f6f4
|
4
|
+
data.tar.gz: 170882525003c0f981bd530c237eb6ff49833ce6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 654feec56dab6dcdad88a5b5778188fa53930482000a88d0c67d98ed91b7cb6118ec30b6064ffb647e7a2a9a8b0e8c0ee6e91f7fc98d876188cf3fb8c8974445
|
7
|
+
data.tar.gz: 5e3047a0556417cb61853a560cd7efa9c4cb75def76c9aa2a6585063a25092b3b90e00c60be2a5e61d22019f59642645575cde00b251d8029897cec2c11bcc26
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
|
1
|
+
# 0.1.1 (04/16/2013)
|
2
|
+
* #wait_for would spin forever if something got flagged as needing recovery
|
3
|
+
(threaded scheduler only). Now raises the first item's exception if
|
4
|
+
provided, or a generic one if it just flagged a failure.
|
5
|
+
* #wait_for would also throw rather cryptic exceptions if the scheduler was
|
6
|
+
threaded and was not running. Now raises something communicative.
|
7
|
+
* aliases for commonly used scheduler methods:
|
8
|
+
* #wait_for is aliased to #w
|
9
|
+
* #teardown_group is aliased to #d and #down
|
10
|
+
* New API: Furnish::Scheduler#groups can be used to more easily get at
|
11
|
+
provisioner groups the scheduler knows about.
|
12
|
+
# 0.1.0 (04/09/2013)
|
2
13
|
* Furnish requires 1.9.3 or greater -- always has been the case, now rubygems enforces that for us.
|
3
14
|
* Runtime performance increased significantly. No hard numbers, but test
|
4
15
|
suite assertion count doubled and total test runtime actually dropped
|
@@ -34,16 +45,16 @@
|
|
34
45
|
* `<<` is now an alias for `schedule_provisioner_group`
|
35
46
|
* `s` and `sched` are now aliases for `schedule_provision`
|
36
47
|
* Probably some other shit I don't remember now.
|
37
|
-
|
48
|
+
# 0.0.4 (03/25/2013)
|
38
49
|
* Support for FURNISH_DEBUG environment variable for test suites.
|
39
50
|
* Ruby 2.0.0-p0 Compatibility Fixes
|
40
51
|
* Documentation is RDoc 4.0 compatible.
|
41
52
|
|
42
|
-
|
53
|
+
# 0.0.3 (03/21/2013)
|
43
54
|
* Fix an issue where state wasn't tracked for provisioners themselves after the provisioning process had started.
|
44
55
|
|
45
|
-
|
56
|
+
# 0.0.2 (03/20/2013)
|
46
57
|
* Extract Furnish::TestCase into gem for consumption by other gems that need to test against furnish.
|
47
58
|
|
48
|
-
|
59
|
+
# 0.0.1 (02/23/2013)
|
49
60
|
* Initial release as extracted from chef-workflow.
|
data/lib/furnish/scheduler.rb
CHANGED
@@ -97,6 +97,17 @@ module Furnish
|
|
97
97
|
vm.need_recovery
|
98
98
|
end
|
99
99
|
|
100
|
+
#
|
101
|
+
# Get the Furnish::ProvisionerGroup by name as it currently exists in the
|
102
|
+
# scheduler. Useful for querying properties of a given provisioner after
|
103
|
+
# they've been set.
|
104
|
+
#
|
105
|
+
def group(name)
|
106
|
+
vm.groups[name]
|
107
|
+
end
|
108
|
+
|
109
|
+
alias g group
|
110
|
+
|
100
111
|
#
|
101
112
|
# Schedule a group of VMs for provision. This takes a group name, which is a
|
102
113
|
# string, an array of provisioner objects, and a list of string dependencies.
|
@@ -138,22 +149,43 @@ module Furnish
|
|
138
149
|
alias << schedule_provisioner_group
|
139
150
|
|
140
151
|
#
|
141
|
-
# Sleep until this list of dependencies are resolved. In parallel mode,
|
142
|
-
# raise if an exception occurred while waiting for these
|
143
|
-
#
|
152
|
+
# Sleep until this list of dependencies are resolved. In parallel mode,
|
153
|
+
# will raise if an exception occurred while waiting for these groups, or
|
154
|
+
# the groups entered recovery state, or the scheduler is not currently
|
155
|
+
# running. In serial mode, wait_for just returns nil.
|
144
156
|
#
|
145
157
|
def wait_for(*dependencies)
|
146
158
|
return nil if @serial
|
147
159
|
return nil if dependencies.empty?
|
148
160
|
|
161
|
+
unless running?
|
162
|
+
raise "The scheduler doesn't appear to be running or started. Can't wait_for anything!"
|
163
|
+
end
|
164
|
+
|
149
165
|
dep_set = Set[*dependencies]
|
150
166
|
|
151
167
|
until dep_set & vm.solved == dep_set
|
152
168
|
sleep 0.1
|
153
169
|
@solver_thread.join unless @solver_thread.alive?
|
170
|
+
|
171
|
+
dependencies_in_recovery = needs_recovery.keys.to_set & dep_set
|
172
|
+
|
173
|
+
if needs_recovery? and !dependencies_in_recovery.empty?
|
174
|
+
# we really can't get them all, but we can at least raise the first one.
|
175
|
+
group_name = dependencies_in_recovery.first
|
176
|
+
|
177
|
+
group_exception = needs_recovery[group_name]
|
178
|
+
if group_exception
|
179
|
+
raise group_exception
|
180
|
+
else
|
181
|
+
raise "group #{group_name} is in recovery during wait_for"
|
182
|
+
end
|
183
|
+
end
|
154
184
|
end
|
155
185
|
end
|
156
186
|
|
187
|
+
alias w wait_for
|
188
|
+
|
157
189
|
#
|
158
190
|
# Start the scheduler. In serial mode this call will block until the whole
|
159
191
|
# dependency graph is satisfied, or one of the provisions fails, at which
|
@@ -301,9 +333,11 @@ module Furnish
|
|
301
333
|
|
302
334
|
deprovision_group(group_name)
|
303
335
|
end
|
304
|
-
|
305
336
|
end
|
306
337
|
|
338
|
+
alias down teardown_group
|
339
|
+
alias d teardown_group
|
340
|
+
|
307
341
|
#
|
308
342
|
# Instruct all provisioners except ones in the exception list to tear down.
|
309
343
|
# Calls #stop as its first action.
|
data/lib/furnish/version.rb
CHANGED
data/test/mt_cases.rb
CHANGED
@@ -28,13 +28,16 @@ module Furnish
|
|
28
28
|
|
29
29
|
sched.s(test1, Dummy.new)
|
30
30
|
sched.s(test2, prov.new)
|
31
|
-
sched.run rescue nil #
|
31
|
+
sched.run rescue nil # start.
|
32
32
|
assert(sched.serial || sched.running?)
|
33
33
|
unless sched.serial
|
34
34
|
sleep 0.1 while !sched.needs_recovery.has_key?(test2)
|
35
35
|
end
|
36
36
|
assert(sched.needs_recovery?)
|
37
37
|
assert_includes(sched.needs_recovery.keys, test2)
|
38
|
+
unless sched.serial
|
39
|
+
assert_raises(RuntimeError) { sched.wait_for(test2) }
|
40
|
+
end
|
38
41
|
refute_solved(test2)
|
39
42
|
sched.s(test3, Dummy.new, [test2])
|
40
43
|
refute_solved(test3)
|
@@ -72,6 +75,11 @@ module Furnish
|
|
72
75
|
sleep 0.1 while !sched.needs_recovery.has_key?(test4)
|
73
76
|
end
|
74
77
|
assert(sched.needs_recovery?)
|
78
|
+
unless sched.serial
|
79
|
+
assert_raises(RuntimeError) { sched.wait_for(test2) }
|
80
|
+
assert_raises(RuntimeError) { sched.wait_for(test4) }
|
81
|
+
assert_raises(RuntimeError) { sched.wait_for(test1, test2, test3, test4, test5) }
|
82
|
+
end
|
75
83
|
refute_solved(test2)
|
76
84
|
refute_solved(test3)
|
77
85
|
refute_solved(test4)
|
@@ -131,6 +139,48 @@ module Furnish
|
|
131
139
|
assert_equal("floop", sched.vm.groups['test2'].first.report.last, "provision failed but state is still stored for the provisions that succeeded")
|
132
140
|
end
|
133
141
|
|
142
|
+
def test_scheduler_groups
|
143
|
+
group = Furnish::ProvisionerGroup.new([Dummy.new], 'test2')
|
144
|
+
sched.s('test1', Dummy.new)
|
145
|
+
sched << group
|
146
|
+
sched.run rescue nil
|
147
|
+
sched.w('test1', 'test2')
|
148
|
+
|
149
|
+
%w[test1 test2].each do |group_name|
|
150
|
+
assert_kind_of(Furnish::ProvisionerGroup, sched.group(group_name))
|
151
|
+
assert_kind_of(Dummy, sched.group(group_name).first)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_aliases
|
156
|
+
group = Furnish::ProvisionerGroup.new([Dummy.new], 'test2')
|
157
|
+
sched.s('test1', Dummy.new)
|
158
|
+
sched << group
|
159
|
+
sched.run rescue nil
|
160
|
+
sched.w('test1', 'test2')
|
161
|
+
assert_solved('test1')
|
162
|
+
assert_solved('test2')
|
163
|
+
assert_kind_of(Furnish::ProvisionerGroup, sched.g('test1'))
|
164
|
+
assert_kind_of(Furnish::ProvisionerGroup, sched.g('test2'))
|
165
|
+
sched.d('test1')
|
166
|
+
sched.d('test2')
|
167
|
+
refute_solved('test1')
|
168
|
+
refute_solved('test2')
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_wait_for_no_run
|
172
|
+
unless sched.serial
|
173
|
+
sched.s('test1', Dummy.new)
|
174
|
+
assert_raises(RuntimeError) { sched.wait_for('test1') }
|
175
|
+
sched.run
|
176
|
+
sched.wait_for('test1')
|
177
|
+
assert_solved('test1')
|
178
|
+
sched.teardown
|
179
|
+
refute_solved('test1')
|
180
|
+
assert_raises(RuntimeError) { sched.wait_for('test1') }
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
134
184
|
def test_provision_cycle
|
135
185
|
machine_names = %w[blarg blarg2 blarg3]
|
136
186
|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: furnish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Erik Hollensbe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: palsy
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,23 +27,20 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: minitest
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,23 +55,20 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: guard-minitest
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: guard-rake
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: rdoc
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,33 +97,29 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rb-fsevent
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: simplecov
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
description: A novel way to do virtual machine provisioning
|
@@ -179,30 +162,26 @@ files:
|
|
179
162
|
- test/test_vm.rb
|
180
163
|
homepage: ''
|
181
164
|
licenses: []
|
165
|
+
metadata: {}
|
182
166
|
post_install_message:
|
183
167
|
rdoc_options: []
|
184
168
|
require_paths:
|
185
169
|
- lib
|
186
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
171
|
requirements:
|
189
|
-
- -
|
172
|
+
- - '>='
|
190
173
|
- !ruby/object:Gem::Version
|
191
174
|
version: 1.9.3
|
192
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
176
|
requirements:
|
195
|
-
- -
|
177
|
+
- - '>='
|
196
178
|
- !ruby/object:Gem::Version
|
197
179
|
version: '0'
|
198
|
-
segments:
|
199
|
-
- 0
|
200
|
-
hash: 4039116121410524587
|
201
180
|
requirements: []
|
202
181
|
rubyforge_project:
|
203
|
-
rubygems_version:
|
182
|
+
rubygems_version: 2.0.0
|
204
183
|
signing_key:
|
205
|
-
specification_version:
|
184
|
+
specification_version: 4
|
206
185
|
summary: A novel way to do virtual machine provisioning
|
207
186
|
test_files:
|
208
187
|
- test/dummy_classes.rb
|