blimpy 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/features/cli/provision.feature +31 -0
- data/features/cli/{list.feature → status.feature} +3 -3
- data/lib/blimpy/box.rb +8 -6
- data/lib/blimpy/cli.rb +36 -13
- data/lib/blimpy/version.rb +1 -1
- data/spec/blimpy/box_spec.rb +3 -2
- metadata +11 -9
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: Run provisioning against running VMs
|
2
|
+
In order to update the currently running VMs with new code/etc
|
3
|
+
As a blimpy user
|
4
|
+
I should be able to incrementally send updates to VMs and have the
|
5
|
+
provisioning code run again
|
6
|
+
|
7
|
+
Background: Ensure a simple Blimpfile
|
8
|
+
Given I have the Blimpfile:
|
9
|
+
"""
|
10
|
+
Blimpy.fleet do |fleet|
|
11
|
+
fleet.add(:aws) do |blimp|
|
12
|
+
blimp.name = 'provision-blimp'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: No arguments and no VMs
|
18
|
+
When I run `blimpy provision`
|
19
|
+
Then the exit status should be 1
|
20
|
+
And the output should contain:
|
21
|
+
"""
|
22
|
+
No Blimps running!
|
23
|
+
"""
|
24
|
+
|
25
|
+
Scenario: Naming a blimp without running Blimps
|
26
|
+
When I run `blimpy provision provision-blimp`
|
27
|
+
Then the exit status should be 1
|
28
|
+
And the output should contain:
|
29
|
+
"""
|
30
|
+
Could not find a blimp named "provision-blimp"
|
31
|
+
"""
|
@@ -1,11 +1,11 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Show running VMs
|
2
2
|
|
3
3
|
Scenario: With no running VMs
|
4
4
|
Given I have the Blimpfile:
|
5
5
|
"""
|
6
6
|
# Empty!
|
7
7
|
"""
|
8
|
-
When I run `blimpy
|
8
|
+
When I run `blimpy status`
|
9
9
|
Then the exit status should be 0
|
10
10
|
And the output should contain:
|
11
11
|
"""
|
@@ -14,6 +14,6 @@ Feature: List running VMs
|
|
14
14
|
|
15
15
|
Scenario: With a running VM
|
16
16
|
Given I have a single VM running
|
17
|
-
When I run `blimpy
|
17
|
+
When I run `blimpy status`
|
18
18
|
Then the exit status should be 0
|
19
19
|
And the output should list the VM
|
data/lib/blimpy/box.rb
CHANGED
@@ -153,12 +153,15 @@ module Blimpy
|
|
153
153
|
def bootstrap_livery
|
154
154
|
tarball = nil
|
155
155
|
if livery == :cwd
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
156
|
+
dir_name = File.basename(Dir.pwd)
|
157
|
+
run_command('rsync', '-av',
|
158
|
+
'--exclude=.git',
|
159
|
+
'--exclude=.svn',
|
160
|
+
'--exclude=.blimpy.d',
|
161
|
+
'.',
|
162
|
+
"#{username}@#{dns_name}:#{dir_name}/")
|
160
163
|
puts 'Bootstrapping the livery'
|
161
|
-
ssh_into("
|
164
|
+
ssh_into("cd #{dir_name} && sudo ./bootstrap.sh")
|
162
165
|
end
|
163
166
|
end
|
164
167
|
|
@@ -170,7 +173,6 @@ module Blimpy
|
|
170
173
|
# after sshd(8) comes online
|
171
174
|
@exec_commands = false
|
172
175
|
|
173
|
-
print "..waiting for sshd on #{@name} to come online"
|
174
176
|
until @ssh_connected
|
175
177
|
# Run the `true` command and exit
|
176
178
|
@ssh_connected = ssh_into('-q', 'true')
|
data/lib/blimpy/cli.rb
CHANGED
@@ -22,7 +22,6 @@ module Blimpy
|
|
22
22
|
engine
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
25
|
def box_by_name(name)
|
27
26
|
engine = load_engine
|
28
27
|
box = nil
|
@@ -41,11 +40,22 @@ module Blimpy
|
|
41
40
|
|
42
41
|
engine.fleet.ships.each do |ship|
|
43
42
|
next unless ship.name == name
|
44
|
-
ship.server =
|
43
|
+
ship.server = ship.class.fog_server_for_instance(id, data)
|
45
44
|
box = ship
|
46
45
|
end
|
47
46
|
box
|
48
47
|
end
|
48
|
+
|
49
|
+
def current_blimps
|
50
|
+
blimps = Dir["#{Dir.pwd}/.blimpy.d/*.blimp"]
|
51
|
+
return false if blimps.empty?
|
52
|
+
|
53
|
+
data = []
|
54
|
+
blimps.each do |blimp|
|
55
|
+
data << [blimp, YAML.load_file(blimp)]
|
56
|
+
end
|
57
|
+
data
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
desc 'start', 'Start up a fleet of blimps'
|
@@ -63,17 +73,16 @@ module Blimpy
|
|
63
73
|
engine.fleet.start
|
64
74
|
end
|
65
75
|
|
66
|
-
desc '
|
67
|
-
def
|
76
|
+
desc 'status', 'Show running blimps'
|
77
|
+
def status
|
68
78
|
ensure_blimpfile
|
69
|
-
blimps =
|
70
|
-
|
79
|
+
blimps = current_blimps
|
80
|
+
unless blimps
|
71
81
|
puts 'No currently running VMs'
|
72
82
|
exit 0
|
73
83
|
end
|
74
84
|
|
75
|
-
blimps.each do |blimp|
|
76
|
-
data = YAML.load_file(blimp)
|
85
|
+
blimps.each do |blimp, data|
|
77
86
|
instance_id = File.basename(blimp)
|
78
87
|
instance_id = instance_id.split('.blimp').first
|
79
88
|
puts "#{data['name']} (#{instance_id}) is: online at #{data['dns']}"
|
@@ -138,12 +147,26 @@ end
|
|
138
147
|
desc 'provision BLIMP_NAME', 'Run the livery again'
|
139
148
|
def provision(name=nil)
|
140
149
|
ensure_blimpfile
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
150
|
+
unless name.nil?
|
151
|
+
box = box_by_name(name)
|
152
|
+
if box.nil?
|
153
|
+
puts "Could not find a blimp named \"#{name}\""
|
154
|
+
exit 1
|
155
|
+
end
|
156
|
+
box.bootstrap
|
157
|
+
else
|
158
|
+
blimps = current_blimps
|
159
|
+
unless blimps
|
160
|
+
puts "No Blimps running!"
|
161
|
+
exit 1
|
162
|
+
end
|
163
|
+
|
164
|
+
blimps.each do |blimp, data|
|
165
|
+
next unless data['name']
|
166
|
+
box = box_by_name(data['name'])
|
167
|
+
box.bootstrap
|
168
|
+
end
|
145
169
|
end
|
146
|
-
box.bootstrap
|
147
170
|
end
|
148
171
|
end
|
149
172
|
end
|
data/lib/blimpy/version.rb
CHANGED
data/spec/blimpy/box_spec.rb
CHANGED
@@ -110,8 +110,9 @@ describe Blimpy::Box do
|
|
110
110
|
|
111
111
|
it 'should tarball up the current directory' do
|
112
112
|
Dir.should_receive(:pwd).and_return('mock-pwd')
|
113
|
-
|
114
|
-
|
113
|
+
subject.should_receive(:run_command) do |*args|
|
114
|
+
args.first.should == 'rsync'
|
115
|
+
end
|
115
116
|
subject.should_receive(:ssh_into)
|
116
117
|
subject.bootstrap_livery
|
117
118
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blimpy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement: &
|
16
|
+
requirement: &9308320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9308320
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &9307780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *9307780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitar
|
38
|
-
requirement: &
|
38
|
+
requirement: &9307240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *9307240
|
47
47
|
description: Blimpy is a tool for managing a fleet of machines in the CLOUD!
|
48
48
|
email:
|
49
49
|
- tyler@monkeypox.org
|
@@ -60,10 +60,11 @@ files:
|
|
60
60
|
- bin/blimpy
|
61
61
|
- blimpy.gemspec
|
62
62
|
- features/cli/init.feature
|
63
|
-
- features/cli/
|
63
|
+
- features/cli/provision.feature
|
64
64
|
- features/cli/scp.feature
|
65
65
|
- features/cli/ssh.feature
|
66
66
|
- features/cli/start.feature
|
67
|
+
- features/cli/status.feature
|
67
68
|
- features/step_definitions/cli_steps.rb
|
68
69
|
- features/support/env.rb
|
69
70
|
- features/support/hooks.rb
|
@@ -115,10 +116,11 @@ specification_version: 3
|
|
115
116
|
summary: Ruby + CLOUD = Blimpy
|
116
117
|
test_files:
|
117
118
|
- features/cli/init.feature
|
118
|
-
- features/cli/
|
119
|
+
- features/cli/provision.feature
|
119
120
|
- features/cli/scp.feature
|
120
121
|
- features/cli/ssh.feature
|
121
122
|
- features/cli/start.feature
|
123
|
+
- features/cli/status.feature
|
122
124
|
- features/step_definitions/cli_steps.rb
|
123
125
|
- features/support/env.rb
|
124
126
|
- features/support/hooks.rb
|