HeSYINUvSBZfxqA-veewee 0.2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +69 -0
- data/HeSYINUvSBZfxqA-veewee.gemspec +33 -0
- data/README.md +198 -0
- data/Rakefile +92 -0
- data/bin/veewee +79 -0
- data/lib/java/README.txt +5 -0
- data/lib/java/dir2floppy.jar +0 -0
- data/lib/java/dir2floppy.java +137 -0
- data/lib/vagrant_init.rb +6 -0
- data/lib/veewee/command.rb +82 -0
- data/lib/veewee/config.rb +5 -0
- data/lib/veewee/export.rb +81 -0
- data/lib/veewee/scancode.rb +151 -0
- data/lib/veewee/session.rb +783 -0
- data/lib/veewee/shell.rb +54 -0
- data/lib/veewee/ssh.rb +193 -0
- data/lib/veewee/transaction.rb +122 -0
- data/lib/veewee/utils.rb +26 -0
- data/lib/veewee/version.rb +3 -0
- data/lib/veewee/web.rb +48 -0
- data/lib/veewee.rb +2 -0
- data/templates/CentOS-4.8-i386/definition.rb +14 -0
- data/templates/CentOS-4.8-i386/ks.cfg +45 -0
- data/templates/CentOS-4.8-i386/postinstall.sh +55 -0
- data/templates/CentOS-5.6-i386/definition.rb +17 -0
- data/templates/CentOS-5.6-i386/ks.cfg +45 -0
- data/templates/CentOS-5.6-i386/postinstall.sh +50 -0
- data/templates/CentOS-5.6-i386-netboot/definition.rb +16 -0
- data/templates/CentOS-5.6-i386-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.6-i386-netboot/postinstall.sh +52 -0
- data/templates/CentOS-5.6-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +60 -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-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-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/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/Debian-5.0.8-amd64-netboot/definition.rb +39 -0
- data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +60 -0
- data/templates/Debian-5.0.8-amd64-netboot/preseed.cfg +312 -0
- data/templates/Debian-5.0.8-i386-netboot/definition.rb +39 -0
- data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +60 -0
- data/templates/Debian-5.0.8-i386-netboot/preseed.cfg +312 -0
- data/templates/Debian-6.0.2-amd64-netboot/definition.rb +39 -0
- data/templates/Debian-6.0.2-amd64-netboot/postinstall.sh +71 -0
- data/templates/Debian-6.0.2-amd64-netboot/preseed.cfg +312 -0
- data/templates/Debian-6.0.2-i386-netboot/definition.rb +41 -0
- data/templates/Debian-6.0.2-i386-netboot/postinstall.sh +83 -0
- data/templates/Debian-6.0.2-i386-netboot/preseed.cfg +312 -0
- data/templates/Fedora-14-amd64/definition.rb +16 -0
- data/templates/Fedora-14-amd64/ks.cfg +41 -0
- data/templates/Fedora-14-amd64/postinstall.sh +54 -0
- data/templates/Fedora-14-amd64-netboot/definition.rb +16 -0
- data/templates/Fedora-14-amd64-netboot/ks.cfg +40 -0
- data/templates/Fedora-14-amd64-netboot/postinstall.sh +54 -0
- data/templates/Fedora-14-i386/definition.rb +16 -0
- data/templates/Fedora-14-i386/ks.cfg +41 -0
- data/templates/Fedora-14-i386/postinstall.sh +54 -0
- data/templates/Fedora-14-i386-netboot/definition.rb +16 -0
- data/templates/Fedora-14-i386-netboot/ks.cfg +40 -0
- data/templates/Fedora-14-i386-netboot/postinstall.sh +54 -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-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/Sysrescuecd-2.0.0-experimental/autorun0 +3 -0
- data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +20 -0
- data/templates/archlinux-i386/aif.cfg +33 -0
- data/templates/archlinux-i386/definition.rb +29 -0
- data/templates/archlinux-i386/postinstall.sh +95 -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 +95 -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/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/freebsd-8.2-pcbsd-i386-netboot/definition.rb +34 -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/gentoo-latest-i386-experimental/definition.rb +29 -0
- data/templates/gentoo-latest-i386-experimental/postinstall.sh +184 -0
- data/templates/openindiana-148-ai-x86/auto_install/ai.dtd +58 -0
- data/templates/openindiana-148-ai-x86/auto_install/ai_manifest.xml +241 -0
- data/templates/openindiana-148-ai-x86/auto_install/configuration.dtd +44 -0
- data/templates/openindiana-148-ai-x86/auto_install/default.xml +121 -0
- data/templates/openindiana-148-ai-x86/auto_install/default.xml.orig +124 -0
- data/templates/openindiana-148-ai-x86/auto_install/sc_profiles/static_network.xml +105 -0
- data/templates/openindiana-148-ai-x86/auto_install/software.dtd +105 -0
- data/templates/openindiana-148-ai-x86/auto_install/target.dtd +196 -0
- data/templates/openindiana-148-ai-x86/default.xml +121 -0
- data/templates/openindiana-148-ai-x86/definition.rb +59 -0
- data/templates/openindiana-148-ai-x86/postinstall.sh +103 -0
- data/templates/opensuse-11.4-i386-experimental/README +11 -0
- data/templates/opensuse-11.4-i386-experimental/autoinst.xml +1269 -0
- data/templates/opensuse-11.4-i386-experimental/autoinst.xml.generated +1269 -0
- data/templates/opensuse-11.4-i386-experimental/autoinst.xml.tweaked +1269 -0
- data/templates/opensuse-11.4-i386-experimental/definition.rb +31 -0
- data/templates/opensuse-11.4-i386-experimental/postinstall.sh +90 -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.2-amd64-netboot/definition.rb +23 -0
- data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +90 -0
- data/templates/ubuntu-10.04.2-amd64-netboot/preseed.cfg +89 -0
- data/templates/ubuntu-10.04.2-server-amd64/definition.rb +57 -0
- data/templates/ubuntu-10.04.2-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-10.04.2-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-10.04.2-server-amd64-alt/definition.rb +57 -0
- data/templates/ubuntu-10.04.2-server-amd64-alt/postinstall.sh +249 -0
- data/templates/ubuntu-10.04.2-server-amd64-alt/preseed.cfg +124 -0
- data/templates/ubuntu-10.04.2-server-i386/definition.rb +24 -0
- data/templates/ubuntu-10.04.2-server-i386/postinstall.sh +91 -0
- data/templates/ubuntu-10.04.2-server-i386/preseed.cfg +87 -0
- data/templates/ubuntu-10.04.2-server-i386-netboot/definition.rb +23 -0
- data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +90 -0
- data/templates/ubuntu-10.04.2-server-i386-netboot/preseed.cfg +89 -0
- data/templates/ubuntu-10.10-server-amd64/definition.rb +24 -0
- data/templates/ubuntu-10.10-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-10.10-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-10.10-server-amd64-netboot/definition.rb +24 -0
- data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +90 -0
- data/templates/ubuntu-10.10-server-amd64-netboot/preseed.cfg +89 -0
- data/templates/ubuntu-10.10-server-i386/definition.rb +24 -0
- data/templates/ubuntu-10.10-server-i386/postinstall.sh +90 -0
- data/templates/ubuntu-10.10-server-i386/preseed.cfg +87 -0
- data/templates/ubuntu-10.10-server-i386-netboot/definition.rb +24 -0
- data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +90 -0
- data/templates/ubuntu-10.10-server-i386-netboot/preseed.cfg +89 -0
- data/templates/ubuntu-11.04-server-amd64/definition.rb +24 -0
- data/templates/ubuntu-11.04-server-amd64/postinstall.sh +90 -0
- data/templates/ubuntu-11.04-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-11.04-server-i386/definition.rb +24 -0
- data/templates/ubuntu-11.04-server-i386/postinstall.sh +90 -0
- data/templates/ubuntu-11.04-server-i386/preseed.cfg +87 -0
- data/templates/ubuntu-8.04.4-server-amd64/definition.rb +25 -0
- data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +68 -0
- data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +88 -0
- data/templates/ubuntu-8.04.4-server-i386/definition.rb +25 -0
- data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +47 -0
- data/templates/ubuntu-8.04.4-server-i386/preseed.cfg +87 -0
- data/templates/windows-2008R2-amd64/Autounattend.xml +132 -0
- data/templates/windows-2008R2-amd64/README.md +68 -0
- data/templates/windows-2008R2-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R2-amd64/definition.rb +16 -0
- data/templates/windows-2008R2-amd64/install-cygwin-sshd.bat +38 -0
- data/templates/windows-2008R2-amd64/install-winrm.bat +6 -0
- data/templates/windows-2008R2-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R2-amd64/postinstall.sh +122 -0
- data/templates/windows-2008R2-amd64/winrm.rb +8 -0
- data/trials/docu-vbox.txt +83 -0
- data/trials/f.rb +29 -0
- data/trials/t.rb +15 -0
- data/validation/features/steps/ssh_steps.rb +170 -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 +33 -0
- data/vendor/cache/Platform-0.4.0.gem +0 -0
- data/vendor/cache/archive-tar-minitar-0.5.2.gem +0 -0
- data/vendor/cache/builder-3.0.0.gem +0 -0
- data/vendor/cache/cucumber-1.0.2.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
- data/vendor/cache/erubis-2.7.0.gem +0 -0
- data/vendor/cache/ffi-1.0.9.gem +0 -0
- data/vendor/cache/gherkin-2.4.6.gem +0 -0
- data/vendor/cache/highline-1.6.2.gem +0 -0
- data/vendor/cache/i18n-0.5.0.gem +0 -0
- data/vendor/cache/json-1.5.3.gem +0 -0
- data/vendor/cache/net-scp-1.0.4.gem +0 -0
- data/vendor/cache/net-ssh-2.1.4.gem +0 -0
- data/vendor/cache/open4-1.1.0.gem +0 -0
- data/vendor/cache/popen4-0.1.2.gem +0 -0
- data/vendor/cache/progressbar-0.9.1.gem +0 -0
- data/vendor/cache/rspec-2.5.0.gem +0 -0
- data/vendor/cache/rspec-core-2.5.2.gem +0 -0
- data/vendor/cache/rspec-expectations-2.5.0.gem +0 -0
- data/vendor/cache/rspec-mocks-2.5.0.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.6.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/vagrant-0.8.2.gem +0 -0
- data/vendor/cache/virtualbox-0.9.1.gem +0 -0
- metadata +417 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
You can download a free trial of Windows 2008 R2
|
2
|
+
|
3
|
+
My downloaded iso was named '7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso'
|
4
|
+
|
5
|
+
- place it in a directory called iso
|
6
|
+
|
7
|
+
The installation uses the Standard way for Windows Unattended installation. The XML file was created using the Windows AIK kit, but the file can also be edited by hand.
|
8
|
+
|
9
|
+
- Building the machine creates a floppy that contains:
|
10
|
+
- AutoUnattend.xml (that will configure the windows)
|
11
|
+
- cygwin-setup.exe (the standard setup.exe cygwin binaries)
|
12
|
+
- cygwin-install.bat (this script will run the cygwin installer + get sshd/openssl going)
|
13
|
+
- winrm-install.bat (activates the http and https listener + punches the firewall hole)
|
14
|
+
|
15
|
+
Expose the winrm port:
|
16
|
+
|
17
|
+
<pre>
|
18
|
+
$ gem install chef
|
19
|
+
$ gem install knife-windows
|
20
|
+
#Create a tunnel
|
21
|
+
$ ssh -p 7222 -L5985:localhost:5985 vagrant@localhost
|
22
|
+
$ knife bootstrap windows winrm localhost -x Administrator -P 'vagrant'
|
23
|
+
</pre>
|
24
|
+
|
25
|
+
|
26
|
+
- http://wiki.opscode.com/display/chef/Knife+Windows+Bootstrap
|
27
|
+
- https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-shell.erb
|
28
|
+
|
29
|
+
- https://github.com/zenchild/WinRM
|
30
|
+
|
31
|
+
- http://devopscloud.net/2011/04/17/managing-chef-from-windows-7/
|
32
|
+
- http://devopscloud.net/2011/04/28/powershell-userdata-to-start-a-chef-run/
|
33
|
+
- http://devopscloud.net/2011/03/23/dissection-of-a-chef-recipe-or-two-for-windows/
|
34
|
+
- https://github.com/pmorton/chef-windows-installer
|
35
|
+
|
36
|
+
==
|
37
|
+
https://github.com/zenchild/WinRM/issues/unreads#issue/1
|
38
|
+
http -> requires unencryptedwinrm quickconfig (said yes to enable firewall)
|
39
|
+
winrm p winrm/config/service @{AllowUnencrypted="true"}
|
40
|
+
winrm set winrm/config/service/auth @{Basic="true"}netsh advfirewall firewall set rule group="remote administration" new enable=yes
|
41
|
+
|
42
|
+
- http://forums.citrix.com/thread.jspa?messageID=1535826
|
43
|
+
- http://support.microsoft.com/kb/2019527
|
44
|
+
|
45
|
+
winrm get winrm/config
|
46
|
+
|
47
|
+
The purpose of configuring WinRM for HTTPS is to encrypt the data being sent across the wire.
|
48
|
+
|
49
|
+
WinRM HTTPS requires a local computer "Server Authentication" certificate with a CN matching the hostname, that is not expired, revoked, or self-signed to be installed.
|
50
|
+
|
51
|
+
To install or view certificates for the local computer:
|
52
|
+
|
53
|
+
- click Start, run, MMC, "File" menu, "Add or Remove Snap-ins" select "Certificates" and click "Add". Go through the wizard selecting "Computer account".
|
54
|
+
|
55
|
+
- Install or view the certificates under:
|
56
|
+
Certificates (Local computer)
|
57
|
+
Personal
|
58
|
+
Certificates
|
59
|
+
|
60
|
+
If you do not have a Sever Authenticating certificate consult your certicate administrator. If you have a microsoft Certificate server you may be abel to request a certificate using the web certificate template from HTTPS://<MyDomainCertificateServer>/certsrv
|
61
|
+
|
62
|
+
Once the certificate is installed type the following to configure WINRM to listen on HTTPS:
|
63
|
+
|
64
|
+
winrm quickconfig -transport:https
|
65
|
+
|
66
|
+
If you do not have an appropriate certificate you can run the following with the authentication methods configured for WinRM however the data will not be encrypted.
|
67
|
+
|
68
|
+
winrm quickconfig
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Veewee::Session.declare({
|
2
|
+
:cpu_count => '1', :memory_size=> '384',
|
3
|
+
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
|
4
|
+
:os_type_id => 'Windows2008_64',
|
5
|
+
:iso_file => "7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso",
|
6
|
+
:iso_src => "",
|
7
|
+
:iso_md5 => "",
|
8
|
+
:floppy_files => ["Autounattend.xml","cygwin-setup.exe","install-cygwin-sshd.bat","install-winrm.bat","oracle-cert.cer"],
|
9
|
+
:iso_download_timeout => "1000",
|
10
|
+
:boot_wait => "10", :boot_cmd_sequence => [ ],
|
11
|
+
:ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
|
12
|
+
:ssh_host_port => "7222", :ssh_guest_port => "22",
|
13
|
+
:sudo_cmd => "sh '%f'",
|
14
|
+
:shutdown_cmd => "shutdown -P now",
|
15
|
+
:postinstall_files => ["postinstall.sh"], :postinstall_timeout => "10000"
|
16
|
+
})
|
@@ -0,0 +1,38 @@
|
|
1
|
+
REM http://webcache.googleusercontent.com/search?q=cache:SjoPPpuQxuoJ:www.tcm.phy.cam.ac.uk/~mr349/cygwin_install.html+install+cygwin+ssh+commandline&cd=2&hl=nl&ct=clnk&gl=be&source=www.google.be
|
2
|
+
|
3
|
+
REM create the cygwin directory
|
4
|
+
cmd /c mkdir %SystemDrive%\cygwin
|
5
|
+
copy a:cygwin-setup.exe %SystemDrive%\cygwin
|
6
|
+
|
7
|
+
REM goto a temp directory
|
8
|
+
cd %SystemDrive%\windows\temp
|
9
|
+
|
10
|
+
REM run the installation
|
11
|
+
cmd /c a:/cygwin-setup.exe -q -R %SystemDrive%\cygwin -P openssh,openssl,curl,cygrunsrv,wget,rebase,vim -s http://cygwin.mirrors.pair.com
|
12
|
+
|
13
|
+
%SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin cygrunsrv -R sshd'
|
14
|
+
|
15
|
+
REM /bin/ash is the right shell for this command
|
16
|
+
cmd /c %SystemDrive%\cygwin\bin\ash -c /bin/rebaseall
|
17
|
+
|
18
|
+
cmd /c %SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin mkgroup -l'>%SystemDrive%\cygwin\etc\group
|
19
|
+
|
20
|
+
cmd /c %SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin mkpasswd -l'>%SystemDrive%\cygwin\etc\passwd
|
21
|
+
|
22
|
+
%SystemDrive%\cygwin\usr\bin\sleep 1
|
23
|
+
|
24
|
+
%SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/ssh-host-config -y -c "ntsecbinmode tty" -w "abc&&123!!" '
|
25
|
+
|
26
|
+
%SystemDrive%\cygwin\usr\bin\sleep 2
|
27
|
+
|
28
|
+
cmd /c if exist %Systemroot%\system32\netsh.exe netsh advfirewall firewall add rule name="SSHD" dir=in action=allow program="c:\cygwin\usr\sbin\sshd.exe" SSHD enable=yes
|
29
|
+
|
30
|
+
cmd /c if exist %Systemroot%\system32\netsh.exe netsh advfirewall firewall add rule name="ssh" dir=in action=allow protocol=TCP localport=22
|
31
|
+
|
32
|
+
%SystemDrive%\cygwin\usr\bin\sleep 2
|
33
|
+
|
34
|
+
net start sshd
|
35
|
+
|
36
|
+
# Fix corrupt recycle bin
|
37
|
+
# http://www.winhelponline.com/blog/fix-corrupted-recycle-bin-windows-7-vista/
|
38
|
+
cmd /c rd /s /q c:\$Recycle.bin
|
@@ -0,0 +1,6 @@
|
|
1
|
+
cmd /c winrm quickconfig -q
|
2
|
+
cmd /c winrm quickconfig -transport:https
|
3
|
+
cmd /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
|
4
|
+
cmd /c winrm set winrm/config/service @{AllowUnencrypted="true"}
|
5
|
+
cmd /c winrm set winrm/config/service/auth @{Basic="true"}
|
6
|
+
cmd /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
|
Binary file
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# Create the home directory
|
2
|
+
mkdir /home/vagrant
|
3
|
+
chown vagrant /home/vagrant
|
4
|
+
cd /home/vagrant
|
5
|
+
|
6
|
+
# Install ssh certificates
|
7
|
+
mkdir /home/vagrant/.ssh
|
8
|
+
chmod 700 /home/vagrant/.ssh
|
9
|
+
cd /home/vagrant/.ssh
|
10
|
+
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
|
11
|
+
chown -R vagrant /home/vagrant/.ssh
|
12
|
+
cd ..
|
13
|
+
|
14
|
+
# Install rpm,apt-get like code for cygwin
|
15
|
+
# http://superuser.com/questions/40545/upgrading-and-installing-packages-through-the-cygwin-command-line
|
16
|
+
wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
|
17
|
+
chmod +x apt-cyg
|
18
|
+
mv apt-cyg /usr/local/bin/
|
19
|
+
|
20
|
+
# Download Daemontools Lite
|
21
|
+
# This needs some fixing as the url seems to change every X time ...
|
22
|
+
#wget http://www.daemon-tools.cc/eng/downloads/dtproAdv
|
23
|
+
#cat http://www.daemon-tools.cc/eng/downloads/dtLite|grep <div download ...>
|
24
|
+
URL=$(curl -L http://www.daemon-tools.cc/eng/downloads/dtLite|grep http|grep exe|cut -d '"' -f 4)
|
25
|
+
curl -L $URL -o daemontools.exe
|
26
|
+
|
27
|
+
#curl -L http://disc-tools.com/request?p=70e5b112a42060a5439c5edec8e4f8c3/DTLite4402-0131.exe -o daemontools.exe
|
28
|
+
chmod +x daemontools.exe
|
29
|
+
|
30
|
+
# Silent install Daemontools
|
31
|
+
# http://www.daemon-help.com/en/installation_notes_lite/installation_lite.html
|
32
|
+
# Silent install - http://forum.daemon-tools.cc/f24/dt-4-08-a-15030/
|
33
|
+
./daemontools.exe /S
|
34
|
+
|
35
|
+
# Download Virtualbox Additions
|
36
|
+
VBOX_VERSION="4.0.8"
|
37
|
+
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
|
38
|
+
|
39
|
+
# Mount iso file
|
40
|
+
# http://www.daemon-help.com/en/windows_integration_lite/command_line_parameters.html
|
41
|
+
# /cygdrive/c/Program Files (x86)/DAEMON Tools Pro
|
42
|
+
cd "/cygdrive/c/Program Files (x86)/DAEMON Tools Lite"
|
43
|
+
./DTLite.exe -mount 0,"c:\cygwin\home\vagrant\VBoxGuestAdditions_4.0.8.iso"
|
44
|
+
|
45
|
+
# Mark Oracle as a trusted installer
|
46
|
+
#http://blogs.msdn.com/b/steverac/archive/2009/07/09/adding-certificates-to-the-local-certificates-store-and-setting-local-policy-using-a-command-line-system-center-updates-publisher-example.aspx
|
47
|
+
|
48
|
+
certutil -addstore -f "TrustedPublisher" a:oracle-cert.cer
|
49
|
+
|
50
|
+
# Install the Virtualbox Additions
|
51
|
+
cd /cygdrive/e
|
52
|
+
./VBoxWindowsAdditions.exe /S
|
53
|
+
|
54
|
+
#http://www.msfn.org/board/topic/105277-howto-create-a-fully-up-to-date-xp-x64-dvd/
|
55
|
+
|
56
|
+
# Unmount ISO file
|
57
|
+
cd "/cygdrive/c/Program Files (x86)/DAEMON Tools Lite"
|
58
|
+
./DTLite.exe -unmount 0
|
59
|
+
|
60
|
+
# Next step is get ruby working
|
61
|
+
# But thanks to opscode's work , that should not be an issue
|
62
|
+
# https://github.com/opscode/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-shell.erb
|
63
|
+
|
64
|
+
#Installing ruby
|
65
|
+
cd /home/vagrant
|
66
|
+
|
67
|
+
# Ruby 1.9
|
68
|
+
#wget http://rubyforge.org/frs/download.php/74298/rubyinstaller-1.9.2-p180.exe -O rubyinstaller.exe
|
69
|
+
# Ruby 1.8
|
70
|
+
wget http://files.rubyforge.vm.bytemark.co.uk/rubyinstaller/rubyinstaller-1.8.7-p334.exe -O rubyinstaller.exe
|
71
|
+
|
72
|
+
chmod +x rubyinstaller.exe
|
73
|
+
./rubyinstaller.exe /verysilent /dir="C:\ruby" /tasks="assocfiles,modpath" /SUPPRESSMSGBOXES
|
74
|
+
|
75
|
+
# Now add it to the path cmd, and cygwin path
|
76
|
+
# http://serverfault.com/questions/63017/how-do-i-modify-the-system-path-in-windows-2003-windows-2008-using-a-script
|
77
|
+
/cygdrive/c/Windows/System32/setx.exe PATH "c:\windows\system32;c:\ruby\bin" /M
|
78
|
+
export PATH=$PATH:/cygdrive/c/ruby/bin
|
79
|
+
|
80
|
+
# Install Ruby dev kit (native extensions)
|
81
|
+
mkdir /cygdrive/c/devkit
|
82
|
+
cd /cygdrive/c/devkit
|
83
|
+
wget --no-check-certificate http://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe -O rubydevkit.exe
|
84
|
+
chmod +x rubydevkit.exe
|
85
|
+
./rubydevkit -y
|
86
|
+
ruby dk.rb init
|
87
|
+
ruby dk.rb install
|
88
|
+
|
89
|
+
# Installing puppet
|
90
|
+
gem.bat install puppet --no-rdoc --no-ri --verbose
|
91
|
+
|
92
|
+
# Installing chef required gems on windows
|
93
|
+
# For ruby 1.8
|
94
|
+
gem.bat install win32-open3 ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
|
95
|
+
# For ruby 1.9
|
96
|
+
#gem.bat install win32-open3 rdp-ruby-wmi windows-api windows-pr --no-rdoc --no-ri --verbose
|
97
|
+
|
98
|
+
# Install chef
|
99
|
+
gem.bat install ohai --no-rdoc --no-ri --verbose
|
100
|
+
gem.bat install chef --no-rdoc --no-ri --verbose
|
101
|
+
|
102
|
+
# Currently 1.9 ruby + chef 10 doesn't seem to be able to
|
103
|
+
#http://stackoverflow.com/questions/4819807/ohai-fails-to-determine-os-version-in-cygwin
|
104
|
+
|
105
|
+
#Making aliases
|
106
|
+
cat <<EOF > /home/vagrant/.bash_profile
|
107
|
+
alias chef-client="chef-client.bat"
|
108
|
+
alias gem="gem.bat"
|
109
|
+
alias ruby="ruby.exe"
|
110
|
+
alias puppet="puppet.bat"
|
111
|
+
alias ohai="ohai.bat"
|
112
|
+
alias irb="irb.bat"
|
113
|
+
alias facter="facter.bat"
|
114
|
+
EOF
|
115
|
+
|
116
|
+
# Reboot
|
117
|
+
# http://www.techrepublic.com/blog/datacenter/restart-windows-server-2003-from-the-command-line/245
|
118
|
+
shutdown.exe /r /t 0 /c "Vagrant initial reboot"
|
119
|
+
|
120
|
+
# Mounting a directory
|
121
|
+
#./net.exe use x: \\vboxsvr\veewee-validation
|
122
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'winrm'
|
2
|
+
endpoint = 'http://localhost:5985/wsman'
|
3
|
+
winrm=WinRM::WinRMWebService.new(endpoint, :plaintext, :user => 'Administrator', :pass => 'vagrant', :basic_auth_only => true)
|
4
|
+
winrm.cmd('ifconfig /all') do |stdout, stderr|
|
5
|
+
STDOUT.print stdout
|
6
|
+
STDERR.print stderr
|
7
|
+
end
|
8
|
+
#winrm.open_shell
|
@@ -0,0 +1,83 @@
|
|
1
|
+
>> vm.interface.methods
|
2
|
+
=> ["teleporter_password", "get_guest_property_value", "pointing_hid_type=", "call_function", "get_serial_port", "teleporter_password=", "current_snapshot", "vram_size", "get_cpu_status", "methods", "send", "delete_settings", "settings_modified", "members", "access_error", "keyboard_hid_type", "vram_size=", "taint", "get_cpu_id_leaf", "instance_variable_defined?", "set_boot_order", "medium_attachments", "get_guest_property_timestamp", "keyboard_hid_type=", "state", "snapshot_count", "accelerate_3d_enabled", "query_log_filename", "singleton_methods", "instance_eval", "export", "get_medium_attachment", "session_state", "accelerate_3d_enabled=", "set_cpu_id_leaf", "hpet_enabled", "nil?", "get_boot_order", "memory_size", "set_guest_property", "read_property", "get_parallel_port", "hpet_enabled=", "current_state_modified", "protected_methods", "instance_exec", "get_snapshot", "display", "memory_size=", "accelerate_2d_video_enabled", "read_log", "tainted?", "method", "get_network_adapter", "untaint", "remove_cpu_id_leaf", "instance_of?", "os_type_id", "rtc_use_utc", "accelerate_2d_video_enabled=", "attach_device", "equal?", "name", "set_guest_propetty_value", "usb_controller", "os_type_id=", "rtc_use_utc=", "write_property", "clipboard_mode", "hash", "name=", "private_methods", "find_snapshot", "monitor_count", "clipboard_mode=", "session_type", "kind_of?", "hardware_version", "io_cache_enabled", "monitor_count=", "freeze", "remove_all_cpu_id_leafs", "detach_device", "eql?", "enumerate_guest_properties", "hardware_version=", "io_cache_enabled=", "id", "get_extra_data_keys", "guest_property_notification_patterns", "bios_settings", "public_methods", "set_current_snapshot", "implementer", "add_storage_controller", "has_function?", "session_pid", "object_id", "guest_property_notification_patterns=", "is_a?", "hardware_uuid", "io_cache_size", "get_hw_virt_ex_property", "passthrough_device", "query_saved_thumbnail_size", "audio_adapter", "tap", "hardware_uuid=", "io_cache_size=", "member", "type", "get_extra_data", "teleporter_enabled", "firmware_type", "instance_variables", "can_show_console_window", "__id__", "lib", "get_storage_controller_by_name", "has_property?", "frozen?", "last_state_change", "to_enum", "teleporter_enabled=", "io_bandwidth_max", "firmware_type=", "to_a", "set_hw_virt_ex_property", "cpu_count", "respond_to?", "mount_medium", "storage_controllers", "read_saved_thumbnail_to_array", "class", "set_extra_data", "cpu_hot_plug_enabled", "cpu_count=", "io_bandwidth_max=", "teleporter_port", "snapshot_folder", "instance_variable_get", "show_console_window", "==", "cpu_hot_plug_enabled=", "__send__", "get_storage_controller_by_instance", "===", "create_shared_folder", "state_file_path", "enum_for", "teleporter_port=", "extend", "to_s", "save_settings", "memory_balloon_size", "hot_plug_cpu", "snapshot_folder=", "get_medium", "query_saved_screenshot_png_size", "parent", "page_fusion_enabled", "memory_balloon_size=", "clone", "get_cpu_property", "teleporter_address", "=~", "instance_variable_set", "get_guest_property", "vrdp_server", "page_fusion_enabled=", "remove_storage_controller", "remove_shared_folder", "log_folder", "teleporter_address=", "discard_settings", "shared_folders", "hot_unplug_cpu", "description", "inspect", "get_medium_attachments_of_controller", "read_saved_png_screenshot_to_array", "settings_file_path", "accessible", "pointing_hid_type", "dup", "set_cpu_property", "description="]
|
3
|
+
|
4
|
+
|
5
|
+
patricks-iMac:virtualbox-0.7.5 patrick$ vi lib/virtualbox/com/ffi/interfaces.rb
|
6
|
+
create_interface(:Keyboard, :NSISupports)
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
#http://www.virtualbox.org/sdkref/_virtual_box_8idl-source.html
|
11
|
+
#http://www.virtualbox.org/sdkref/interface_i_keyboard.html
|
12
|
+
|
13
|
+
|
14
|
+
vi lib/virtualbox/com/interface/3.2.x/keyboard.rb
|
15
|
+
|
16
|
+
module VirtualBox
|
17
|
+
module COM
|
18
|
+
module Interface
|
19
|
+
module Version_3_2_X
|
20
|
+
class Keyboard < AbstractInterface
|
21
|
+
IID = "2D1A531B-4C6E-49CC-8AF6-5C857B78B5D7"
|
22
|
+
|
23
|
+
function :put_cad, nil, []
|
24
|
+
function :put_scancode, nil, [T_INT64]
|
25
|
+
function :put_scancodes, nil, [ [:scancode,T_INT64], T_UINT64 ]
|
26
|
+
|
27
|
+
#function :detach_usb_device, :USBDevice, [WSTRING]
|
28
|
+
#function :find_usb_device_by_address, :USBDevice, [WSTRING]
|
29
|
+
#function :find_usb_device_by_id, :USBDevice, [WSTRING]
|
30
|
+
#function :create_shared_folder, nil, [WSTRING, WSTRING, T_BOOL]
|
31
|
+
#function :remove_shared_folder, nil, [WSTRING]
|
32
|
+
#function :take_snapshot, :Progress, [WSTRING, WSTRING]
|
33
|
+
#function :delete_snapshot, :Progress, [WSTRING]
|
34
|
+
#function :restore_snapshot, :Progress, [:Snapshot]
|
35
|
+
#function :teleport, :Progress, [WSTRING, T_UINT32, WSTRING, T_UINT32]
|
36
|
+
#function :register_callback, nil, [:ConsoleCallback]
|
37
|
+
#function :unregister_callback, nil, [:ConsoleCallback]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
>> session=VirtualBox::Lib.lib.session
|
48
|
+
=> #<VirtualBox::COM::Interface::Version_3_2_X::Session>
|
49
|
+
>> session.state
|
50
|
+
get_state
|
51
|
+
[#<FFI::MemoryPointer address=0x101712bf0 size=8>]
|
52
|
+
FFI call: get_state [] [#<FFI::MemoryPointer address=0x101712bf0 size=8>]0
|
53
|
+
=> :closed
|
54
|
+
|
55
|
+
|
56
|
+
vm.interface.parent.open_remote_session(session,"c5429061-8f1c-4a9d-aea6-0d2d6a4a4ebc","gui","")
|
57
|
+
|
58
|
+
|
59
|
+
VirtualBox::Exceptions::FFIException: Error in API call to open_session: 2147942487
|
60
|
+
from /Users/patrick/veewee/gems/gems/virtualbox-0.7.5/lib/virtualbox/com/implementer/ffi.rb:99:in `call_and_check'
|
61
|
+
from /Users/patrick/veewee/gems/gems/virtualbox-0.7.5/lib/virtualbox/com/implementer/ffi.rb:72:in `call_vtbl_function'
|
62
|
+
from /Users/patrick/veewee/gems/gems/virtualbox-0.7.5/lib/virtualbox/com/implementer/ffi.rb:51:in `call_function'
|
63
|
+
from /Users/patrick/veewee/gems/gems/virtualbox-0.7.5/lib/virtualbox/com/abstract_interface.rb:135:in `call_function'
|
64
|
+
from /Users/patrick/veewee/gems/gems/virtualbox-0.7.5/lib/virtualbox/com/abstract_interface.rb:51:in `open_session'
|
65
|
+
from (irb):33
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
BUG
|
70
|
+
https://github.com/mitchellh/virtualbox/issuesearch?state=closed&q=session#issue/25
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
***open_remote_session****
|
75
|
+
open_remote_session
|
76
|
+
open_remote_session
|
77
|
+
[#<VirtualBox::COM::FFI::Version_3_2_X::Session::VtblParent:0x1015ab4a8>,
|
78
|
+
#<FFI::Pointer address=0x102b1e9e0>,
|
79
|
+
#<FFI::Pointer address=0x102b44f20>,
|
80
|
+
#<FFI::Pointer address=0x102b1fb20>,
|
81
|
+
#<FFI::MemoryPointer address=0x102b18720 size=8>]
|
82
|
+
FFI call: open_remote_session [#<VirtualBox::COM::Interface::Version_3_2_X::Session>, "c5429061-8f1c-4a9d-aea6-0d2d6a4a4ebc", "gui", ""] [#<VirtualBox::COM::FFI::Version_3_2_X::Session::VtblParent:0x1015ab4a8>, #<FFI::Pointer address=0x102b1e9e0>, #<FFI::Pointer address=0x102b44f20>, #<FFI::Pointer address=0x102b1fb20>, #<FFI::MemoryPointer address=0x102b18720 size=8>]0
|
83
|
+
|
data/trials/f.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
##
|
3
|
+
## mysql-replication.rb
|
4
|
+
##
|
5
|
+
## This script uses facter to setup mysql replication based upon the
|
6
|
+
#facts mysql_master and mysql_repl_dbs
|
7
|
+
##
|
8
|
+
## It is currently in beta
|
9
|
+
##
|
10
|
+
#
|
11
|
+
## 1) Require the relevant libraries
|
12
|
+
require 'rubygems'
|
13
|
+
require 'facter'
|
14
|
+
#
|
15
|
+
## 2) Get the relevant facts and echo them to the screen
|
16
|
+
puts "Getting facts"
|
17
|
+
#begin
|
18
|
+
Facter.loadfacts()
|
19
|
+
puts "Facts received"
|
20
|
+
puts Facter.ipaddress
|
21
|
+
#rescue
|
22
|
+
# Facter.loadfacts()
|
23
|
+
# puts "running rescue"
|
24
|
+
#end
|
25
|
+
|
26
|
+
# mysql_master = Facter.value('mysql_master')
|
27
|
+
# mysql_repl_dbs = Facter.value('mysql_master')
|
28
|
+
#
|
29
|
+
# puts "Master Server: #{mysql_master}\nDatabases: #{mysql_repl_dbs}"
|
data/trials/t.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'pp'
|
3
|
+
require 'virtualbox'
|
4
|
+
vm=VirtualBox::VM.find("blub")
|
5
|
+
#vm.start
|
6
|
+
vm.state
|
7
|
+
#session = VirtualBox::Lib.lib.session
|
8
|
+
|
9
|
+
vm.with_open_session do |session|
|
10
|
+
pp session
|
11
|
+
pp session.console
|
12
|
+
pp session.console.keyboard
|
13
|
+
pp session.console.keyboard.methods
|
14
|
+
session.console.keyboard.put_scancode(20)
|
15
|
+
end
|
@@ -0,0 +1,170 @@
|
|
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
|
+
# 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
|
170
|
+
|
@@ -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 shared folders
|
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 "mount|grep veewee-validation"
|
52
|
+
Then I should see "veewee-validation" in the output
|
@@ -0,0 +1 @@
|
|
1
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
|