veewee 0.2.3 → 0.3.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +53 -30
- data/License +21 -0
- data/README-LIB.md +2 -0
- data/README.md +35 -62
- data/Rakefile +54 -88
- data/bin/veewee +13 -70
- data/bin/veewee-kvm-old +34 -0
- data/bin/veewee-vagrant +55 -0
- data/bin/veewee-vmfusion +34 -0
- data/lib/fission.rb +41 -0
- data/lib/fission/cli.rb +76 -0
- data/lib/fission/command.rb +15 -0
- data/lib/fission/command/clone.rb +68 -0
- data/lib/fission/command/delete.rb +71 -0
- data/lib/fission/command/snapshot_create.rb +52 -0
- data/lib/fission/command/snapshot_list.rb +45 -0
- data/lib/fission/command/snapshot_revert.rb +54 -0
- data/lib/fission/command/start.rb +69 -0
- data/lib/fission/command/status.rb +31 -0
- data/lib/fission/command/stop.rb +49 -0
- data/lib/fission/command/suspend.rb +67 -0
- data/lib/fission/config.rb +29 -0
- data/lib/fission/core_ext/class.rb +5 -0
- data/lib/fission/core_ext/file.rb +7 -0
- data/lib/fission/core_ext/object.rb +112 -0
- data/lib/fission/error.rb +9 -0
- data/lib/fission/fusion.rb +17 -0
- data/lib/fission/leasesfile.rb +74 -0
- data/lib/fission/metadata.rb +39 -0
- data/lib/fission/response.rb +16 -0
- data/lib/fission/ui.rb +22 -0
- data/lib/fission/version.rb +3 -0
- data/lib/fission/vm.rb +361 -0
- data/lib/net/vnc/vnc.rb +341 -0
- data/lib/vagrant_init.rb +5 -2
- data/lib/veewee.rb +20 -3
- data/lib/veewee/builder/core/box.rb +32 -0
- data/lib/veewee/builder/core/box/vnc.rb +122 -0
- data/lib/veewee/builder/core/builder.rb +90 -0
- data/lib/veewee/builder/core/builder/build.rb +250 -0
- data/lib/veewee/builder/core/builder/iso.rb +120 -0
- data/lib/veewee/builder/core/builder/transaction.rb +25 -0
- data/lib/veewee/builder/core/builder/tunnel.rb +46 -0
- data/lib/veewee/builder/kvm/box.rb +130 -0
- data/lib/veewee/builder/kvm/builder.rb +38 -0
- data/lib/veewee/builder/virtualbox/box.rb +121 -0
- data/lib/veewee/builder/virtualbox/builder.rb +48 -0
- data/lib/veewee/builder/virtualbox/helper/_snapshots.rb +105 -0
- data/lib/veewee/builder/virtualbox/helper/_transaction.rb +135 -0
- data/lib/veewee/builder/virtualbox/helper/console_type.rb +62 -0
- data/lib/veewee/builder/virtualbox/helper/create.rb +210 -0
- data/lib/veewee/builder/virtualbox/helper/destroy.rb +79 -0
- data/lib/veewee/builder/virtualbox/helper/export_vagrant.rb +87 -0
- data/lib/veewee/builder/virtualbox/helper/validate_vagrant.rb +35 -0
- data/lib/veewee/builder/vmfusion/box.rb +137 -0
- data/lib/veewee/builder/vmfusion/builder.rb +78 -0
- data/lib/veewee/builder/vmfusion/helper/create.rb +68 -0
- data/lib/veewee/builder/vmfusion/helper/export_ova.rb +26 -0
- data/lib/veewee/builder/vmfusion/helper/template.rb +39 -0
- data/lib/veewee/builder/vmfusion/helper/template.vmx.erb +81 -0
- data/lib/veewee/builder/vmfusion/helper/validate_vmfusion.rb +37 -0
- data/lib/veewee/builder/vmfusion/info/export_ovf.info +103 -0
- data/lib/veewee/cli.rb +55 -0
- data/lib/veewee/command.rb +10 -20
- data/lib/veewee/command/base.rb +106 -0
- data/lib/veewee/command/group_base.rb +107 -0
- data/lib/veewee/command/helpers.rb +13 -0
- data/lib/veewee/command/kvm.rb +85 -0
- data/lib/veewee/command/named_base.rb +14 -0
- data/lib/veewee/command/vagrant.rb +108 -0
- data/lib/veewee/command/version.rb +13 -0
- data/lib/veewee/command/virtualbox.rb +86 -0
- data/lib/veewee/command/vmfusion.rb +113 -0
- data/lib/veewee/config.rb +89 -3
- data/lib/veewee/config/builders.rb +36 -0
- data/lib/veewee/config/collection.rb +82 -0
- data/lib/veewee/config/component.rb +19 -0
- data/lib/veewee/config/definition.rb +44 -0
- data/lib/veewee/config/ostypes.yml +165 -0
- data/lib/veewee/config/veewee.rb +21 -0
- data/lib/veewee/definition.rb +130 -0
- data/lib/veewee/environment.rb +367 -0
- data/lib/veewee/error.rb +20 -0
- data/lib/veewee/templates/locales/en.yml +30 -0
- data/lib/veewee/ui.rb +83 -0
- data/lib/veewee/util/scancode.rb +112 -0
- data/lib/veewee/util/shell.rb +42 -0
- data/lib/veewee/util/ssh.rb +158 -0
- data/lib/veewee/util/tcp.rb +88 -0
- data/lib/veewee/util/web.rb +63 -0
- data/lib/veewee/vagrant/config.rb +7 -0
- data/lib/veewee/version.rb +6 -1
- data/templates/CentOS-4.8-i386/definition.rb +3 -3
- data/templates/CentOS-4.8-i386/postinstall.sh +2 -2
- data/templates/CentOS-5.5-x86_64-netboot/definition.rb +1 -1
- data/templates/CentOS-5.5-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-5.6-i386-netboot/definition.rb +3 -3
- data/templates/CentOS-5.6-i386-netboot/ks.cfg +2 -2
- data/templates/CentOS-5.6-i386-netboot/postinstall.sh +2 -2
- data/templates/CentOS-5.6-i386/definition.rb +2 -2
- data/templates/CentOS-5.6-i386/postinstall.sh +2 -2
- data/templates/CentOS-5.6-x86_64-netboot/definition.rb +3 -3
- data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +1 -1
- data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-5.7-i386-netboot/postinstall.sh +3 -3
- data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-6.0-i386-netboot/definition.rb +2 -2
- data/templates/CentOS-6.0-i386-netboot/postinstall.sh +2 -2
- data/templates/CentOS-6.0-i386/definition.rb +2 -2
- data/templates/CentOS-6.0-i386/postinstall.sh +2 -2
- data/templates/CentOS-6.0-x86_64-minimal/definition.rb +2 -2
- data/templates/CentOS-6.0-x86_64-minimal/postinstall.sh +4 -17
- data/templates/CentOS-6.0-x86_64-netboot/definition.rb +2 -2
- data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +2 -2
- data/templates/CentOS-6.0-x86_64/definition.rb +2 -2
- data/templates/CentOS-6.0-x86_64/postinstall.sh +2 -2
- data/templates/Debian-5.0.8-amd64-netboot/definition.rb +1 -1
- data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +1 -1
- data/templates/Debian-5.0.8-i386-netboot/definition.rb +1 -1
- data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +1 -1
- data/templates/{Debian-6.0.3-amd64-netboot → Debian-6.0.2-amd64-netboot}/definition.rb +4 -4
- data/templates/{ubuntu-11.10-server-amd64-ishaya → Debian-6.0.2-amd64-netboot}/postinstall.sh +23 -42
- data/templates/{Debian-6.0.3-amd64-netboot → Debian-6.0.2-amd64-netboot}/preseed.cfg +0 -0
- data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/definition.rb +4 -4
- data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/postinstall.sh +1 -1
- data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/preseed.cfg +0 -0
- data/templates/Fedora-14-amd64-netboot/definition.rb +2 -2
- data/templates/Fedora-14-amd64-netboot/postinstall.sh +2 -2
- data/templates/Fedora-14-amd64/definition.rb +2 -2
- data/templates/Fedora-14-amd64/postinstall.sh +2 -2
- data/templates/Fedora-14-i386-netboot/definition.rb +2 -2
- data/templates/Fedora-14-i386-netboot/postinstall.sh +2 -2
- data/templates/Fedora-14-i386/definition.rb +2 -2
- data/templates/Fedora-14-i386/postinstall.sh +2 -2
- data/templates/Fedora-15-i386-netboot/definition.rb +2 -2
- data/templates/Fedora-15-i386/definition.rb +3 -3
- data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +1 -1
- data/templates/archlinux-i386-netboot/aif.cfg +14 -8
- data/templates/archlinux-i386-netboot/definition.rb +7 -4
- data/templates/archlinux-i386-netboot/postinstall.sh +17 -5
- data/templates/archlinux-i386-netboot/postinstall2.sh +1 -3
- data/templates/archlinux-i386/definition.rb +4 -4
- data/templates/archlinux-i386/postinstall.sh +1 -1
- data/templates/archlinux-x86_64-netboot/aif.cfg +14 -8
- data/templates/archlinux-x86_64-netboot/definition.rb +7 -4
- data/templates/archlinux-x86_64-netboot/postinstall.sh +16 -1
- data/templates/archlinux-x86_64-netboot/postinstall2.sh +1 -3
- data/templates/archlinux-x86_64/definition.rb +2 -2
- data/templates/archlinux-x86_64/postinstall.sh +1 -1
- data/templates/freebsd-8.2-experimental/definition.rb +1 -1
- data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +2 -5
- data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +1 -1
- data/templates/freebsd-8.2-pcbsd-i386/definition.rb +3 -4
- data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +1 -1
- data/templates/gentoo-latest-i386-experimental/definition.rb +7 -7
- data/templates/gentoo-latest-i386-experimental/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-NET-i586/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +1 -1
- data/templates/openindiana-148-ai-x86/definition.rb +3 -3
- data/templates/openindiana-148-ai-x86/postinstall.sh +1 -1
- data/templates/opensuse-11.4-i386-experimental/definition.rb +1 -1
- data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -1
- data/templates/solaris-11-express-i386/definition.rb +3 -3
- data/templates/solaris-11-express-i386/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.2-amd64-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.2-server-i386-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.3-server-amd64-alt/definition.rb +6 -6
- data/templates/ubuntu-10.04.3-server-amd64-alt/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.3-server-amd64/base.sh +11 -0
- data/templates/ubuntu-10.04.3-server-amd64/chef.sh +2 -0
- data/templates/ubuntu-10.04.3-server-amd64/cleanup.sh +19 -0
- data/templates/ubuntu-10.04.3-server-amd64/definition.rb +19 -11
- data/templates/ubuntu-10.04.3-server-amd64/preseed.cfg +4 -4
- data/templates/ubuntu-10.04.3-server-amd64/puppet.sh +1 -0
- data/templates/ubuntu-10.04.3-server-amd64/ruby.sh +24 -0
- data/templates/ubuntu-10.04.3-server-amd64/vagrant.sh +27 -0
- data/templates/ubuntu-10.04.3-server-amd64/virtualbox.sh +12 -0
- data/templates/ubuntu-10.04.3-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64/base.sh +11 -0
- data/templates/ubuntu-10.10-server-amd64/chef.sh +2 -0
- data/templates/ubuntu-10.10-server-amd64/cleanup.sh +19 -0
- data/templates/ubuntu-10.10-server-amd64/definition.rb +20 -8
- data/templates/ubuntu-10.10-server-amd64/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64/preseed.cfg +5 -5
- data/templates/ubuntu-10.10-server-amd64/puppet.sh +1 -0
- data/templates/ubuntu-10.10-server-amd64/ruby.sh +24 -0
- data/templates/ubuntu-10.10-server-amd64/vagrant.sh +27 -0
- data/templates/ubuntu-10.10-server-amd64/virtualbox.sh +12 -0
- data/templates/ubuntu-10.10-server-i386-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-i386/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-11.04-server-amd64/apt-upgrade.sh +4 -0
- data/templates/ubuntu-11.04-server-amd64/chef.sh +1 -0
- data/templates/ubuntu-11.04-server-amd64/definition.rb +32 -9
- data/templates/ubuntu-11.04-server-amd64/network-cleanup.sh +14 -0
- data/templates/ubuntu-11.04-server-amd64/nfs-client.sh +3 -0
- data/templates/ubuntu-11.04-server-amd64/puppet.sh +1 -0
- data/templates/ubuntu-11.04-server-amd64/remove-build-essentials.sh +3 -0
- data/templates/ubuntu-11.04-server-amd64/ruby.sh +29 -0
- data/templates/ubuntu-11.04-server-amd64/ssh-keys.sh +7 -0
- data/templates/ubuntu-11.04-server-amd64/sudo.sh +4 -0
- data/templates/ubuntu-11.04-server-amd64/timestamp.sh +1 -0
- data/templates/ubuntu-11.04-server-amd64/vbox_additions.sh +11 -0
- data/templates/ubuntu-11.04-server-amd64/zero-disk.sh +3 -0
- data/templates/ubuntu-11.04-server-i386/definition.rb +2 -2
- data/templates/ubuntu-11.04-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-8.04.4-server-amd64/definition.rb +1 -2
- data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +7 -8
- data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +1 -0
- data/templates/ubuntu-8.04.4-server-i386/definition.rb +2 -2
- data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +3 -25
- data/templates/windows-2008R2-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R2-amd64/definition.rb +1 -1
- data/templates/windows-2008R2-amd64/install-winrm.bat +0 -2
- data/templates/windows-2008R2-amd64/postinstall.sh +1 -1
- data/templates/windows-2008R2-amd64/win7/Autounattend.xml +180 -0
- data/test/build_test.rb +50 -0
- data/test/definition_test.rb +11 -0
- data/test/definitions/test_definition/_test_me.sh +1 -0
- data/test/definitions/test_definition/autorun0 +3 -0
- data/test/definitions/test_definition/definition.rb +27 -0
- data/test/environment_test.rb +67 -0
- data/validation/features/steps/ssh_steps.rb +52 -52
- data/validation/vagrant.feature +64 -48
- data/veewee.gemspec +14 -9
- metadata +243 -213
- data/lib/veewee/command/basebox.rb +0 -63
- data/lib/veewee/command/basebox_build.rb +0 -32
- data/lib/veewee/command/basebox_define.rb +0 -28
- data/lib/veewee/command/basebox_destroy.rb +0 -22
- data/lib/veewee/command/basebox_export.rb +0 -22
- data/lib/veewee/command/basebox_list.rb +0 -23
- data/lib/veewee/command/basebox_ostypes.rb +0 -23
- data/lib/veewee/command/basebox_templates.rb +0 -23
- data/lib/veewee/command/basebox_undefine.rb +0 -22
- data/lib/veewee/command/basebox_validate.rb +0 -26
- data/lib/veewee/export.rb +0 -81
- data/lib/veewee/scancode.rb +0 -151
- data/lib/veewee/session.rb +0 -907
- data/lib/veewee/shell.rb +0 -54
- data/lib/veewee/ssh.rb +0 -193
- data/lib/veewee/transaction.rb +0 -122
- data/lib/veewee/utils.rb +0 -26
- data/lib/veewee/web.rb +0 -48
- data/templates/CentOS-6.1-x86_64-minimal/definition.rb +0 -15
- data/templates/CentOS-6.1-x86_64-minimal/ks.cfg +0 -37
- data/templates/CentOS-6.1-x86_64-minimal/postinstall.sh +0 -50
- data/templates/CentOS-6.2-x86_64-minimal/definition.rb +0 -15
- data/templates/CentOS-6.2-x86_64-minimal/ks.cfg +0 -37
- data/templates/CentOS-6.2-x86_64-minimal/postinstall.sh +0 -50
- data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +0 -80
- data/templates/Fedora-15-x86_64-netboot/definition.rb +0 -29
- data/templates/Fedora-15-x86_64-netboot/ks.cfg +0 -64
- data/templates/Fedora-15-x86_64-netboot/postinstall.sh +0 -33
- data/templates/Fedora-16-i386/definition.rb +0 -17
- data/templates/Fedora-16-i386/ks.cfg +0 -72
- data/templates/Fedora-16-i386/postinstall.sh +0 -35
- data/templates/Fedora-16-x86_64/definition.rb +0 -17
- data/templates/Fedora-16-x86_64/ks.cfg +0 -72
- data/templates/Fedora-16-x86_64/postinstall.sh +0 -35
- data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_de.xml +0 -1127
- data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_en.xml +0 -1127
- data/templates/SLES-11-SP1-DVD-i586-GM/definition.rb +0 -37
- data/templates/SLES-11-SP1-DVD-i586-GM/postinstall.sh +0 -43
- data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_de.xml +0 -1171
- data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_en.xml +0 -1171
- data/templates/SLES-11-SP1-DVD-x86_64-GM/definition.rb +0 -37
- data/templates/SLES-11-SP1-DVD-x86_64-GM/postinstall.sh +0 -43
- data/templates/funtoo-latest-generic_64-stable/definition.rb +0 -34
- data/templates/funtoo-latest-generic_64-stable/postinstall.sh +0 -177
- data/templates/funtoo-latest-generic_64-stable/postinstall2.sh +0 -83
- data/templates/gentoo-latest-x86_64-experimental/definition.rb +0 -34
- data/templates/gentoo-latest-x86_64-experimental/postinstall.sh +0 -214
- data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_de.xml +0 -1483
- data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_en.xml +0 -1483
- data/templates/openSUSE-12.1-DVD+NET-i586/definition.rb +0 -44
- data/templates/openSUSE-12.1-DVD+NET-i586/postinstall.sh +0 -43
- data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_de.xml +0 -1727
- data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_en.xml +0 -1727
- data/templates/openSUSE-12.1-DVD+NET-x86_64/definition.rb +0 -44
- data/templates/openSUSE-12.1-DVD+NET-x86_64/postinstall.sh +0 -43
- data/templates/openbsd50_amd64/README +0 -28
- data/templates/openbsd50_amd64/definition.rb +0 -84
- data/templates/openbsd50_amd64/postinstall.sh +0 -81
- data/templates/openbsd50_i386/.definition.rb.swp +0 -0
- data/templates/openbsd50_i386/README +0 -28
- data/templates/openbsd50_i386/definition.rb +0 -84
- data/templates/openbsd50_i386/postinstall.sh +0 -80
- data/templates/scientificlinux-6.1-i386-netboot/definition.rb +0 -16
- data/templates/scientificlinux-6.1-i386-netboot/ks.cfg +0 -53
- data/templates/scientificlinux-6.1-i386-netboot/postinstall.sh +0 -30
- data/templates/scientificlinux-6.1-x86_64-netboot/definition.rb +0 -16
- data/templates/scientificlinux-6.1-x86_64-netboot/ks.cfg +0 -53
- data/templates/scientificlinux-6.1-x86_64-netboot/postinstall.sh +0 -30
- data/templates/ubuntu-10.04.3-server-amd64/postinstall.sh +0 -90
- data/templates/ubuntu-11.04-server-amd64/postinstall.sh +0 -96
- data/templates/ubuntu-11.10-server-amd64-ishaya/definition.rb +0 -24
- data/templates/ubuntu-11.10-server-amd64-ishaya/preseed.cfg +0 -87
- data/templates/ubuntu-11.10-server-amd64-ruby192/definition.rb +0 -24
- data/templates/ubuntu-11.10-server-amd64-ruby192/postinstall.sh +0 -90
- data/templates/ubuntu-11.10-server-amd64-ruby192/preseed.cfg +0 -87
- data/templates/ubuntu-11.10-server-amd64/definition.rb +0 -35
- data/templates/ubuntu-11.10-server-amd64/postinstall.sh +0 -88
- data/templates/ubuntu-11.10-server-amd64/preseed.cfg +0 -87
- data/templates/ubuntu-11.10-server-i386/definition.rb +0 -35
- data/templates/ubuntu-11.10-server-i386/postinstall.sh +0 -88
- data/templates/ubuntu-11.10-server-i386/preseed.cfg +0 -87
- data/templates/windows-2008R1-serverstandard-amd64/Autounattend.xml +0 -146
- data/templates/windows-2008R1-serverstandard-amd64/README.md +0 -134
- data/templates/windows-2008R1-serverstandard-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R1-serverstandard-amd64/definition.rb +0 -114
- data/templates/windows-2008R1-serverstandard-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-2008R1-serverstandard-amd64/install-guest-additions.bat +0 -5
- data/templates/windows-2008R1-serverstandard-amd64/install-winrm.bat +0 -14
- data/templates/windows-2008R1-serverstandard-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R1-serverstandard-amd64/postinstall.sh +0 -74
- data/templates/windows-2008R1-serverstandard-amd64/sudo +0 -2
- data/templates/windows-2008R1-serverstandard-amd64/winrm.rb +0 -8
- data/templates/windows-2008R2-serverstandard-amd64/Autounattend.xml +0 -147
- data/templates/windows-2008R2-serverstandard-amd64/README.md +0 -142
- data/templates/windows-2008R2-serverstandard-amd64/definition.rb +0 -44
- data/templates/windows-2008R2-serverstandard-amd64/install-cygwin-sshd.bat +0 -41
- data/templates/windows-2008R2-serverstandard-amd64/install-winrm.bat +0 -11
- data/templates/windows-2008R2-serverstandard-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R2-serverstandard-amd64/postinstall.sh +0 -74
- data/templates/windows-7-enterprise-amd64/Autounattend.xml +0 -149
- data/templates/windows-7-enterprise-amd64/README.md +0 -52
- data/templates/windows-7-enterprise-amd64/definition.rb +0 -39
- data/templates/windows-7-enterprise-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-enterprise-amd64/install-winrm.bat +0 -14
- data/templates/windows-7-enterprise-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-enterprise-amd64/postinstall.sh +0 -74
- data/templates/windows-7-enterprise-i386/Autounattend.xml +0 -151
- data/templates/windows-7-enterprise-i386/README.md +0 -169
- data/templates/windows-7-enterprise-i386/definition.rb +0 -40
- data/templates/windows-7-enterprise-i386/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-enterprise-i386/install-winrm.bat +0 -14
- data/templates/windows-7-enterprise-i386/oracle-cert.cer +0 -0
- data/templates/windows-7-enterprise-i386/postinstall.sh +0 -74
- data/templates/windows-7-premium-amd64/Autounattend.xml +0 -152
- data/templates/windows-7-premium-amd64/README.md +0 -171
- data/templates/windows-7-premium-amd64/definition.rb +0 -38
- data/templates/windows-7-premium-amd64/install-chefclient.bat +0 -44
- data/templates/windows-7-premium-amd64/install-winrm.bat +0 -11
- data/templates/windows-7-premium-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-premium-amd64/postinstall.sh +0 -124
- data/templates/windows-7-premium-amd64/winrm.rb +0 -8
- data/templates/windows-7-professional-amd64/Autounattend.xml +0 -152
- data/templates/windows-7-professional-amd64/README.md +0 -171
- data/templates/windows-7-professional-amd64/definition.rb +0 -41
- data/templates/windows-7-professional-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-professional-amd64/install-winrm.bat +0 -14
- data/templates/windows-7-professional-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-professional-amd64/postinstall.sh +0 -74
- data/templates/windows-7-ultimate-amd64/Autounattend.xml +0 -152
- data/templates/windows-7-ultimate-amd64/README.md +0 -89
- data/templates/windows-7-ultimate-amd64/definition.rb +0 -41
- data/templates/windows-7-ultimate-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-ultimate-amd64/install-winrm.bat +0 -14
- data/templates/windows-7-ultimate-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-ultimate-amd64/postinstall.sh +0 -74
- data/templates/windows-7sp1-ultimate-amd64/Autounattend.xml +0 -152
- data/templates/windows-7sp1-ultimate-amd64/README.md +0 -89
- data/templates/windows-7sp1-ultimate-amd64/definition.rb +0 -42
- data/templates/windows-7sp1-ultimate-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7sp1-ultimate-amd64/install-winrm.bat +0 -14
- data/templates/windows-7sp1-ultimate-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7sp1-ultimate-amd64/postinstall.sh +0 -74
- data/templates/windows-8-preview-dev-amd64/Autounattend.xml +0 -140
- data/templates/windows-8-preview-dev-amd64/README.md +0 -134
- data/templates/windows-8-preview-dev-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-8-preview-dev-amd64/definition.rb +0 -114
- data/templates/windows-8-preview-dev-amd64/install-cygwin-sshd.bat +0 -38
- data/templates/windows-8-preview-dev-amd64/install-winrm.bat +0 -11
- data/templates/windows-8-preview-dev-amd64/oracle-cert.cer +0 -0
- data/templates/windows-8-preview-dev-amd64/postinstall.sh +0 -122
- data/templates/windows-8-preview-dev-amd64/winrm.rb +0 -8
- data/trials/docu-vbox.txt +0 -83
- data/trials/f.rb +0 -29
- data/trials/t.rb +0 -15
@@ -0,0 +1,135 @@
|
|
1
|
+
##Note: this is currently not used anymore, it seems no one is using it
|
2
|
+
|
3
|
+
require 'veewee/util/shell'
|
4
|
+
require 'veewee/util/tcp'
|
5
|
+
|
6
|
+
module Veewee
|
7
|
+
module Builder
|
8
|
+
module Virtualbox
|
9
|
+
|
10
|
+
def transaction(step_name,checksums,&block)
|
11
|
+
|
12
|
+
current_step_nr=step_name.split("-")[0].to_i
|
13
|
+
|
14
|
+
vm=VirtualBox::VM.find(@box_name)
|
15
|
+
snapnames=Array.new
|
16
|
+
|
17
|
+
#If vm exists , look for snapshots
|
18
|
+
if !vm.nil?
|
19
|
+
start_snapshot=vm.root_snapshot
|
20
|
+
snapshot=start_snapshot
|
21
|
+
counter=0
|
22
|
+
|
23
|
+
while (snapshot!=nil)
|
24
|
+
#env.ui.info "#{counter}:#{snapshot.name}"
|
25
|
+
snapnames[counter]=snapshot.name
|
26
|
+
counter=counter+1
|
27
|
+
snapshot=snapshot.children[0]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#find the last snapshot matching the state
|
32
|
+
counter=[snapnames.length, checksums.length].min-1
|
33
|
+
last_good_state=counter
|
34
|
+
for c in 0..counter do
|
35
|
+
#env.ui.info "#{c}- #{snapnames[c]} - #{checksums[c]}"
|
36
|
+
if !snapnames[c].match("#{c}.*-#{checksums[c]}")
|
37
|
+
# env.ui.info "we found a bad state"
|
38
|
+
last_good_state=c-1
|
39
|
+
break
|
40
|
+
end
|
41
|
+
end
|
42
|
+
#env.ui.info "Last good state: #{last_good_state}"
|
43
|
+
|
44
|
+
if (current_step_nr < last_good_state)
|
45
|
+
#env.ui.info "fast forwarding #{step_name}"
|
46
|
+
return
|
47
|
+
end
|
48
|
+
|
49
|
+
#env.ui.info "Current step: #{current_step_nr}"
|
50
|
+
if (current_step_nr == last_good_state)
|
51
|
+
if vm.running?
|
52
|
+
vm.stop
|
53
|
+
end
|
54
|
+
|
55
|
+
#invalidate later snapshots
|
56
|
+
#env.ui.info "remove old snapshots"
|
57
|
+
|
58
|
+
for s in (last_good_state+1)..(snapnames.length-1)
|
59
|
+
env.ui.info "Removing step [#{s}] snapshot as it is no more valid"
|
60
|
+
snapshot=vm.find_snapshot(snapnames[s])
|
61
|
+
snapshot.destroy
|
62
|
+
#env.ui.info snapshot
|
63
|
+
end
|
64
|
+
|
65
|
+
vm.reload
|
66
|
+
env.ui.info "Loading step #{current_step_nr} snapshots as it has not changed"
|
67
|
+
sleep 2
|
68
|
+
goodsnap=vm.find_snapshot(snapnames[last_good_state])
|
69
|
+
goodsnap.restore
|
70
|
+
sleep 2
|
71
|
+
#TODO:Restore snapshot!!!
|
72
|
+
vm.start
|
73
|
+
sleep 4
|
74
|
+
env.ui.info "Starting machine"
|
75
|
+
end
|
76
|
+
|
77
|
+
#env.ui.info "last good state #{last_good_state}"
|
78
|
+
|
79
|
+
|
80
|
+
if (current_step_nr > last_good_state)
|
81
|
+
|
82
|
+
if (last_good_state==-1)
|
83
|
+
#no initial snapshot is found, clean machine!
|
84
|
+
vm=VirtualBox::VM.find(@box_name)
|
85
|
+
|
86
|
+
if !vm.nil?
|
87
|
+
if vm.running?
|
88
|
+
env.ui.info "Stopping machine"
|
89
|
+
vm.stop
|
90
|
+
while vm.running?
|
91
|
+
sleep 1
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
#detaching cdroms (used to work in 3.x)
|
96
|
+
# vm.medium_attachments.each do |m|
|
97
|
+
# if m.type==:dvd
|
98
|
+
# #env.ui.info "Detaching dvd"
|
99
|
+
# m.detach
|
100
|
+
# end
|
101
|
+
# end
|
102
|
+
|
103
|
+
vm.reload
|
104
|
+
env.ui.info "We found no good state so we are destroying the previous machine+disks"
|
105
|
+
destroy
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
#env.ui.info "(re-)executing step #{step_name}"
|
111
|
+
|
112
|
+
|
113
|
+
yield
|
114
|
+
|
115
|
+
#Need to look it up again because if it was an initial load
|
116
|
+
vm=VirtualBox::VM.find(@box_name)
|
117
|
+
env.ui.info "Step [#{current_step_nr}] was succesfully - saving state"
|
118
|
+
vm.save_state
|
119
|
+
sleep 2 #waiting for it to be ok
|
120
|
+
#env.ui.info "about to snapshot #{vm}"
|
121
|
+
#take snapshot after succesful execution
|
122
|
+
vm.take_snapshot(step_name,"snapshot taken by veewee")
|
123
|
+
sleep 2 #waiting for it to be started again
|
124
|
+
vm.start
|
125
|
+
end
|
126
|
+
|
127
|
+
#pp snapnames
|
128
|
+
end
|
129
|
+
|
130
|
+
def transaction(step_name,checksums,&block)
|
131
|
+
yield
|
132
|
+
end
|
133
|
+
end #Module
|
134
|
+
end #Module
|
135
|
+
end #Module
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'veewee/util/scancode'
|
2
|
+
require 'veewee/util/tcp'
|
3
|
+
require 'veewee/util/shell'
|
4
|
+
|
5
|
+
module Veewee
|
6
|
+
module Builder
|
7
|
+
module Virtualbox
|
8
|
+
module BoxHelper
|
9
|
+
def console_type(sequence)
|
10
|
+
send_virtualbox_sequence(sequence)
|
11
|
+
end
|
12
|
+
|
13
|
+
def send_virtualbox_sequence(sequence)
|
14
|
+
|
15
|
+
env.ui.info ""
|
16
|
+
|
17
|
+
counter=0
|
18
|
+
sequence.each { |s|
|
19
|
+
counter=counter+1
|
20
|
+
|
21
|
+
env.ui.info "Typing:[#{counter}]: "+s
|
22
|
+
|
23
|
+
keycodes=Veewee::Util::Scancode.string_to_keycode(s)
|
24
|
+
|
25
|
+
# VBox seems to have issues with sending the scancodes as one big
|
26
|
+
# .join()-ed string. It seems to get them out or order or ignore some.
|
27
|
+
# A workaround is to send the scancodes one-by-one.
|
28
|
+
codes=""
|
29
|
+
for keycode in keycodes.split(' ') do
|
30
|
+
unless keycode=="wait"
|
31
|
+
send_keycode(keycode)
|
32
|
+
sleep 0.01
|
33
|
+
else
|
34
|
+
sleep 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
#sleep after each sequence (needs to be param)
|
38
|
+
sleep 0.5
|
39
|
+
}
|
40
|
+
|
41
|
+
env.ui.info "Done typing."
|
42
|
+
env.ui.info ""
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def send_keycode(keycode)
|
47
|
+
command= "#{@vboxcmd} controlvm '#{name}' keyboardputscancode #{keycode}"
|
48
|
+
env.logger.info "#{command}"
|
49
|
+
sshresult=shell_exec("#{command}",{:mute => true})
|
50
|
+
unless sshresult.stdout.index("E_ACCESSDENIED").nil?
|
51
|
+
env.ui.error "There was an error typing the commands on the console"
|
52
|
+
env.ui.error "Probably the VM did not get started."
|
53
|
+
env.ui.error ""
|
54
|
+
env.ui.error "#{sshresult.stdout}"
|
55
|
+
exit -1
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end #Module
|
60
|
+
end #Module
|
61
|
+
end #Module
|
62
|
+
end #Module
|
@@ -0,0 +1,210 @@
|
|
1
|
+
module Veewee
|
2
|
+
module Builder
|
3
|
+
module Virtualbox
|
4
|
+
module BoxHelper
|
5
|
+
|
6
|
+
def add_ide_controller(definition)
|
7
|
+
#unless => "${vboxcmd} showvminfo '${vname}' | grep 'IDE Controller' "
|
8
|
+
command ="#{@vboxcmd} storagectl '#{name}' --name 'IDE Controller' --add ide"
|
9
|
+
shell_exec("#{command}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_sata_controller(definition)
|
13
|
+
#unless => "${vboxcmd} showvminfo '${vname}' | grep 'SATA Controller' ";
|
14
|
+
command ="#{@vboxcmd} storagectl '#{name}' --name 'SATA Controller' --add sata --hostiocache #{definition.hostiocache} --sataportcount 1"
|
15
|
+
shell_exec("#{command}")
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_ssh_nat_mapping(definition)
|
19
|
+
|
20
|
+
#Map SSH Ports
|
21
|
+
# command => "${vboxcmd} modifyvm '${vname}' --natpf1 'guestssh,tcp,,${hostsshport},,${guestsshport}'",
|
22
|
+
port = VirtualBox::NATForwardedPort.new
|
23
|
+
port.name = "guestssh"
|
24
|
+
port.guestport = definition.ssh_guest_port.to_i
|
25
|
+
port.hostport = definition.ssh_host_port.to_i
|
26
|
+
raw.network_adapters[0].nat_driver.forwarded_ports << port
|
27
|
+
port.save
|
28
|
+
raw.save
|
29
|
+
end
|
30
|
+
|
31
|
+
def raw
|
32
|
+
vm=VirtualBox::VM.find(name)
|
33
|
+
return vm
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_shared_folder(definition)
|
37
|
+
|
38
|
+
# command="#{@vboxcmd} sharedfolder add '#{name}' --name 'veewee-validation' --hostpath '#{File.expand_path(@environment.validation_dir)}' --automount"
|
39
|
+
# shell_exec("#{command}")
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_vm_location
|
44
|
+
command="#{@vboxcmd} list systemproperties"
|
45
|
+
shell_results=shell_exec("#{command}",{:mute => true})
|
46
|
+
location=shell_results.stdout.split(/\n/).grep(/Default machine/)[0].split(":")[1].strip
|
47
|
+
return location
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def suppress_messages
|
52
|
+
#Setting this annoying messages to register
|
53
|
+
VirtualBox::ExtraData.global["GUI/RegistrationData"]="triesLeft=0"
|
54
|
+
VirtualBox::ExtraData.global["GUI/UpdateDate"]="1 d, 2009-09-20"
|
55
|
+
VirtualBox::ExtraData.global["GUI/SuppressMessages"]="confirmInputCapture,remindAboutAutoCapture,remindAboutMouseIntegrationOff"
|
56
|
+
VirtualBox::ExtraData.global["GUI/UpdateCheckCount"]="60"
|
57
|
+
update_date=Time.now+86400
|
58
|
+
VirtualBox::ExtraData.global["GUI/UpdateDate"]="1 d, #{update_date.year}-#{update_date.month}-#{update_date.day}, stable"
|
59
|
+
VirtualBox::ExtraData.global.save
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def create_floppy(definition)
|
64
|
+
# Todo Check for java
|
65
|
+
# Todo check output of commands
|
66
|
+
|
67
|
+
# Check for floppy
|
68
|
+
unless definition.floppy_files.nil?
|
69
|
+
require 'tmpdir'
|
70
|
+
temp_dir=Dir.tmpdir
|
71
|
+
definition.floppy_files.each do |filename|
|
72
|
+
full_filename=full_filename=File.join(definition.path,filename)
|
73
|
+
FileUtils.cp("#{full_filename}","#{temp_dir}")
|
74
|
+
end
|
75
|
+
javacode_dir=File.expand_path(File.join(__FILE__,'..','..','java'))
|
76
|
+
floppy_file=File.join(definition.path,"virtualfloppy.vfd")
|
77
|
+
command="java -jar #{javacode_dir}/dir2floppy.jar '#{temp_dir}' '#{floppy_file}'"
|
78
|
+
shell_exec("#{command}")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_disk(definition)
|
83
|
+
# Now check the disks
|
84
|
+
# Maybe one day we can use the name, now we have to check location
|
85
|
+
# disk=VirtualBox::HardDrive.find(box_name)
|
86
|
+
location=name+"."+definition.disk_format.downcase
|
87
|
+
found=false
|
88
|
+
VirtualBox::HardDrive.all.each do |d|
|
89
|
+
if !d.location.match(/#{location}/).nil?
|
90
|
+
found=true
|
91
|
+
break
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Sometimes the above doesn't find a registered harddisk, but the vdi files is still there
|
96
|
+
if File.exists?(location)
|
97
|
+
env.ui.info "#{location} file still exists but isn't registered"
|
98
|
+
env.ui.info "Let me clean up that mess for you."
|
99
|
+
FileUtils.rm(location)
|
100
|
+
end
|
101
|
+
|
102
|
+
if !found
|
103
|
+
env.ui.info "Creating new harddrive of size #{definition.disk_size.to_i} "
|
104
|
+
|
105
|
+
#newdisk=VirtualBox::HardDrive.new
|
106
|
+
#newdisk.format=definition[:disk_format]
|
107
|
+
#newdisk.logical_size=definition[:disk_size].to_i
|
108
|
+
|
109
|
+
#newdisk.location=location
|
110
|
+
##PDB: again problems with the virtualbox GEM
|
111
|
+
##VirtualBox::Global.global.max_vdi_size=1000000
|
112
|
+
#newdisk.save
|
113
|
+
|
114
|
+
place=get_vm_location
|
115
|
+
command ="#{@vboxcmd} createhd --filename '#{place}/#{name}/#{name}.#{definition.disk_format.downcase}' --size '#{definition.disk_size.to_i}' --format #{definition.disk_format.downcase}"
|
116
|
+
shell_exec("#{command}")
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
def attach_disk(definition)
|
122
|
+
|
123
|
+
place=get_vm_location
|
124
|
+
location=name+"."+definition.disk_format.downcase
|
125
|
+
|
126
|
+
location="#{place}/#{name}/"+location
|
127
|
+
env.ui.info "Attaching disk: #{location}"
|
128
|
+
|
129
|
+
#command => "${vboxcmd} storageattach '${vname}' --storagectl 'SATA Controller' --port 0 --device 0 --type hdd --medium '${vname}.vdi'",
|
130
|
+
command ="#{@vboxcmd} storageattach '#{name}' --storagectl 'SATA Controller' --port 0 --device 0 --type hdd --medium '#{location}'"
|
131
|
+
shell_exec("#{command}")
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
def attach_isofile(definition)
|
137
|
+
full_iso_file=File.join(env.config.veewee.iso_dir,definition.iso_file)
|
138
|
+
env.ui.info "Mounting cdrom: #{full_iso_file}"
|
139
|
+
#command => "${vboxcmd} storageattach '${vname}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '${isodst}' ";
|
140
|
+
command ="#{@vboxcmd} storageattach '#{name}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '#{full_iso_file}'"
|
141
|
+
shell_exec("#{command}")
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
def add_floppy_controller(definition)
|
146
|
+
# Create floppy controller
|
147
|
+
unless definition.floppy_files.nil?
|
148
|
+
|
149
|
+
command="#{@vboxcmd} storagectl '#{name}' --name 'Floppy Controller' --add floppy"
|
150
|
+
shell_exec("#{command}")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
def attach_floppy(definition)
|
156
|
+
unless definition.floppy_files.nil?
|
157
|
+
|
158
|
+
# Attach floppy to machine (the vfd extension is crucial to detect msdos type floppy)
|
159
|
+
floppy_file=File.join(definition.path,"virtualfloppy.vfd")
|
160
|
+
command="#{@vboxcmd} storageattach '#{name}' --storagectl 'Floppy Controller' --port 0 --device 0 --type fdd --medium '#{floppy_file}'"
|
161
|
+
shell_exec("#{command}")
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def vbox_os_type_id(veewee_type_id)
|
166
|
+
type=env.config.ostypes[veewee_type_id][:vbox]
|
167
|
+
env.logger.info("Using VBOX os_type_id #{type}")
|
168
|
+
return type
|
169
|
+
end
|
170
|
+
|
171
|
+
def create_vm(definition)
|
172
|
+
command="#{@vboxcmd} createvm --name '#{name}' --ostype '#{vbox_os_type_id(definition.os_type_id)}' --register"
|
173
|
+
|
174
|
+
#Exec and system stop the execution here
|
175
|
+
shell_exec("#{command}")
|
176
|
+
|
177
|
+
env.ui.info "Creating vm #{name} : #{definition.memory_size}M - #{definition.cpu_count} CPU - #{vbox_os_type_id(definition.os_type_id)}"
|
178
|
+
|
179
|
+
#setting cpu's
|
180
|
+
command="#{@vboxcmd} modifyvm '#{name}' --cpus #{definition.cpu_count}"
|
181
|
+
shell_exec("#{command}")
|
182
|
+
|
183
|
+
#setting memory size
|
184
|
+
command="#{@vboxcmd} modifyvm '#{name}' --memory #{definition.memory_size}"
|
185
|
+
shell_exec("#{command}")
|
186
|
+
|
187
|
+
#setting bootorder
|
188
|
+
command="#{@vboxcmd} modifyvm '#{name}' --boot1 disk --boot2 dvd --boot3 none --boot4 none"
|
189
|
+
shell_exec("#{command}")
|
190
|
+
|
191
|
+
# Modify the vm to enable or disable hw virtualization extensions
|
192
|
+
vm_flags=%w{pagefusion acpi ioapic pae hpet hwvirtex hwvirtexcl nestedpaging largepages vtxvpid synthxcpu rtcuseutc}
|
193
|
+
|
194
|
+
vm_flags.each do |vm_flag|
|
195
|
+
if definition.instance_variable_defined?("@#{vm_flag}")
|
196
|
+
vm_flag_value=definition.instance_variable_get("@#{vm_flag}")
|
197
|
+
env.ui.info "Setting VM Flag #{vm_flag} to #{vm_flag_value}"
|
198
|
+
command="#{@vboxcmd} modifyvm #{name} --#{vm_flag.to_s} #{vm_flag_value}"
|
199
|
+
shell_exec("#{command}")
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
raw.reload
|
205
|
+
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Veewee
|
2
|
+
module Builder
|
3
|
+
module Virtualbox
|
4
|
+
module BoxHelper
|
5
|
+
|
6
|
+
def destroy
|
7
|
+
|
8
|
+
if raw.nil?
|
9
|
+
env.ui.error "Error:: You tried to destroy a non-existing box '#{name}'"
|
10
|
+
exit -1
|
11
|
+
end
|
12
|
+
|
13
|
+
# If it has a save state,remove that first
|
14
|
+
if raw.saved?
|
15
|
+
env.ui.info "Removing save state"
|
16
|
+
raw.discard_state
|
17
|
+
raw.reload
|
18
|
+
end
|
19
|
+
|
20
|
+
env.logger.info "Checking state: #{raw.state}"
|
21
|
+
if raw.state.to_s=="running"
|
22
|
+
# Poweroff
|
23
|
+
raw.stop
|
24
|
+
# Wait for it to happen
|
25
|
+
sleep 2
|
26
|
+
end
|
27
|
+
#:destroy_medium => :delete, will delete machine + all media attachments
|
28
|
+
#vm.destroy(:destroy_medium => :delete)
|
29
|
+
##vm.destroy(:destroy_image => true)
|
30
|
+
|
31
|
+
#VBoxManage unregistervm "test-machine" --delete
|
32
|
+
#because the destroy does remove the .vbox file on 4.0.x
|
33
|
+
#PDB
|
34
|
+
#vm.destroy()
|
35
|
+
|
36
|
+
command="#{@vboxcmd} unregistervm '#{name}' --delete"
|
37
|
+
env.ui.info command
|
38
|
+
env.ui.info "Deleting vm #{name}"
|
39
|
+
|
40
|
+
#Exec and system stop the execution here
|
41
|
+
shell_exec("#{command}")
|
42
|
+
sleep 1
|
43
|
+
|
44
|
+
#if the disk was not attached when the machine was destroyed we also need to delete the disk
|
45
|
+
location=name+"."
|
46
|
+
#+definition.disk_format.downcase
|
47
|
+
found=false
|
48
|
+
VirtualBox::HardDrive.all.each do |d|
|
49
|
+
if d.location.match(/#{location}/)
|
50
|
+
|
51
|
+
if File.exists?(d.location)
|
52
|
+
command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
|
53
|
+
else
|
54
|
+
command="#{@vboxcmd} closemedium disk '#{d.location}'"
|
55
|
+
end
|
56
|
+
|
57
|
+
#command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
|
58
|
+
env.ui.info "Deleting disk #{d.location}"
|
59
|
+
env.ui.info "#{command}"
|
60
|
+
|
61
|
+
shell_exec("#{command}")
|
62
|
+
|
63
|
+
if File.exists?(d.location)
|
64
|
+
env.ui.info "We tried to delete the disk file via virtualbox '#{d.location} but failed"
|
65
|
+
env.ui.info "Removing it manually"
|
66
|
+
FileUtils.rm(d.location)
|
67
|
+
exit -1
|
68
|
+
end
|
69
|
+
#v.3
|
70
|
+
#d.destroy(true)
|
71
|
+
break
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end #Module
|
77
|
+
end #Module
|
78
|
+
end #Module
|
79
|
+
end #Module
|