vbox 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +68 -0
- data/README.md +5 -0
- data/Rakefile +91 -0
- data/bin/vbox +73 -0
- data/lib/java/README.txt +5 -0
- data/lib/java/dir2floppy.jar +0 -0
- data/lib/java/dir2floppy.java +134 -0
- data/lib/vagrant_init.rb +6 -0
- data/lib/vbox.rb +2 -0
- data/lib/vbox/command.rb +82 -0
- data/lib/vbox/config.rb +5 -0
- data/lib/vbox/export.rb +65 -0
- data/lib/vbox/scancode.rb +208 -0
- data/lib/vbox/session.rb +893 -0
- data/lib/vbox/shell.rb +54 -0
- data/lib/vbox/ssh.rb +193 -0
- data/lib/vbox/transaction.rb +122 -0
- data/lib/vbox/utils.rb +26 -0
- data/lib/vbox/version.rb +3 -0
- data/lib/vbox/web.rb +48 -0
- data/templates/CentOS-5.7-i386-netboot/definition.rb +16 -0
- data/templates/CentOS-5.7-i386-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.7-i386-netboot/postinstall.sh +53 -0
- data/templates/CentOS-5.7-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-5.7-x86_64-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +60 -0
- data/templates/CentOS-6.0-i386-netboot/definition.rb +16 -0
- data/templates/CentOS-6.0-i386-netboot/ks.cfg +52 -0
- data/templates/CentOS-6.0-i386-netboot/postinstall.sh +30 -0
- data/templates/CentOS-6.0-i386/definition.rb +17 -0
- data/templates/CentOS-6.0-i386/ks.cfg +47 -0
- data/templates/CentOS-6.0-i386/postinstall.sh +48 -0
- data/templates/CentOS-6.0-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +52 -0
- data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +30 -0
- data/templates/CentOS-6.0-x86_64/definition.rb +17 -0
- data/templates/CentOS-6.0-x86_64/ks.cfg +47 -0
- data/templates/CentOS-6.0-x86_64/postinstall.sh +48 -0
- data/templates/Debian-6.0.3-amd64-netboot/definition.rb +42 -0
- data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +80 -0
- data/templates/Debian-6.0.3-amd64-netboot/preseed.cfg +42 -0
- data/templates/Debian-6.0.3-i386-netboot/definition.rb +44 -0
- data/templates/Debian-6.0.3-i386-netboot/postinstall.sh +80 -0
- data/templates/Debian-6.0.3-i386-netboot/preseed.cfg +42 -0
- data/templates/Fedora-15-i386-netboot/definition.rb +17 -0
- data/templates/Fedora-15-i386-netboot/ks.cfg +82 -0
- data/templates/Fedora-15-i386-netboot/postinstall.sh +18 -0
- data/templates/Fedora-15-i386/definition.rb +17 -0
- data/templates/Fedora-15-i386/ks.cfg +64 -0
- data/templates/Fedora-15-i386/postinstall.sh +33 -0
- data/templates/Fedora-15-x86_64-netboot/definition.rb +29 -0
- data/templates/Fedora-15-x86_64-netboot/ks.cfg +64 -0
- data/templates/Fedora-15-x86_64-netboot/postinstall.sh +33 -0
- data/templates/Fedora-15-x86_64/definition.rb +17 -0
- data/templates/Fedora-15-x86_64/ks.cfg +64 -0
- data/templates/Fedora-15-x86_64/postinstall.sh +33 -0
- data/templates/Sysrescuecd-2.0.0-experimental/autorun0 +3 -0
- data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +20 -0
- data/templates/archlinux-i386-netboot/aif.cfg +34 -0
- data/templates/archlinux-i386-netboot/definition.rb +29 -0
- data/templates/archlinux-i386-netboot/postinstall.sh +87 -0
- data/templates/archlinux-i386-netboot/postinstall2.sh +28 -0
- data/templates/archlinux-i386/aif.cfg +33 -0
- data/templates/archlinux-i386/definition.rb +29 -0
- data/templates/archlinux-i386/postinstall.sh +106 -0
- data/templates/archlinux-x86_64-netboot/aif.cfg +34 -0
- data/templates/archlinux-x86_64-netboot/definition.rb +29 -0
- data/templates/archlinux-x86_64-netboot/postinstall.sh +90 -0
- data/templates/archlinux-x86_64-netboot/postinstall2.sh +28 -0
- data/templates/archlinux-x86_64/aif.cfg +33 -0
- data/templates/archlinux-x86_64/definition.rb +29 -0
- data/templates/archlinux-x86_64/postinstall.sh +90 -0
- data/templates/archlinux-x86_64/postinstall2.sh +38 -0
- data/templates/freebsd-8.2-experimental/definition.rb +19 -0
- data/templates/freebsd-8.2-experimental/postinstall.sh +191 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +35 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/pcinstall.fbg.cfg +58 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +93 -0
- data/templates/freebsd-8.2-pcbsd-i386/definition.rb +31 -0
- data/templates/freebsd-8.2-pcbsd-i386/pcinstall.fbg.cfg +57 -0
- data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +93 -0
- data/templates/gentoo-latest-i386-experimental/definition.rb +29 -0
- data/templates/gentoo-latest-i386-experimental/postinstall.sh +184 -0
- data/templates/openSUSE-11.4-DVD-i586/autoinst_de.xml +1284 -0
- data/templates/openSUSE-11.4-DVD-i586/autoinst_en.xml +1284 -0
- data/templates/openSUSE-11.4-DVD-i586/definition.rb +28 -0
- data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-DVD-x86_64/autoinst_de.xml +1459 -0
- data/templates/openSUSE-11.4-DVD-x86_64/autoinst_en.xml +1459 -0
- data/templates/openSUSE-11.4-DVD-x86_64/definition.rb +28 -0
- data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-NET-i586/autoinst_de.xml +1278 -0
- data/templates/openSUSE-11.4-NET-i586/autoinst_en.xml +1278 -0
- data/templates/openSUSE-11.4-NET-i586/definition.rb +28 -0
- data/templates/openSUSE-11.4-NET-i586/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-NET-x86_64/autoinst_de.xml +1453 -0
- data/templates/openSUSE-11.4-NET-x86_64/autoinst_en.xml +1453 -0
- data/templates/openSUSE-11.4-NET-x86_64/definition.rb +28 -0
- data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +43 -0
- data/templates/solaris-11-express-i386/auto_install/ai.dtd +58 -0
- data/templates/solaris-11-express-i386/auto_install/ai_manifest.xml +241 -0
- data/templates/solaris-11-express-i386/auto_install/configuration.dtd +44 -0
- data/templates/solaris-11-express-i386/auto_install/default.xml +124 -0
- data/templates/solaris-11-express-i386/auto_install/default.xml.orig +124 -0
- data/templates/solaris-11-express-i386/auto_install/sc_profiles/static_network.xml +105 -0
- data/templates/solaris-11-express-i386/auto_install/software.dtd +105 -0
- data/templates/solaris-11-express-i386/auto_install/target.dtd +196 -0
- data/templates/solaris-11-express-i386/default.xml +121 -0
- data/templates/solaris-11-express-i386/definition.rb +65 -0
- data/templates/solaris-11-express-i386/postinstall.sh +98 -0
- data/templates/ubuntu-10.04.3-server-amd64/definition.rb +54 -0
- data/templates/ubuntu-10.04.3-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-10.04.3-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-10.04.3-server-i386/definition.rb +24 -0
- data/templates/ubuntu-10.04.3-server-i386/postinstall.sh +91 -0
- data/templates/ubuntu-10.04.3-server-i386/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-amd64/definition.rb +35 -0
- data/templates/ubuntu-11.10-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-11.10-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-i386/definition.rb +35 -0
- data/templates/ubuntu-11.10-server-i386/postinstall.sh +90 -0
- data/templates/ubuntu-11.10-server-i386/preseed.cfg +87 -0
- data/validation/features/steps/ssh_steps.rb +169 -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/vbox.gemspec +32 -0
- metadata +338 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# postinstall.sh created from Mitchell's official lucid32/64 baseboxes
|
|
2
|
+
|
|
3
|
+
date > /etc/vagrant_box_build_time
|
|
4
|
+
|
|
5
|
+
# Apt-install various things necessary for Ruby, guest additions,
|
|
6
|
+
# etc., and remove optional things to trim down the machine.
|
|
7
|
+
apt-get -y update
|
|
8
|
+
apt-get -y upgrade
|
|
9
|
+
apt-get -y install linux-headers-$(uname -r) build-essential
|
|
10
|
+
apt-get -y install zlib1g-dev libssl-dev libreadline5
|
|
11
|
+
apt-get clean
|
|
12
|
+
|
|
13
|
+
# Setup sudo to allow no-password sudo for "admin"
|
|
14
|
+
cp /etc/sudoers /etc/sudoers.orig
|
|
15
|
+
sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
|
|
16
|
+
sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers
|
|
17
|
+
|
|
18
|
+
# Install NFS client
|
|
19
|
+
apt-get -y install nfs-common
|
|
20
|
+
|
|
21
|
+
# Install Ruby from source in /opt so that users of Vagrant
|
|
22
|
+
# can install their own Rubies using packages or however.
|
|
23
|
+
# We must install the 1.8.x series since Puppet doesn't support
|
|
24
|
+
# Ruby 1.9 yet.
|
|
25
|
+
wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.gz
|
|
26
|
+
tar xvzf ruby-1.8.7-p352.tar.gz
|
|
27
|
+
cd ruby-1.8.7-p352
|
|
28
|
+
./configure --prefix=/opt/ruby
|
|
29
|
+
make
|
|
30
|
+
make install
|
|
31
|
+
cd ..
|
|
32
|
+
rm -rf ruby-1.8.7-p352*
|
|
33
|
+
|
|
34
|
+
# Install RubyGems 1.7.2
|
|
35
|
+
wget http://production.cf.rubygems.org/rubygems/rubygems-1.7.2.tgz
|
|
36
|
+
tar xzf rubygems-1.7.2.tgz
|
|
37
|
+
cd rubygems-1.7.2
|
|
38
|
+
/opt/ruby/bin/ruby setup.rb
|
|
39
|
+
cd ..
|
|
40
|
+
rm -rf rubygems-1.7.2*
|
|
41
|
+
|
|
42
|
+
# Installing chef & Puppet
|
|
43
|
+
/opt/ruby/bin/gem install chef --no-ri --no-rdoc
|
|
44
|
+
/opt/ruby/bin/gem install puppet --no-ri --no-rdoc
|
|
45
|
+
|
|
46
|
+
# Add /opt/ruby/bin to the global path as the last resort so
|
|
47
|
+
# Ruby, RubyGems, and Chef/Puppet are visible
|
|
48
|
+
echo 'PATH=$PATH:/opt/ruby/bin/'> /etc/profile.d/vagrantruby.sh
|
|
49
|
+
|
|
50
|
+
# Installing vagrant keys
|
|
51
|
+
mkdir /home/vagrant/.ssh
|
|
52
|
+
chmod 700 /home/vagrant/.ssh
|
|
53
|
+
cd /home/vagrant/.ssh
|
|
54
|
+
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
|
|
55
|
+
chmod 600 /home/vagrant/.ssh/authorized_keys
|
|
56
|
+
chown -R vagrant /home/vagrant/.ssh
|
|
57
|
+
|
|
58
|
+
# Installing the virtualbox guest additions
|
|
59
|
+
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
|
|
60
|
+
cd /tmp
|
|
61
|
+
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
|
|
62
|
+
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
|
|
63
|
+
sh /mnt/VBoxLinuxAdditions.run
|
|
64
|
+
umount /mnt
|
|
65
|
+
|
|
66
|
+
rm VBoxGuestAdditions_$VBOX_VERSION.iso
|
|
67
|
+
|
|
68
|
+
# Remove items used for building, since they aren't needed anymore
|
|
69
|
+
apt-get -y remove linux-headers-$(uname -r) build-essential
|
|
70
|
+
apt-get -y autoremove
|
|
71
|
+
|
|
72
|
+
# Zero out the free space to save space in the final image:
|
|
73
|
+
# dd if=/dev/zero of=/EMPTY bs=1M
|
|
74
|
+
# rm -f /EMPTY
|
|
75
|
+
|
|
76
|
+
# Removing leftover leases and persistent rules
|
|
77
|
+
echo "cleaning up dhcp leases"
|
|
78
|
+
rm /var/lib/dhcp3/*
|
|
79
|
+
|
|
80
|
+
# Make sure Udev doesn't block our network
|
|
81
|
+
# http://6.ptmc.org/?p=164
|
|
82
|
+
echo "cleaning up udev rules"
|
|
83
|
+
rm /etc/udev/rules.d/70-persistent-net.rules
|
|
84
|
+
mkdir /etc/udev/rules.d/70-persistent-net.rules
|
|
85
|
+
rm -rf /dev/.udev/
|
|
86
|
+
rm /lib/udev/rules.d/75-persistent-net-generator.rules
|
|
87
|
+
|
|
88
|
+
echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
|
|
89
|
+
echo "pre-up sleep 2" >> /etc/network/interfaces
|
|
90
|
+
exit
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
## Options to set on the command line
|
|
2
|
+
d-i debian-installer/locale string en_US.utf8
|
|
3
|
+
d-i console-setup/ask_detect boolean false
|
|
4
|
+
d-i console-setup/layout string USA
|
|
5
|
+
|
|
6
|
+
#d-i netcfg/get_hostname string dummy
|
|
7
|
+
d-i netcfg/get_hostname string unassigned-hostname
|
|
8
|
+
d-i netcfg/get_domain string unassigned-domain
|
|
9
|
+
|
|
10
|
+
# Continue without a default route
|
|
11
|
+
# Not working , specify a dummy in the DHCP
|
|
12
|
+
#d-i netcfg/no_default_route boolean
|
|
13
|
+
|
|
14
|
+
d-i time/zone string UTC
|
|
15
|
+
d-i clock-setup/utc-auto boolean true
|
|
16
|
+
d-i clock-setup/utc boolean true
|
|
17
|
+
|
|
18
|
+
d-i kbd-chooser/method select American English
|
|
19
|
+
|
|
20
|
+
d-i netcfg/wireless_wep string
|
|
21
|
+
|
|
22
|
+
d-i base-installer/kernel/override-image string linux-server
|
|
23
|
+
#d-i base-installer/kernel/override-image string linux-image-2.6.32-21-generic
|
|
24
|
+
|
|
25
|
+
# Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
|
|
26
|
+
d-i debconf debconf/frontend select Noninteractive
|
|
27
|
+
|
|
28
|
+
d-i pkgsel/install-language-support boolean false
|
|
29
|
+
tasksel tasksel/first multiselect standard, ubuntu-server
|
|
30
|
+
|
|
31
|
+
#d-i partman-auto/method string regular
|
|
32
|
+
d-i partman-auto/method string lvm
|
|
33
|
+
#d-i partman-auto/purge_lvm_from_device boolean true
|
|
34
|
+
|
|
35
|
+
d-i partman-lvm/confirm boolean true
|
|
36
|
+
d-i partman-lvm/device_remove_lvm boolean true
|
|
37
|
+
d-i partman-auto/choose_recipe select atomic
|
|
38
|
+
|
|
39
|
+
d-i partman/confirm_write_new_label boolean true
|
|
40
|
+
d-i partman/confirm_nooverwrite boolean true
|
|
41
|
+
d-i partman/choose_partition select finish
|
|
42
|
+
d-i partman/confirm boolean true
|
|
43
|
+
|
|
44
|
+
#http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9626883
|
|
45
|
+
#Message: "write the changes to disk and configure lvm preseed"
|
|
46
|
+
#http://serverfault.com/questions/189328/ubuntu-kickstart-installation-using-lvm-waits-for-input
|
|
47
|
+
#preseed partman-lvm/confirm_nooverwrite boolean true
|
|
48
|
+
|
|
49
|
+
# Write the changes to disks and configure LVM?
|
|
50
|
+
d-i partman-lvm/confirm boolean true
|
|
51
|
+
d-i partman-lvm/confirm_nooverwrite boolean true
|
|
52
|
+
d-i partman-auto-lvm/guided_size string max
|
|
53
|
+
|
|
54
|
+
## Default user, we can get away with a recipe to change this
|
|
55
|
+
d-i passwd/user-fullname string vagrant
|
|
56
|
+
d-i passwd/username string vagrant
|
|
57
|
+
d-i passwd/user-password password vagrant
|
|
58
|
+
d-i passwd/user-password-again password vagrant
|
|
59
|
+
d-i user-setup/encrypt-home boolean false
|
|
60
|
+
d-i user-setup/allow-password-weak boolean true
|
|
61
|
+
|
|
62
|
+
## minimum is puppet and ssh and ntp
|
|
63
|
+
# Individual additional packages to install
|
|
64
|
+
d-i pkgsel/include string openssh-server ntp
|
|
65
|
+
|
|
66
|
+
# Whether to upgrade packages after debootstrap.
|
|
67
|
+
# Allowed values: none, safe-upgrade, full-upgrade
|
|
68
|
+
d-i pkgsel/upgrade select full-upgrade
|
|
69
|
+
|
|
70
|
+
d-i grub-installer/only_debian boolean true
|
|
71
|
+
d-i grub-installer/with_other_os boolean true
|
|
72
|
+
d-i finish-install/reboot_in_progress note
|
|
73
|
+
|
|
74
|
+
#For the update
|
|
75
|
+
d-i pkgsel/update-policy select none
|
|
76
|
+
|
|
77
|
+
# debconf-get-selections --install
|
|
78
|
+
#Use mirror
|
|
79
|
+
#d-i apt-setup/use_mirror boolean true
|
|
80
|
+
#d-i mirror/country string manual
|
|
81
|
+
#choose-mirror-bin mirror/protocol string http
|
|
82
|
+
#choose-mirror-bin mirror/http/hostname string 192.168.4.150
|
|
83
|
+
#choose-mirror-bin mirror/http/directory string /ubuntu
|
|
84
|
+
#choose-mirror-bin mirror/suite select maverick
|
|
85
|
+
#d-i debian-installer/allow_unauthenticated string true
|
|
86
|
+
|
|
87
|
+
choose-mirror-bin mirror/http/proxy string
|
|
@@ -0,0 +1,169 @@
|
|
|
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 = ENV['VEEWEE_SSH_PORT'] || 7222
|
|
67
|
+
if session["port"]
|
|
68
|
+
session_port=session["port"]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
lambda {
|
|
73
|
+
# 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
|
|
74
|
+
# http://net-ssh.rubyforge.org/ssh/v1/chapter-2.html
|
|
75
|
+
key_auth_tried = false
|
|
76
|
+
ssh_options = {:password => session["password"], :auth_methods => session_auth_methods, :port => session_port, :keys => session_keys}
|
|
77
|
+
# ssh_options[:verbose] => :debug
|
|
78
|
+
begin
|
|
79
|
+
print "."
|
|
80
|
+
@connection = Net::SSH.start(session["hostname"], session["username"], ssh_options)
|
|
81
|
+
rescue Net::SSH::AuthenticationFailed
|
|
82
|
+
ssh_options[:keys] = Array.new([File.join(File.dirname(__FILE__),'./../../vagrant')])
|
|
83
|
+
ssh_options.delete(:password)
|
|
84
|
+
ssh_options[:auth_methods] = ['publickey']
|
|
85
|
+
if key_auth_tried
|
|
86
|
+
raise
|
|
87
|
+
else
|
|
88
|
+
key_auth_tried = true
|
|
89
|
+
retry
|
|
90
|
+
end
|
|
91
|
+
rescue Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNABORTED, Errno::ECONNRESET, Errno::ENETUNREACH
|
|
92
|
+
sleep 5
|
|
93
|
+
end
|
|
94
|
+
}.should_not raise_error
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
#
|
|
98
|
+
When /^I run "([^\"]*)"$/ do |command|
|
|
99
|
+
@stdout=nil
|
|
100
|
+
@stderr=nil
|
|
101
|
+
@status=-9999
|
|
102
|
+
channel = @connection.open_channel do |ch|
|
|
103
|
+
ch.request_pty do |ch, success|
|
|
104
|
+
if success
|
|
105
|
+
# puts "pty successfully obtained"
|
|
106
|
+
else
|
|
107
|
+
# puts "could not obtain pty"
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
ch.exec "#{command}" do |ch, success|
|
|
111
|
+
raise "could not execute command" unless success
|
|
112
|
+
|
|
113
|
+
# "on_data" is called when the process writes something to stdout
|
|
114
|
+
ch.on_data do |c, data|
|
|
115
|
+
if @stdout.nil?
|
|
116
|
+
@stdout=data
|
|
117
|
+
else
|
|
118
|
+
@stdout+=data
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# "on_extended_data" is called when the process writes something to stderr
|
|
123
|
+
ch.on_extended_data do |c, type, data|
|
|
124
|
+
if @stderr.nil?
|
|
125
|
+
@stderr=data
|
|
126
|
+
else
|
|
127
|
+
@stderr+=data
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
#exit code
|
|
132
|
+
#http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/a806b0f5dae4e1e2
|
|
133
|
+
channel.on_request("exit-status") do |ch, data|
|
|
134
|
+
exit_code = data.read_long
|
|
135
|
+
@status=exit_code
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
channel.on_request("exit-signal") do |ch, data|
|
|
139
|
+
puts "SIGNAL: #{data.read_long}"
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
ch.on_close {
|
|
143
|
+
puts "done!"
|
|
144
|
+
}
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
channel.wait
|
|
148
|
+
if !@stdout.nil?
|
|
149
|
+
if @output.nil?
|
|
150
|
+
@output=""
|
|
151
|
+
end
|
|
152
|
+
@output=@output+@stdout
|
|
153
|
+
end
|
|
154
|
+
if !@stderr.nil?
|
|
155
|
+
|
|
156
|
+
if @output.nil?
|
|
157
|
+
@output=""
|
|
158
|
+
end
|
|
159
|
+
@output=@output+@stderr
|
|
160
|
+
end
|
|
161
|
+
puts @output
|
|
162
|
+
|
|
163
|
+
#@output = @connection.exec!(command)
|
|
164
|
+
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
Then /^I should see "([^\"]*)" in the output$/ do |string|
|
|
168
|
+
@output.should =~ /#{string}/
|
|
169
|
+
end
|
|
@@ -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 |
|
|
8
|
+
| vagrant | vagrant |
|
|
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 |
|
|
15
|
+
| vagrant | vagrant |
|
|
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 |
|
|
22
|
+
| vagrant | vagrant |
|
|
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 |
|
|
29
|
+
| vagrant | vagrant |
|
|
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 |
|
|
36
|
+
| vagrant | vagrant |
|
|
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 |
|
|
43
|
+
| vagrant | vagrant |
|
|
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 shared folders
|
|
48
|
+
When I ssh to "127.0.0.1" with the following credentials:
|
|
49
|
+
| username| password |keyfile |
|
|
50
|
+
| vagrant | vagrant | vagrant-private.key |
|
|
51
|
+
And I run "mount|grep vbox-validation"
|
|
52
|
+
Then I should see "vbox-validation" in the output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
|
data/vbox.gemspec
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path("../lib/vbox/version", __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "vbox"
|
|
6
|
+
s.version = Vbox::VERSION
|
|
7
|
+
s.platform = Gem::Platform::RUBY
|
|
8
|
+
s.authors = ["Georg Ryter"]
|
|
9
|
+
s.email = ["georg.ryter@online.de"]
|
|
10
|
+
s.homepage = "http://github.com/minihub/vbox/"
|
|
11
|
+
s.summary = %q{Vagrant vbox creation}
|
|
12
|
+
s.description = %q{Expand the 'vagrant box' command to support the creation of base boxes from scratch}
|
|
13
|
+
|
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
|
15
|
+
s.rubyforge_project = "vbox"
|
|
16
|
+
|
|
17
|
+
s.add_dependency "vagrant", "~> 0.8.2"
|
|
18
|
+
s.add_dependency "net-ssh", "~> 2.1.0"
|
|
19
|
+
s.add_dependency "popen4", "~> 0.1.2"
|
|
20
|
+
s.add_dependency "thor", "~> 0.14.6"
|
|
21
|
+
s.add_dependency "highline", "~> 1.6.1"
|
|
22
|
+
s.add_dependency "progressbar"
|
|
23
|
+
s.add_dependency "cucumber", "~> 1.0.2"
|
|
24
|
+
s.add_dependency "rspec", "~> 2.5.0"
|
|
25
|
+
|
|
26
|
+
s.add_development_dependency "bundler", ">= 1.0.0"
|
|
27
|
+
|
|
28
|
+
s.files = `git ls-files`.split("\n")
|
|
29
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
|
30
|
+
s.require_path = 'lib'
|
|
31
|
+
end
|
|
32
|
+
|