blimpy 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/blimpy/box.rb CHANGED
@@ -118,9 +118,20 @@ module Blimpy
118
118
  end
119
119
  end
120
120
 
121
+
122
+ def with_data(ship_id, data)
123
+ @dns = data['dns']
124
+ @region = data['region']
125
+ end
126
+
121
127
  def dns_name
122
- return @server.dns_name unless @server.nil?
123
- 'no name'
128
+ @dns ||= begin
129
+ if @server.nil?
130
+ 'no name'
131
+ else
132
+ @server.dns_name
133
+ end
134
+ end
124
135
  end
125
136
 
126
137
  def internal_dns_name
@@ -177,7 +188,7 @@ module Blimpy
177
188
  @ssh_connected = ssh_into('-q', 'true')
178
189
 
179
190
  unless @ssh_connected
180
- if (Time.now.to_i - start) < 30
191
+ if (Time.now.to_i - start) < 60
181
192
  print '.'
182
193
  sleep 1
183
194
  end
data/lib/blimpy/cli.rb CHANGED
@@ -25,25 +25,24 @@ module Blimpy
25
25
  def box_by_name(name)
26
26
  engine = load_engine
27
27
  box = nil
28
- id = nil
28
+ ship_id = nil
29
29
  data = nil
30
30
  engine.fleet.members.each do |instance_id, instance_data|
31
31
  next unless instance_data['name'] == name
32
- id = instance_id
32
+ ship_id = instance_id
33
33
  data = instance_data
34
34
  break
35
35
  end
36
36
 
37
- if id.nil?
37
+ if ship_id.nil?
38
38
  return nil
39
39
  end
40
40
 
41
41
  engine.fleet.ships.each do |ship|
42
42
  next unless ship.name == name
43
- ship.server = ship.class.fog_server_for_instance(id, data)
44
- box = ship
43
+ ship.with_data(ship_id, data)
44
+ return ship
45
45
  end
46
- box
47
46
  end
48
47
 
49
48
  def current_blimps
@@ -1,3 +1,3 @@
1
1
  module Blimpy
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -45,6 +45,31 @@ describe Blimpy::Box do
45
45
  end
46
46
  end
47
47
 
48
+ describe '#with_data' do
49
+ context 'with valid data' do
50
+ let(:data) do
51
+ {'type' => 'AWS',
52
+ 'name' => 'Fakey',
53
+ 'region' => 'us-west-2',
54
+ 'dns' => 'ec2-50-112-24-134.us-west-2.compute.amazonaws.com',
55
+ 'internal_dns' => 'ip-10-252-73-124.us-west-2.compute.internal'}
56
+ end
57
+ let(:ship_id) { 'i-deadbeef' }
58
+
59
+ before :each do
60
+ subject.with_data(ship_id, data)
61
+ end
62
+
63
+ it 'should set the dns_name' do
64
+ subject.dns_name.should == data['dns']
65
+ end
66
+
67
+ it 'should set the region' do
68
+ subject.region.should == data['region']
69
+ end
70
+ end
71
+ end
72
+
48
73
  context 'with a mocked server' do
49
74
  let(:server_id) { 'id-0xdeadbeef' }
50
75
  let(:server) do
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.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
16
- requirement: &10172400 !ruby/object:Gem::Requirement
16
+ requirement: &13269540 !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: *10172400
24
+ version_requirements: *13269540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &10171980 !ruby/object:Gem::Requirement
27
+ requirement: &13269100 !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: *10171980
35
+ version_requirements: *13269100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitar
38
- requirement: &10171560 !ruby/object:Gem::Requirement
38
+ requirement: &13268640 !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: *10171560
46
+ version_requirements: *13268640
47
47
  description: Blimpy is a tool for managing a fleet of machines in the CLOUD!
48
48
  email:
49
49
  - tyler@monkeypox.org