blimpy 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/blimpy/box.rb +37 -27
- data/lib/blimpy/version.rb +1 -1
- data/scripts/freebsd_puppet.sh +21 -0
- data/scripts/linux_puppet.sh +19 -0
- data/spec/blimpy/box_spec.rb +0 -19
- metadata +12 -10
data/lib/blimpy/box.rb
CHANGED
@@ -159,41 +159,51 @@ module Blimpy
|
|
159
159
|
'-l', username, dns_name, *args)
|
160
160
|
end
|
161
161
|
|
162
|
-
def scp_file(filename)
|
162
|
+
def scp_file(filename, directory='')
|
163
163
|
filename = File.expand_path(filename)
|
164
164
|
run_command('scp', '-o', 'StrictHostKeyChecking=no',
|
165
|
-
filename, "#{username}@#{dns_name}
|
165
|
+
filename, "#{username}@#{dns_name}:#{directory}", *ARGV[3..-1])
|
166
166
|
end
|
167
167
|
|
168
168
|
def bootstrap_livery
|
169
|
+
script = File.expand_path(File.dirname(__FILE__) + "/../../scripts/#{livery}.sh")
|
170
|
+
|
169
171
|
if livery == :cwd
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
if can_rsync?
|
174
|
-
unpack_command = "cd #{dir_name}"
|
175
|
-
run_command('rsync', '-avL',
|
176
|
-
'--exclude=.git',
|
177
|
-
'--exclude=.svn',
|
178
|
-
'--exclude=.blimpy.d',
|
179
|
-
'.',
|
180
|
-
"#{username}@#{dns_name}:#{dir_name}/")
|
181
|
-
else
|
182
|
-
puts "Remote host has no rsync(1), falling back to copying a full tarball over"
|
183
|
-
tarball = Blimpy::Livery.tarball_directory(Dir.pwd)
|
184
|
-
scp_file(tarball)
|
185
|
-
# HAXX
|
186
|
-
basename = File.basename(tarball)
|
187
|
-
unpack_command = "tar -zxf #{basename} && cd #{dir_name}"
|
188
|
-
end
|
172
|
+
script = File.join(Dir.pwd, '/bootstrap.sh')
|
173
|
+
end
|
189
174
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
175
|
+
unless File.exists?(script)
|
176
|
+
puts "Could not find `#{script}` which is needed to kick-start the machine"
|
177
|
+
return
|
178
|
+
end
|
179
|
+
|
180
|
+
unpack_command = 'true'
|
181
|
+
dir_name = File.basename(Dir.pwd)
|
182
|
+
|
183
|
+
if can_rsync?
|
184
|
+
unpack_command = "cd #{dir_name}"
|
185
|
+
run_command('rsync', '-avL',
|
186
|
+
'--exclude=.git',
|
187
|
+
'--exclude=.svn',
|
188
|
+
'--exclude=.blimpy.d',
|
189
|
+
'.',
|
190
|
+
"#{username}@#{dns_name}:#{dir_name}/")
|
191
|
+
else
|
192
|
+
puts "Remote host has no rsync(1), falling back to copying a full tarball over"
|
193
|
+
tarball = Blimpy::Livery.tarball_directory(Dir.pwd)
|
194
|
+
scp_file(tarball)
|
195
|
+
# HAXX
|
196
|
+
basename = File.basename(tarball)
|
197
|
+
ssh_into("tar -zxf #{basename} && cd #{dir_name}")
|
198
|
+
end
|
199
|
+
|
200
|
+
puts 'Bootstrapping the livery'
|
201
|
+
run_sudo = 'sudo'
|
202
|
+
if username == 'root'
|
203
|
+
run_sudo = ''
|
196
204
|
end
|
205
|
+
scp_file(script, dir_name)
|
206
|
+
ssh_into("cd #{dir_name} && #{run_sudo} ./#{File.basename(script)}")
|
197
207
|
end
|
198
208
|
|
199
209
|
def wait_for_sshd
|
data/lib/blimpy/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/sh -x
|
2
|
+
|
3
|
+
which pkg > /dev/null
|
4
|
+
|
5
|
+
if [ $? -ne 0 ]; then
|
6
|
+
echo "pkgng is not installed!"
|
7
|
+
ftp -V ftp://anonymous:ec2@ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/pkg.tbz
|
8
|
+
pkg_add ./pkg.tbz
|
9
|
+
|
10
|
+
echo "PACKAGESITE : http://pkgbeta.freebsd.org/freebsd-9-amd64/latest/" > /usr/local/etc/pkg.conf
|
11
|
+
|
12
|
+
pkg update -q
|
13
|
+
# Update pkgng itself
|
14
|
+
pkg install -y pkg
|
15
|
+
# Install rsync(1) so we don't have to fall back to tar(1)+scp(1) ever again
|
16
|
+
pkg install -y rsync
|
17
|
+
# Install puppet so we can get that up and running
|
18
|
+
pkg install -y puppet
|
19
|
+
fi
|
20
|
+
|
21
|
+
puppet apply --modulepath=./modules --verbose manifests/site.pp
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/sh -x
|
2
|
+
|
3
|
+
export PATH=/var/lib/gems/1.8/bin:$PATH
|
4
|
+
|
5
|
+
which puppet
|
6
|
+
|
7
|
+
if [ $? -ne 0 ]; then
|
8
|
+
apt-get update
|
9
|
+
|
10
|
+
apt-get install -y ruby1.8 \
|
11
|
+
ruby1.8-dev \
|
12
|
+
libopenssl-ruby1.8 \
|
13
|
+
rubygems
|
14
|
+
|
15
|
+
gem install puppet --no-ri --no-rdoc
|
16
|
+
fi
|
17
|
+
|
18
|
+
|
19
|
+
puppet apply --verbose --modulepath=./modules manifests/site.pp
|
data/spec/blimpy/box_spec.rb
CHANGED
@@ -141,25 +141,6 @@ describe Blimpy::Box do
|
|
141
141
|
result.should be_instance_of Blimpy::Boxes::AWS
|
142
142
|
end
|
143
143
|
end
|
144
|
-
|
145
|
-
end
|
146
|
-
|
147
|
-
describe '#bootstrap_livery' do
|
148
|
-
context 'with a livery of :cwd' do
|
149
|
-
before :each do
|
150
|
-
subject.livery = :cwd
|
151
|
-
subject.stub(:can_rsync?).and_return(true)
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'should tarball up the current directory' do
|
155
|
-
Dir.should_receive(:pwd).and_return('mock-pwd')
|
156
|
-
subject.should_receive(:run_command) do |*args|
|
157
|
-
args.first.should == 'rsync'
|
158
|
-
end
|
159
|
-
subject.should_receive(:ssh_into)
|
160
|
-
subject.bootstrap_livery
|
161
|
-
end
|
162
|
-
end
|
163
144
|
end
|
164
145
|
end
|
165
146
|
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.8
|
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-07-
|
12
|
+
date: 2012-07-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement: &
|
16
|
+
requirement: &13551560 !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: *13551560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &13550720 !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: *13550720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitar
|
38
|
-
requirement: &
|
38
|
+
requirement: &13549340 !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: *13549340
|
47
47
|
description: Blimpy is a tool for managing a fleet of machines in the CLOUD!
|
48
48
|
email:
|
49
49
|
- tyler@monkeypox.org
|
@@ -81,6 +81,8 @@ files:
|
|
81
81
|
- lib/blimpy/livery.rb
|
82
82
|
- lib/blimpy/securitygroups.rb
|
83
83
|
- lib/blimpy/version.rb
|
84
|
+
- scripts/freebsd_puppet.sh
|
85
|
+
- scripts/linux_puppet.sh
|
84
86
|
- spec/blimpy/box_spec.rb
|
85
87
|
- spec/blimpy/boxes/aws_spec.rb
|
86
88
|
- spec/blimpy/boxes/openstack_spec.rb
|
@@ -106,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
108
|
version: '0'
|
107
109
|
segments:
|
108
110
|
- 0
|
109
|
-
hash: -
|
111
|
+
hash: -3611461695599472567
|
110
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
113
|
none: false
|
112
114
|
requirements:
|
@@ -115,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
117
|
version: '0'
|
116
118
|
segments:
|
117
119
|
- 0
|
118
|
-
hash: -
|
120
|
+
hash: -3611461695599472567
|
119
121
|
requirements: []
|
120
122
|
rubyforge_project:
|
121
123
|
rubygems_version: 1.8.10
|