veewee 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +24 -1
- data/lib/veewee/command.rb +7 -0
- data/lib/veewee/session.rb +61 -1
- data/lib/veewee/utils.rb +26 -0
- data/lib/veewee/version.rb +1 -1
- data/templates/CentOS-4.8-i386/postinstall.sh +6 -1
- data/templates/CentOS-5.5-i386-netboot/ks.cfg +1 -1
- data/templates/CentOS-5.5-i386-netboot/postinstall.sh +6 -0
- data/templates/CentOS-5.5-i386/ks.cfg +1 -1
- data/templates/CentOS-5.5-i386/postinstall.sh +4 -0
- data/templates/ubuntu-10.04.1-server-amd64/definition.rb +1 -1
- data/templates/ubuntu-10.04.1-server-amd64/preseed.cfg +1 -1
- data/templates/ubuntu-10.04.1-server-i386/definition.rb +1 -1
- data/templates/ubuntu-10.04.1-server-i386/preseed.cfg +1 -1
- data/templates/ubuntu-10.10-server-amd64-netboot/preseed.cfg +1 -1
- data/templates/ubuntu-10.10-server-amd64/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-amd64/preseed.cfg +1 -1
- data/templates/ubuntu-10.10-server-i386-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-i386-netboot/preseed.cfg +1 -1
- data/templates/ubuntu-10.10-server-i386/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-i386/preseed.cfg +1 -1
- data/validation/features/steps/ssh_steps.rb +156 -0
- data/validation/support/env.rb +1 -0
- data/validation/vagrant-private.key +27 -0
- data/validation/vagrant.feature +52 -0
- data/validation/vagrant.pub +1 -0
- data/veewee.gemspec +2 -0
- metadata +39 -5
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
veewee (0.1.
|
4
|
+
veewee (0.1.12)
|
5
|
+
cucumber
|
5
6
|
highline (~> 1.6.1)
|
6
7
|
net-ssh (~> 2.1.0)
|
7
8
|
popen4 (~> 0.1.2)
|
8
9
|
progressbar
|
10
|
+
rspec
|
9
11
|
thor (~> 0.14.6)
|
10
12
|
vagrant (~> 0.7.0)
|
11
13
|
|
@@ -15,13 +17,24 @@ GEM
|
|
15
17
|
Platform (0.4.0)
|
16
18
|
abstract (1.0.0)
|
17
19
|
archive-tar-minitar (0.5.2)
|
20
|
+
builder (2.1.2)
|
21
|
+
cucumber (0.8.5)
|
22
|
+
builder (~> 2.1.2)
|
23
|
+
diff-lcs (~> 1.1.2)
|
24
|
+
gherkin (~> 2.1.4)
|
25
|
+
json_pure (~> 1.4.3)
|
26
|
+
term-ansicolor (~> 1.0.4)
|
27
|
+
diff-lcs (1.1.2)
|
18
28
|
erubis (2.6.6)
|
19
29
|
abstract (>= 1.0.0)
|
20
30
|
ffi (0.6.3)
|
21
31
|
rake (>= 0.8.7)
|
32
|
+
gherkin (2.1.5)
|
33
|
+
trollop (~> 1.16.2)
|
22
34
|
highline (1.6.1)
|
23
35
|
i18n (0.5.0)
|
24
36
|
json (1.5.1)
|
37
|
+
json_pure (1.4.6)
|
25
38
|
mario (0.0.6)
|
26
39
|
net-scp (1.0.4)
|
27
40
|
net-ssh (>= 1.99.1)
|
@@ -32,7 +45,17 @@ GEM
|
|
32
45
|
open4 (>= 0.4.0)
|
33
46
|
progressbar (0.9.0)
|
34
47
|
rake (0.8.7)
|
48
|
+
rspec (2.5.0)
|
49
|
+
rspec-core (~> 2.5.0)
|
50
|
+
rspec-expectations (~> 2.5.0)
|
51
|
+
rspec-mocks (~> 2.5.0)
|
52
|
+
rspec-core (2.5.1)
|
53
|
+
rspec-expectations (2.5.0)
|
54
|
+
diff-lcs (~> 1.1.2)
|
55
|
+
rspec-mocks (2.5.0)
|
56
|
+
term-ansicolor (1.0.5)
|
35
57
|
thor (0.14.6)
|
58
|
+
trollop (1.16.2)
|
36
59
|
vagrant (0.7.2)
|
37
60
|
archive-tar-minitar (= 0.5.2)
|
38
61
|
erubis (~> 2.6.6)
|
data/lib/veewee/command.rb
CHANGED
@@ -68,6 +68,13 @@ class Command < Vagrant::Command::GroupBase
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
desc "validate [NAME]", "Validates a box against vagrant compliancy rules"
|
72
|
+
def validate(boxname)
|
73
|
+
if (!boxname.nil?)
|
74
|
+
Veewee::Session.validate_box(boxname)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
71
78
|
end
|
72
79
|
|
73
80
|
end
|
data/lib/veewee/session.rb
CHANGED
@@ -211,6 +211,30 @@ module Veewee
|
|
211
211
|
#Suppress those annoying virtualbox messages
|
212
212
|
suppress_messages
|
213
213
|
|
214
|
+
|
215
|
+
vm=VirtualBox::VM.find(boxname)
|
216
|
+
|
217
|
+
if (!vm.nil? && (vm.saved?))
|
218
|
+
puts "Removing save state"
|
219
|
+
vm.discard_state
|
220
|
+
vm.reload
|
221
|
+
end
|
222
|
+
|
223
|
+
if (!vm.nil? && !(vm.powered_off?))
|
224
|
+
puts "Shutting down vm #{boxname}"
|
225
|
+
#We force it here, maybe vm.shutdown is cleaner
|
226
|
+
begin
|
227
|
+
|
228
|
+
vm.stop
|
229
|
+
rescue VirtualBox::Exceptions::InvalidVMStateException
|
230
|
+
puts "There was problem sending the stop command because the machine is in an Invalid state"
|
231
|
+
puts "Please verify leftovers from a previous build in your vm folder"
|
232
|
+
exit
|
233
|
+
end
|
234
|
+
sleep 3
|
235
|
+
end
|
236
|
+
|
237
|
+
|
214
238
|
verify_iso(@definition[:iso_file])
|
215
239
|
|
216
240
|
if (options["force"]==false)
|
@@ -219,6 +243,11 @@ module Veewee
|
|
219
243
|
destroy_vm(boxname)
|
220
244
|
end
|
221
245
|
|
246
|
+
if Veewee::Utils.is_port_open?("localhost", @definition[:ssh_host_port])
|
247
|
+
puts "Hmm, the port #{@definition[:ssh_host_port]} is open. And we shut down?"
|
248
|
+
exit
|
249
|
+
end
|
250
|
+
|
222
251
|
checksums=calculate_checksums(@definition,boxname)
|
223
252
|
|
224
253
|
transaction(boxname,"0-initial-#{checksums[0]}",checksums) do
|
@@ -252,7 +281,6 @@ module Veewee
|
|
252
281
|
Veewee::Scancode.send_sequence("#{@vboxcmd}","#{boxname}",@definition[:boot_cmd_sequence])
|
253
282
|
|
254
283
|
kickstartfile=@definition[:kickstart_file]
|
255
|
-
puts "#{kickstartfile}"
|
256
284
|
if kickstartfile.nil? || kickstartfile.length == 0
|
257
285
|
puts "Skipping webserver as no kickstartfile was specified"
|
258
286
|
else
|
@@ -311,6 +339,11 @@ module Veewee
|
|
311
339
|
|
312
340
|
end
|
313
341
|
|
342
|
+
puts "#{boxname} was build succesfully. "
|
343
|
+
puts ""
|
344
|
+
puts "Now you can: "
|
345
|
+
puts "- verify your box by running : vagrant basebox validate #{boxname}"
|
346
|
+
puts "- export your vm to a .box fileby running : vagrant basebox export #{boxname}"
|
314
347
|
|
315
348
|
end
|
316
349
|
|
@@ -592,6 +625,33 @@ module Veewee
|
|
592
625
|
Socket.do_not_reverse_lookup = orig
|
593
626
|
end
|
594
627
|
|
628
|
+
def self.validate_box(boxname)
|
629
|
+
require 'cucumber'
|
630
|
+
|
631
|
+
require 'cucumber/rspec/disable_option_parser'
|
632
|
+
require 'cucumber/cli/main'
|
633
|
+
|
634
|
+
|
635
|
+
feature_path=File.join(File.dirname(__FILE__),"..","..","validation","vagrant.feature")
|
636
|
+
|
637
|
+
features=Array.new
|
638
|
+
features[0]=feature_path
|
639
|
+
|
640
|
+
|
641
|
+
begin
|
642
|
+
# The dup is to keep ARGV intact, so that tools like ruby-debug can respawn.
|
643
|
+
failure = Cucumber::Cli::Main.execute(features.dup)
|
644
|
+
Kernel.exit(failure ? 1 : 0)
|
645
|
+
rescue SystemExit => e
|
646
|
+
Kernel.exit(e.status)
|
647
|
+
rescue Exception => e
|
648
|
+
STDERR.puts("#{e.message} (#{e.class})")
|
649
|
+
STDERR.puts(e.backtrace.join("\n"))
|
650
|
+
Kernel.exit(1)
|
651
|
+
end
|
652
|
+
|
653
|
+
end
|
654
|
+
|
595
655
|
def self.list_ostypes
|
596
656
|
puts
|
597
657
|
puts "Available os types:"
|
data/lib/veewee/utils.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'timeout'
|
3
|
+
|
4
|
+
module Veewee
|
5
|
+
class Utils
|
6
|
+
|
7
|
+
def self.is_port_open?(ip, port)
|
8
|
+
begin
|
9
|
+
Timeout::timeout(1) do
|
10
|
+
begin
|
11
|
+
s = TCPSocket.new(ip, port)
|
12
|
+
s.close
|
13
|
+
return true
|
14
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
15
|
+
return false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
rescue Timeout::Error
|
19
|
+
end
|
20
|
+
|
21
|
+
return false
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
end #Class
|
26
|
+
end #Module
|
data/lib/veewee/version.rb
CHANGED
@@ -9,7 +9,9 @@ yum -y install gcc bzip2 make kernel-devel-`uname -r`
|
|
9
9
|
yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel
|
10
10
|
|
11
11
|
yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
|
12
|
-
|
12
|
+
|
13
|
+
yum -y clean all
|
14
|
+
|
13
15
|
#Installing ruby
|
14
16
|
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
|
15
17
|
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
|
@@ -41,6 +43,9 @@ rm VBoxGuestAdditions_$VBOX_VERSION.iso
|
|
41
43
|
|
42
44
|
#poweroff -h
|
43
45
|
|
46
|
+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
47
|
+
|
48
|
+
|
44
49
|
exit
|
45
50
|
|
46
51
|
|
@@ -4,7 +4,7 @@ install
|
|
4
4
|
url --url=http://mirror.bytemark.co.uk/centos/5.5/os/i386
|
5
5
|
lang en_US.UTF-8
|
6
6
|
langsupport --default=en_US.UTF-8 en_US.UTF-8
|
7
|
-
keyboard
|
7
|
+
keyboard us
|
8
8
|
xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
|
9
9
|
network --device eth0 --bootproto dhcp
|
10
10
|
rootpw --iscrypted $1$vSG8FjAu$ekQ0grf16hS4G93HTPcco/
|
@@ -10,6 +10,9 @@ yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel
|
|
10
10
|
|
11
11
|
yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
|
12
12
|
|
13
|
+
|
14
|
+
yum -y clean all
|
15
|
+
|
13
16
|
#Installing ruby
|
14
17
|
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
|
15
18
|
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
|
@@ -39,6 +42,9 @@ umount /mnt
|
|
39
42
|
|
40
43
|
rm VBoxGuestAdditions_$VBOX_VERSION.iso
|
41
44
|
|
45
|
+
|
46
|
+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
47
|
+
|
42
48
|
#poweroff -h
|
43
49
|
|
44
50
|
exit
|
@@ -4,7 +4,7 @@ install
|
|
4
4
|
cdrom
|
5
5
|
lang en_US.UTF-8
|
6
6
|
langsupport --default=en_US.UTF-8 en_US.UTF-8
|
7
|
-
keyboard
|
7
|
+
keyboard us
|
8
8
|
xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
|
9
9
|
network --device eth0 --bootproto dhcp
|
10
10
|
rootpw --iscrypted $1$vSG8FjAu$ekQ0grf16hS4G93HTPcco/
|
@@ -9,6 +9,8 @@ yum -y install gcc bzip2 make kernel-devel-`uname -r`
|
|
9
9
|
yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel
|
10
10
|
|
11
11
|
yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
|
12
|
+
|
13
|
+
yum -y clean all
|
12
14
|
|
13
15
|
#Installing ruby
|
14
16
|
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
|
@@ -39,6 +41,8 @@ umount /mnt
|
|
39
41
|
|
40
42
|
rm VBoxGuestAdditions_$VBOX_VERSION.iso
|
41
43
|
|
44
|
+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
45
|
+
|
42
46
|
#poweroff -h
|
43
47
|
|
44
48
|
exit
|
@@ -65,7 +65,7 @@ d-i pkgsel/include string openssh-server ntp acpid
|
|
65
65
|
|
66
66
|
# Whether to upgrade packages after debootstrap.
|
67
67
|
# Allowed values: none, safe-upgrade, full-upgrade
|
68
|
-
d-i pkgsel/upgrade select
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
69
69
|
|
70
70
|
d-i grub-installer/only_debian boolean true
|
71
71
|
d-i grub-installer/with_other_os boolean true
|
@@ -65,7 +65,7 @@ d-i pkgsel/include string openssh-server ntp
|
|
65
65
|
|
66
66
|
# Whether to upgrade packages after debootstrap.
|
67
67
|
# Allowed values: none, safe-upgrade, full-upgrade
|
68
|
-
d-i pkgsel/upgrade select
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
69
69
|
|
70
70
|
d-i grub-installer/only_debian boolean true
|
71
71
|
d-i grub-installer/with_other_os boolean true
|
@@ -65,7 +65,7 @@ d-i pkgsel/include string openssh-server ntp
|
|
65
65
|
|
66
66
|
# Whether to upgrade packages after debootstrap.
|
67
67
|
# Allowed values: none, safe-upgrade, full-upgrade
|
68
|
-
d-i pkgsel/upgrade select
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
69
69
|
|
70
70
|
d-i grub-installer/only_debian boolean true
|
71
71
|
d-i grub-installer/with_other_os boolean true
|
@@ -65,7 +65,7 @@ d-i pkgsel/include string openssh-server ntp
|
|
65
65
|
|
66
66
|
# Whether to upgrade packages after debootstrap.
|
67
67
|
# Allowed values: none, safe-upgrade, full-upgrade
|
68
|
-
d-i pkgsel/upgrade select
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
69
69
|
|
70
70
|
d-i grub-installer/only_debian boolean true
|
71
71
|
d-i grub-installer/with_other_os boolean true
|
@@ -65,7 +65,7 @@ d-i pkgsel/include string openssh-server ntp
|
|
65
65
|
|
66
66
|
# Whether to upgrade packages after debootstrap.
|
67
67
|
# Allowed values: none, safe-upgrade, full-upgrade
|
68
|
-
d-i pkgsel/upgrade select
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
69
69
|
|
70
70
|
d-i grub-installer/only_debian boolean true
|
71
71
|
d-i grub-installer/with_other_os boolean true
|
@@ -65,7 +65,7 @@ d-i pkgsel/include string openssh-server ntp
|
|
65
65
|
|
66
66
|
# Whether to upgrade packages after debootstrap.
|
67
67
|
# Allowed values: none, safe-upgrade, full-upgrade
|
68
|
-
d-i pkgsel/upgrade select
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
69
69
|
|
70
70
|
d-i grub-installer/only_debian boolean true
|
71
71
|
d-i grub-installer/with_other_os boolean true
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# http://stackoverflow.com/questions/216202/why-does-an-ssh-remote-command-get-fewer-environment-variables-then-when-run-manu
|
2
|
+
|
3
|
+
Given /^I have no public keys set$/ do
|
4
|
+
@auth_methods = %w(password)
|
5
|
+
end
|
6
|
+
|
7
|
+
Then /^I can ssh to "([^\"]*)" with the following credentials:$/ do |host, table|
|
8
|
+
@auth_methods ||= %w(publickey password)
|
9
|
+
|
10
|
+
credentials = table.hashes
|
11
|
+
credentials.each do |creds|
|
12
|
+
lambda {
|
13
|
+
Net::SSH.start(host, creds["username"], :password => creds["password"], :auth_methods => @auth_methods)
|
14
|
+
}.should_not raise_error(Net::SSH::AuthenticationFailed)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^I can ssh to the following hosts with these credentials:$/ do |table|
|
19
|
+
@keys ||= []
|
20
|
+
@auth_methods ||= %w(password)
|
21
|
+
session_details = table.hashes
|
22
|
+
|
23
|
+
session_details.each do |session|
|
24
|
+
# initialize a list of keys and auth methods for just this session, as
|
25
|
+
# session can have session-specific keys mixed with global keys
|
26
|
+
session_keys = Array.new(@keys)
|
27
|
+
session_auth_methods = Array.new(@auth_methods)
|
28
|
+
|
29
|
+
# you can pass in a keyfile in the session details, so we need to
|
30
|
+
if session["keyfile"]
|
31
|
+
session_keys << session["keyfile"]
|
32
|
+
session_auth_methods << "publickey"
|
33
|
+
end
|
34
|
+
|
35
|
+
lambda {
|
36
|
+
Net::SSH.start(session["hostname"], session["username"], :password => session["password"],
|
37
|
+
:auth_methods => session_auth_methods,
|
38
|
+
:keys => session_keys)
|
39
|
+
}.should_not raise_error(Net::SSH::AuthenticationFailed)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Given /^I have the following public keys:$/ do |table|
|
44
|
+
@keys = []
|
45
|
+
public_key_paths = table.hashes
|
46
|
+
|
47
|
+
public_key_paths.each do |key|
|
48
|
+
File.exist?(key["keyfile"]).should be_true
|
49
|
+
@keys << key["keyfile"]
|
50
|
+
end
|
51
|
+
|
52
|
+
@auth_methods ||= %w(password)
|
53
|
+
@auth_methods << "publickey"
|
54
|
+
end
|
55
|
+
|
56
|
+
When /^I ssh to "([^\"]*)" with the following credentials:$/ do |hostname, table|
|
57
|
+
@keys = []
|
58
|
+
@auth_methods ||= %w(password)
|
59
|
+
session = table.hashes.first
|
60
|
+
session_keys = Array.new(@keys)
|
61
|
+
session_auth_methods = Array.new(@auth_methods)
|
62
|
+
if session["keyfile"]
|
63
|
+
session_keys << session["keyfile"]
|
64
|
+
session_auth_methods << "publickey"
|
65
|
+
end
|
66
|
+
session_port=22
|
67
|
+
if session["port"]
|
68
|
+
session_port=session["port"]
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
lambda {
|
73
|
+
@connection = Net::SSH.start(hostname, session["username"], :password => session["password"],
|
74
|
+
:auth_methods => session_auth_methods,
|
75
|
+
# This is the list of authorization methods to try. It defaults to “publickey”, “hostbased”, “password”, and “keyboard-interactive”. (These are also the only authorization methods that are supported.) If
|
76
|
+
#http://net-ssh.rubyforge.org/ssh/v1/chapter-2.html
|
77
|
+
:port => session_port,
|
78
|
+
:keys => session_keys)
|
79
|
+
# :keys => session_keys,:verbose => :debug)
|
80
|
+
}.should_not raise_error
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
When /^I run "([^\"]*)"$/ do |command|
|
85
|
+
@stdout=nil
|
86
|
+
@stderr=nil
|
87
|
+
@status=-9999
|
88
|
+
channel = @connection.open_channel do |ch|
|
89
|
+
ch.request_pty do |ch, success|
|
90
|
+
if success
|
91
|
+
# puts "pty successfully obtained"
|
92
|
+
else
|
93
|
+
# puts "could not obtain pty"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
ch.exec "#{command}" do |ch, success|
|
97
|
+
raise "could not execute command" unless success
|
98
|
+
|
99
|
+
# "on_data" is called when the process writes something to stdout
|
100
|
+
ch.on_data do |c, data|
|
101
|
+
if @stdout.nil?
|
102
|
+
@stdout=data
|
103
|
+
else
|
104
|
+
@stdout+=data
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# "on_extended_data" is called when the process writes something to stderr
|
109
|
+
ch.on_extended_data do |c, type, data|
|
110
|
+
if @stderr.nil?
|
111
|
+
@stderr=data
|
112
|
+
else
|
113
|
+
@stderr+=data
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
#exit code
|
118
|
+
#http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/a806b0f5dae4e1e2
|
119
|
+
channel.on_request("exit-status") do |ch, data|
|
120
|
+
exit_code = data.read_long
|
121
|
+
@status=exit_code
|
122
|
+
end
|
123
|
+
|
124
|
+
channel.on_request("exit-signal") do |ch, data|
|
125
|
+
puts "SIGNAL: #{data.read_long}"
|
126
|
+
end
|
127
|
+
|
128
|
+
ch.on_close {
|
129
|
+
puts "done!"
|
130
|
+
}
|
131
|
+
end
|
132
|
+
end
|
133
|
+
channel.wait
|
134
|
+
if !@stdout.nil?
|
135
|
+
if @output.nil?
|
136
|
+
@output=""
|
137
|
+
end
|
138
|
+
@output=@output+@stdout
|
139
|
+
end
|
140
|
+
if !@stderr.nil?
|
141
|
+
|
142
|
+
if @output.nil?
|
143
|
+
@output=""
|
144
|
+
end
|
145
|
+
@output=@output+@stderr
|
146
|
+
end
|
147
|
+
puts @output
|
148
|
+
|
149
|
+
#@output = @connection.exec!(command)
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
Then /^I should see "([^\"]*)" in the output$/ do |string|
|
154
|
+
@output.should =~ /#{string}/
|
155
|
+
end
|
156
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'net/ssh'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
|
3
|
+
w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
|
4
|
+
kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
|
5
|
+
hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
|
6
|
+
Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
|
7
|
+
yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
|
8
|
+
ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
|
9
|
+
Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
|
10
|
+
TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
|
11
|
+
iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
|
12
|
+
sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf
|
13
|
+
4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP
|
14
|
+
cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk
|
15
|
+
EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN
|
16
|
+
CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX
|
17
|
+
3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG
|
18
|
+
YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
|
19
|
+
3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
|
20
|
+
dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
|
21
|
+
6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
|
22
|
+
P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
|
23
|
+
llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
|
24
|
+
kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
|
25
|
+
+vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
|
26
|
+
NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Feature: vagrant box validation
|
2
|
+
As a valid vagrant box
|
3
|
+
I need to comply to a set of rules
|
4
|
+
|
5
|
+
Scenario: Checking login
|
6
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
7
|
+
| username| password | port |
|
8
|
+
| vagrant | vagrant | 7222 |
|
9
|
+
And I run "whoami"
|
10
|
+
Then I should see "vagrant" in the output
|
11
|
+
|
12
|
+
Scenario: Checking sudo
|
13
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
14
|
+
| username| password | port |
|
15
|
+
| vagrant | vagrant | 7222 |
|
16
|
+
And I run "sudo whoami"
|
17
|
+
Then I should see "root" in the output
|
18
|
+
|
19
|
+
Scenario: Checking ruby
|
20
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
21
|
+
| username| password | port |
|
22
|
+
| vagrant | vagrant | 7222 |
|
23
|
+
And I run ". /etc/profile ;ruby --version 2> /dev/null 1> /dev/null; echo $?"
|
24
|
+
Then I should see "0" in the output
|
25
|
+
|
26
|
+
Scenario: Checking gem
|
27
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
28
|
+
| username| password | port |
|
29
|
+
| vagrant | vagrant | 7222 |
|
30
|
+
And I run ". /etc/profile; gem --version 2> /dev/null 1> /dev/null ; echo $?"
|
31
|
+
Then I should see "0" in the output
|
32
|
+
|
33
|
+
Scenario: Checking chef
|
34
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
35
|
+
| username| password | port |
|
36
|
+
| vagrant | vagrant | 7222 |
|
37
|
+
And I run ". /etc/profile ;chef-client --version 2> /dev/null 1>/dev/null; echo $?"
|
38
|
+
Then I should see "0" in the output
|
39
|
+
|
40
|
+
Scenario: Checking puppet
|
41
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
42
|
+
| username| password | port |
|
43
|
+
| vagrant | vagrant | 7222 |
|
44
|
+
And I run ". /etc/profile ; puppet --version 2> /dev/null 1>/dev/null; echo $?"
|
45
|
+
Then I should see "0" in the output
|
46
|
+
|
47
|
+
Scenario: Checking puppet
|
48
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
49
|
+
| username| password |keyfile | port |
|
50
|
+
| vagrant | vagrant | vagrant-private.key | 7222 |
|
51
|
+
And I run "whoami"
|
52
|
+
Then I should see "vagrant" in the output
|
@@ -0,0 +1 @@
|
|
1
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
|
data/veewee.gemspec
CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency "thor", "~> 0.14.6"
|
21
21
|
s.add_dependency "highline", "~> 1.6.1"
|
22
22
|
s.add_dependency "progressbar"
|
23
|
+
s.add_dependency "cucumber"
|
24
|
+
s.add_dependency "rspec"
|
23
25
|
|
24
26
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
25
27
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: veewee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 12
|
10
|
+
version: 0.1.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Debois
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-19 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -115,6 +115,34 @@ dependencies:
|
|
115
115
|
prerelease: false
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
117
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
type: :runtime
|
127
|
+
requirement: *id007
|
128
|
+
name: cucumber
|
129
|
+
prerelease: false
|
130
|
+
- !ruby/object:Gem::Dependency
|
131
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
140
|
+
type: :runtime
|
141
|
+
requirement: *id008
|
142
|
+
name: rspec
|
143
|
+
prerelease: false
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
118
146
|
none: false
|
119
147
|
requirements:
|
120
148
|
- - ">="
|
@@ -126,7 +154,7 @@ dependencies:
|
|
126
154
|
- 0
|
127
155
|
version: 1.0.0
|
128
156
|
type: :development
|
129
|
-
requirement: *
|
157
|
+
requirement: *id009
|
130
158
|
name: bundler
|
131
159
|
prerelease: false
|
132
160
|
description: Expand the 'vagrant box' command to support the creation of base boxes from scratch
|
@@ -157,6 +185,7 @@ files:
|
|
157
185
|
- lib/veewee/shell.rb
|
158
186
|
- lib/veewee/ssh.rb
|
159
187
|
- lib/veewee/transaction.rb
|
188
|
+
- lib/veewee/utils.rb
|
160
189
|
- lib/veewee/version.rb
|
161
190
|
- lib/veewee/web.rb
|
162
191
|
- templates/Archlinux-latest/autorun0
|
@@ -204,6 +233,11 @@ files:
|
|
204
233
|
- trials/docu-vbox.txt
|
205
234
|
- trials/f.rb
|
206
235
|
- trials/t.rb
|
236
|
+
- validation/features/steps/ssh_steps.rb
|
237
|
+
- validation/support/env.rb
|
238
|
+
- validation/vagrant-private.key
|
239
|
+
- validation/vagrant.feature
|
240
|
+
- validation/vagrant.pub
|
207
241
|
- veewee.gemspec
|
208
242
|
has_rdoc: true
|
209
243
|
homepage: http://github.com/jedi4ever/veewee/
|