blimpy 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -5
- data/README.md +3 -0
- data/bin/blimpy +6 -6
- data/features/support/env.rb +1 -1
- data/lib/blimpy/box.rb +34 -13
- data/lib/blimpy/boxes/aws.rb +1 -0
- data/lib/blimpy/boxes/openstack.rb +1 -0
- data/lib/blimpy/cli.rb +29 -2
- data/lib/blimpy/fleet.rb +4 -2
- data/lib/blimpy/livery/cwd.rb +1 -1
- data/lib/blimpy/version.rb +1 -1
- data/scripts/puppet.sh +7 -5
- metadata +26 -11
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -47,6 +47,9 @@ Here's an example Blimpfile:
|
|
47
47
|
ship.group = 'Simple' # [Optional] The name of the desired Security Group
|
48
48
|
ship.region = 'us-west-1' # [Optional] defaults to us-west-2
|
49
49
|
ship.username = 'ubuntu' # [Optional] SSH username, defaults to "ubuntu" for AWS machines
|
50
|
+
ship.flavor = 'm1.small' # [Optional] defaults to t1.micro
|
51
|
+
ship.tags = {:mytag => 'somevalue'} # [Optional]
|
52
|
+
ship.provision_on_start = false # [Optional] defaults to true
|
50
53
|
end
|
51
54
|
end
|
52
55
|
```
|
data/bin/blimpy
CHANGED
@@ -10,12 +10,12 @@ rescue NameError
|
|
10
10
|
# I don't think we have YAML::ENGINE until Ruby 1.9
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/')
|
14
|
+
require 'blimpy/cli'
|
15
|
+
|
16
|
+
# allow monkey-patching of Blimpy by the project (mainly to add more commands)
|
17
|
+
blimprc = File.join(Dir.pwd,"Blimprc")
|
18
|
+
Blimpy.load_file File.open(blimprc).read if File.exists? blimprc
|
19
19
|
|
20
20
|
Blimpy::CLI.start
|
21
21
|
exit 0
|
data/features/support/env.rb
CHANGED
data/lib/blimpy/box.rb
CHANGED
@@ -13,8 +13,8 @@ module Blimpy
|
|
13
13
|
attr_reader :allowed_regions, :region
|
14
14
|
attr_accessor :image_id, :flavor, :group, :ports
|
15
15
|
attr_accessor :dns, :internal_dns
|
16
|
-
attr_accessor :name, :tags, :fleet_id, :username, :livery
|
17
|
-
|
16
|
+
attr_accessor :name, :tags, :fleet_id, :username, :ssh_port, :livery
|
17
|
+
attr_accessor :provision_on_start
|
18
18
|
|
19
19
|
def self.from_instance_id(an_id, data)
|
20
20
|
return if data[:type].nil?
|
@@ -33,6 +33,7 @@ module Blimpy
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def initialize(server=nil)
|
36
|
+
@provision_on_start = true
|
36
37
|
@livery = nil
|
37
38
|
@group = nil
|
38
39
|
@name = 'Unnamed Box'
|
@@ -126,7 +127,7 @@ module Blimpy
|
|
126
127
|
end
|
127
128
|
|
128
129
|
def serializable_attributes
|
129
|
-
[:type, :name, :region, :dns, :internal_dns]
|
130
|
+
[:type, :name, :region, :dns, :internal_dns, :flavor, :tags]
|
130
131
|
end
|
131
132
|
|
132
133
|
def immutable_attributes
|
@@ -161,7 +162,6 @@ module Blimpy
|
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
164
|
-
|
165
165
|
def with_data(ship_id, data)
|
166
166
|
data.each do |key, value|
|
167
167
|
next if immutable_attributes.include? key.to_sym
|
@@ -197,15 +197,15 @@ module Blimpy
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
+
def ssh_commands(*args)
|
201
|
+
['ssh', '-o', 'PasswordAuthentication=no',
|
202
|
+
'-o', 'StrictHostKeyChecking=no',
|
203
|
+
'-p', (ssh_port||22).to_s,
|
204
|
+
'-l', username, dns, *args]
|
205
|
+
end
|
206
|
+
|
200
207
|
def ssh_into(*args)
|
201
|
-
|
202
|
-
# to the ssh(1) binary
|
203
|
-
if args.empty?
|
204
|
-
args = ARGV[2 .. -1]
|
205
|
-
end
|
206
|
-
run_command('ssh', '-o', 'PasswordAuthentication=no',
|
207
|
-
'-o', 'StrictHostKeyChecking=no',
|
208
|
-
'-l', username, dns, *args)
|
208
|
+
run_command(*ssh_commands(*args))
|
209
209
|
end
|
210
210
|
|
211
211
|
def scp_file(filename, directory='', *args)
|
@@ -214,6 +214,11 @@ module Blimpy
|
|
214
214
|
filename, "#{username}@#{dns}:#{directory}", *args)
|
215
215
|
end
|
216
216
|
|
217
|
+
def scp_files(directory, files)
|
218
|
+
filename = File.expand_path(filename)
|
219
|
+
run_command(*['scp', '-o', 'StrictHostKeyChecking=no']+files+["#{username}@#{dns}:#{directory}"])
|
220
|
+
end
|
221
|
+
|
217
222
|
def bootstrap_livery
|
218
223
|
if @livery.kind_of? Symbol
|
219
224
|
raise Blimpy::InvalidLiveryException, 'Symbol liveries are unsupported!'
|
@@ -233,18 +238,34 @@ module Blimpy
|
|
233
238
|
# after sshd(8) comes online
|
234
239
|
@exec_commands = false
|
235
240
|
|
241
|
+
$stdout.sync = true
|
242
|
+
need_nl = false
|
243
|
+
|
236
244
|
until @ssh_connected
|
237
245
|
# Run the `true` command and exit
|
238
246
|
@ssh_connected = ssh_into('-q', 'true')
|
247
|
+
# if SSH is killed, don't repeat
|
248
|
+
if $?.signaled?
|
249
|
+
if $?.termsig==2
|
250
|
+
# if Ctrl+C, report what we were doing
|
251
|
+
puts "Failed to connect. To try it yourself:\n#{ssh_commands('-v','true').join(' ')}"
|
252
|
+
end
|
253
|
+
raise Exception, "ssh was killed: #{$?}"
|
254
|
+
end
|
239
255
|
|
240
256
|
unless @ssh_connected
|
257
|
+
if !need_nl
|
258
|
+
p = ssh_port.nil? ? "" : ":#{ssh_port}"
|
259
|
+
print ">> Connecting #{username}@#{name}#{p}"
|
260
|
+
end
|
241
261
|
if (Time.now.to_i - start) < 60
|
242
262
|
print '.'
|
263
|
+
need_nl = true
|
243
264
|
sleep 1
|
244
265
|
end
|
245
266
|
end
|
246
267
|
end
|
247
|
-
puts
|
268
|
+
puts if need_nl
|
248
269
|
@exec_commands = use_exec
|
249
270
|
end
|
250
271
|
|
data/lib/blimpy/boxes/aws.rb
CHANGED
data/lib/blimpy/cli.rb
CHANGED
@@ -62,6 +62,7 @@ module Blimpy
|
|
62
62
|
fleet = load_blimpfile
|
63
63
|
rescue Blimpy::InvalidBlimpFileError => e
|
64
64
|
puts "The Blimpfile is invalid!"
|
65
|
+
puts e.to_s
|
65
66
|
exit 1
|
66
67
|
end
|
67
68
|
|
@@ -73,6 +74,32 @@ module Blimpy
|
|
73
74
|
fleet.start
|
74
75
|
end
|
75
76
|
|
77
|
+
desc 'show', 'Show blimp details for running blimps'
|
78
|
+
method_options :tags => :boolean
|
79
|
+
def show
|
80
|
+
ensure_blimpfile
|
81
|
+
blimps = current_blimps
|
82
|
+
unless blimps
|
83
|
+
puts 'No currently running VMs'
|
84
|
+
exit 0
|
85
|
+
end
|
86
|
+
|
87
|
+
tags_option = options[:tags]
|
88
|
+
blimps.each do |blimp, data|
|
89
|
+
if tags_option
|
90
|
+
tags = nil
|
91
|
+
data[:tags].each do |k,v|
|
92
|
+
if tags.nil?
|
93
|
+
tags = "#{k}=#{v}"
|
94
|
+
elsif
|
95
|
+
tags = "#{tags},#{k}=#{v}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
puts "#{data[:name]} #{data[:internal_dns]} #{tags}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
76
103
|
desc 'status', 'Show running blimps'
|
77
104
|
def status
|
78
105
|
ensure_blimpfile
|
@@ -85,7 +112,7 @@ module Blimpy
|
|
85
112
|
blimps.each do |blimp, data|
|
86
113
|
instance_id = File.basename(blimp)
|
87
114
|
instance_id = instance_id.split('.blimp').first
|
88
|
-
puts "#{data[:name]} (#{instance_id}) is: online at #{data[:dns]}"
|
115
|
+
puts "#{data[:name]} (#{instance_id}) is: online at #{data[:dns]} (#{data[:internal_dns]} internally)"
|
89
116
|
end
|
90
117
|
end
|
91
118
|
|
@@ -143,7 +170,7 @@ end
|
|
143
170
|
end
|
144
171
|
|
145
172
|
box.wait_for_sshd
|
146
|
-
box.ssh_into
|
173
|
+
box.ssh_into *args
|
147
174
|
end
|
148
175
|
|
149
176
|
desc 'scp BLIMP_NAME FILE_NAME', 'Securely copy FILE_NAME into the blimp'
|
data/lib/blimpy/fleet.rb
CHANGED
data/lib/blimpy/livery/cwd.rb
CHANGED
data/lib/blimpy/version.rb
CHANGED
data/scripts/puppet.sh
CHANGED
@@ -51,12 +51,14 @@ else
|
|
51
51
|
Ubuntu) export PATH=/var/lib/gems/1.8/bin:/usr/local/bin:$PATH
|
52
52
|
which puppet > /dev/null 2>&1
|
53
53
|
if [ $? -ne 0 ]; then
|
54
|
+
# CODENAME is 'precise', 'oneiric', etc.
|
55
|
+
CODENAME=`lsb_release -c | awk '{print $2}'`
|
56
|
+
REPO_DEB="puppetlabs-release-${CODENAME}.deb"
|
57
|
+
wget --quiet http://apt.puppetlabs.com/${REPO_DEB} || Fatal "Could not retrieve http://apt.puppetlabs.com/${REPO_DEB}"
|
58
|
+
dpkg -i ${REPO_DEB} || Fatal "Could not install Puppet repo source '${REPO_DEB}'"
|
59
|
+
rm -f ${REPO_DEB}
|
54
60
|
apt-get update
|
55
|
-
apt-get install -
|
56
|
-
ruby1.8-dev \
|
57
|
-
libopenssl-ruby1.8 \
|
58
|
-
rubygems
|
59
|
-
gem install puppet --version "~> 2.7" --no-ri --no-rdoc
|
61
|
+
apt-get -qqy install puppet-common=2.7.* puppet=2.7.* hiera=1.1.* hiera-puppet=1.0* || Fatal "Could not install Puppet"
|
60
62
|
fi
|
61
63
|
;;
|
62
64
|
*) Fatal "Unsupported Linux flavor: $LINUXFLAVOR"
|
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.7
|
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:
|
12
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: thor
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: minitar
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
description: Blimpy is a tool for managing a fleet of machines in the CLOUD!
|
48
63
|
email:
|
49
64
|
- tyler@monkeypox.org
|
@@ -117,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
132
|
version: '0'
|
118
133
|
segments:
|
119
134
|
- 0
|
120
|
-
hash:
|
135
|
+
hash: 4596383241046326596
|
121
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
137
|
none: false
|
123
138
|
requirements:
|
@@ -126,10 +141,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
141
|
version: '0'
|
127
142
|
segments:
|
128
143
|
- 0
|
129
|
-
hash:
|
144
|
+
hash: 4596383241046326596
|
130
145
|
requirements: []
|
131
146
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.8.
|
147
|
+
rubygems_version: 1.8.25
|
133
148
|
signing_key:
|
134
149
|
specification_version: 3
|
135
150
|
summary: Ruby + CLOUD = Blimpy
|