blimpy 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -11
- data/lib/blimpy/securitygroups.rb +11 -3
- data/lib/blimpy/version.rb +1 -1
- data/spec/blimpy/securitygroups_spec.rb +16 -7
- metadata +10 -10
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
![Excelsior!](http://strongspace.com/rtyler/public/excelsior.png)
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
## About
|
8
8
|
|
9
9
|
Blimpy is a tool to help developers spin up and utilize machines "in the
|
10
10
|
cloud."
|
@@ -30,18 +30,10 @@ Once machines are online, they're easy to access by name with:
|
|
30
30
|
Then once you're finished working with the machines a simple `blimpy destroy`
|
31
31
|
will terminate the machines.
|
32
32
|
|
33
|
-
---
|
34
|
-
|
35
|
-
(Inspired by [Vagrant](http://vagrantup.com))
|
36
|
-
|
37
|
-
Notes and other bits are being stored in [this public Evernote
|
38
|
-
notebook](https://www.evernote.com/pub/agentdero/blimpy).
|
39
|
-
|
40
|
-
The current concept/design document is captured in [this
|
41
|
-
note](https://www.evernote.com/pub/agentdero/blimpy#b=58a228bb-8910-4cd1-a7f5-995d775b81a2&n=06def701-7e25-425b-81d4-5811e7987c7e)
|
42
33
|
|
34
|
+
---
|
43
35
|
|
44
|
-
|
36
|
+
## The Blimpfile
|
45
37
|
|
46
38
|
Here's an example Blimpfile:
|
47
39
|
|
@@ -59,6 +51,14 @@ Here's an example Blimpfile:
|
|
59
51
|
end
|
60
52
|
```
|
61
53
|
|
54
|
+
### Supported Clouds
|
55
|
+
|
56
|
+
Currently Blimpy supports creating machines on:
|
57
|
+
|
58
|
+
* [Amazon Web Services](https://github.com/rtyler/blimpy/wiki/AWS) - using the `:aws` argument passed into `fleet.add`
|
59
|
+
* [OpenStack](https://github.com/rtyler/blimpy/wiki/OpenStack) - using the `:openstack` argument passed into `fleet.add`
|
60
|
+
|
61
|
+
---
|
62
62
|
|
63
63
|
### What is Livery?
|
64
64
|
|
@@ -8,19 +8,21 @@ module Blimpy
|
|
8
8
|
return nil
|
9
9
|
end
|
10
10
|
|
11
|
-
ports
|
11
|
+
unless ports.is_a? Set
|
12
|
+
ports = Set.new(ports)
|
13
|
+
end
|
14
|
+
|
12
15
|
# Lolwut, #hash is inconsistent between ruby processes
|
13
16
|
"Blimpy-#{Zlib.crc32(ports.inspect)}"
|
14
17
|
end
|
15
18
|
|
16
19
|
def self.ensure_group(fog, ports)
|
17
20
|
name = group_id(ports)
|
18
|
-
ports = Set.new(ports)
|
19
21
|
|
20
22
|
exists = fog.security_groups.get(name)
|
21
23
|
|
22
24
|
if exists.nil?
|
23
|
-
create_group(fog, ports)
|
25
|
+
name = create_group(fog, ports)
|
24
26
|
end
|
25
27
|
name
|
26
28
|
end
|
@@ -29,9 +31,15 @@ module Blimpy
|
|
29
31
|
name = group_id(ports)
|
30
32
|
group = fog.security_groups.create(:name => name,
|
31
33
|
:description => "Custom Blimpy security group for #{ports.to_a}")
|
34
|
+
|
35
|
+
unless ports.is_a? Set
|
36
|
+
ports = Set.new(ports)
|
37
|
+
end
|
38
|
+
|
32
39
|
ports.each do |port|
|
33
40
|
group.authorize_port_range(port .. port)
|
34
41
|
end
|
42
|
+
name
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
data/lib/blimpy/version.rb
CHANGED
@@ -3,7 +3,11 @@ require 'blimpy/securitygroups'
|
|
3
3
|
|
4
4
|
describe Blimpy::SecurityGroups do
|
5
5
|
let(:fog) { mock('Fog object') }
|
6
|
-
|
6
|
+
# Due to the implementation of the group_id method, [22,8140] can trigger
|
7
|
+
# a failure case that is not triggered by [22,8080].
|
8
|
+
# Zlib.crc32(Set.new(Set.new([22,8140])).inspect) != Zlib.crc32(Set.new([22,8140]).inspect), at least in ruby 1.8.7
|
9
|
+
let(:ports) { [22, 8140 ] }
|
10
|
+
let(:expected_group_name) { subject.group_id(ports) }
|
7
11
|
|
8
12
|
describe '#group_id' do
|
9
13
|
it 'should return nil for an empty port Array' do
|
@@ -28,17 +32,22 @@ describe Blimpy::SecurityGroups do
|
|
28
32
|
it 'should bail and not try to create the group' do
|
29
33
|
fog.stub_chain(:security_groups, :get).and_return(true)
|
30
34
|
subject.should_receive(:create_group).never
|
31
|
-
subject.should_receive(:group_id).and_return('fake-id')
|
32
35
|
name = subject.ensure_group(fog, ports)
|
33
|
-
name.should ==
|
36
|
+
name.should == expected_group_name
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
37
40
|
context "for a group that doesn't exist" do
|
41
|
+
let(:sec_groups) { mock('Fog Security Groups object') }
|
42
|
+
let(:group) { mock('Fog SecurityGroup') }
|
43
|
+
|
38
44
|
it 'should create the group' do
|
39
|
-
fog.
|
40
|
-
|
41
|
-
|
45
|
+
fog.stub(:security_groups).and_return(sec_groups)
|
46
|
+
sec_groups.should_receive(:get).with(expected_group_name).and_return(nil)
|
47
|
+
sec_groups.should_receive(:create).and_return(group)
|
48
|
+
group.stub(:authorize_port_range)
|
49
|
+
name = subject.ensure_group(fog, ports)
|
50
|
+
name.should == expected_group_name
|
42
51
|
end
|
43
52
|
end
|
44
53
|
end
|
@@ -48,7 +57,7 @@ describe Blimpy::SecurityGroups do
|
|
48
57
|
it 'should authorize the port ranges for every port' do
|
49
58
|
fog.stub_chain(:security_groups, :create).and_return(group)
|
50
59
|
group.should_receive(:authorize_port_range).with(22..22)
|
51
|
-
group.should_receive(:authorize_port_range).with(
|
60
|
+
group.should_receive(:authorize_port_range).with(8140..8140)
|
52
61
|
subject.create_group(fog, ports)
|
53
62
|
end
|
54
63
|
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.6.
|
4
|
+
version: 0.6.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement: &
|
16
|
+
requirement: &22676120 !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: *22676120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &22675680 !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: *22675680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitar
|
38
|
-
requirement: &
|
38
|
+
requirement: &22675240 !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: *22675240
|
47
47
|
description: Blimpy is a tool for managing a fleet of machines in the CLOUD!
|
48
48
|
email:
|
49
49
|
- tyler@monkeypox.org
|
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
segments:
|
119
119
|
- 0
|
120
|
-
hash:
|
120
|
+
hash: 3825155761784382810
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
segments:
|
128
128
|
- 0
|
129
|
-
hash:
|
129
|
+
hash: 3825155761784382810
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
132
|
rubygems_version: 1.8.10
|