veewee 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/Rakefile +23 -23
- data/bin/veewee +1 -1
- data/doc/kvm.md +58 -9
- data/doc/providers.md +2 -2
- data/doc/vagrant.md +1 -1
- data/lib/vagrant_init.rb +0 -1
- data/lib/veewee/cli.rb +1 -1
- data/lib/veewee/command.rb +2 -2
- data/lib/veewee/command/fusion.rb +2 -2
- data/lib/veewee/command/kvm.rb +1 -1
- data/lib/veewee/command/parallels.rb +2 -2
- data/lib/veewee/command/vagrant/define.rb +1 -1
- data/lib/veewee/command/vagrant/undefine.rb +1 -1
- data/lib/veewee/command/vbox.rb +2 -2
- data/lib/veewee/config.rb +8 -10
- data/lib/veewee/definition.rb +41 -41
- data/lib/veewee/definitions.rb +27 -30
- data/lib/veewee/environment.rb +16 -16
- data/lib/veewee/error.rb +18 -15
- data/lib/veewee/provider/core/box/build.rb +1 -1
- data/lib/veewee/provider/kvm/box.rb +1 -6
- data/lib/veewee/provider/kvm/box/validate_kvm.rb +1 -1
- data/lib/veewee/provider/kvm/provider.rb +19 -32
- data/lib/veewee/provider/virtualbox/box/helper/create.rb +5 -1
- data/lib/veewee/providers.rb +22 -21
- data/lib/veewee/template.rb +9 -9
- data/lib/veewee/templates.rb +14 -15
- data/lib/veewee/ui.rb +7 -7
- data/lib/veewee/version.rb +1 -1
- data/templates/CentOS-6.3-i386-minimal/base.sh +1 -1
- data/templates/CentOS-6.3-i386-minimal/definition.rb +13 -4
- data/templates/CentOS-6.3-i386-minimal/ks.cfg +50 -14
- data/templates/CentOS-6.3-i386-minimal/virtualbox.sh +3 -3
- data/templates/CentOS-6.3-x86_64-minimal/base.sh +1 -1
- data/templates/CentOS-6.3-x86_64-netboot/base.sh +14 -0
- data/templates/CentOS-6.3-x86_64-netboot/chef.sh +3 -0
- data/templates/CentOS-6.3-x86_64-netboot/cleanup.sh +5 -0
- data/templates/CentOS-6.3-x86_64-netboot/definition.rb +40 -0
- data/templates/CentOS-6.3-x86_64-netboot/ks.cfg +41 -0
- data/templates/CentOS-6.3-x86_64-netboot/puppet.sh +12 -0
- data/templates/CentOS-6.3-x86_64-netboot/ruby.sh +3 -0
- data/templates/CentOS-6.3-x86_64-netboot/vagrant.sh +18 -0
- data/templates/CentOS-6.3-x86_64-netboot/virtualbox.sh +8 -0
- data/templates/{Debian-7.0-b2-i386-netboot → CentOS-6.3-x86_64-netboot}/zerodisk.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/base.sh +2 -3
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/chef.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/cleanup-virtualbox.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/cleanup.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-amd64-netboot}/definition.rb +3 -3
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-amd64-netboot}/preseed.cfg +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/puppet.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/ruby.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/vagrant.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-amd64-netboot}/virtualbox.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-amd64-netboot}/zerodisk.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/base.sh +2 -3
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/chef.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/cleanup-virtualbox.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/cleanup.sh +0 -0
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-i386-netboot}/definition.rb +3 -3
- data/templates/{Debian-7.0-b2-i386-netboot → Debian-7.0-b4-i386-netboot}/preseed.cfg +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/puppet.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/ruby.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/vagrant.sh +0 -0
- data/templates/{Debian-7.0-b3-amd64-netboot → Debian-7.0-b4-i386-netboot}/virtualbox.sh +0 -0
- data/templates/Debian-7.0-b4-i386-netboot/zerodisk.sh +3 -0
- data/templates/Fedora-18-i386/definition.rb +6 -6
- data/templates/Fedora-18-i386/postinstall.sh +3 -1
- data/templates/Fedora-18-x86_64/definition.rb +5 -5
- data/templates/Fedora-18-x86_64/postinstall.sh +6 -1
- data/templates/ubuntu-12.04.1-server-amd64-packages/postinstall.sh +4 -5
- data/templates/ubuntu-12.04.1-server-amd64/postinstall.sh +4 -5
- data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +6 -6
- data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +6 -6
- data/templates/windows-8-amd64/Autounattend.xml +140 -0
- data/templates/windows-8-amd64/README.md +134 -0
- data/templates/windows-8-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-8-amd64/definition.rb +101 -0
- data/templates/windows-8-amd64/install-cygwin-sshd.bat +38 -0
- data/templates/windows-8-amd64/install-winrm.bat +11 -0
- data/templates/windows-8-amd64/oracle-cert.cer +0 -0
- data/templates/windows-8-amd64/postinstall.sh +122 -0
- data/templates/windows-8-amd64/winrm.rb +8 -0
- data/templates/windows-8-i386/Autounattend.xml +140 -0
- data/templates/windows-8-i386/README.md +134 -0
- data/templates/windows-8-i386/cygwin-setup.exe +0 -0
- data/templates/windows-8-i386/definition.rb +101 -0
- data/templates/windows-8-i386/install-cygwin-sshd.bat +38 -0
- data/templates/windows-8-i386/install-winrm.bat +11 -0
- data/templates/windows-8-i386/oracle-cert.cer +0 -0
- data/templates/windows-8-i386/postinstall.sh +122 -0
- data/templates/windows-8-i386/winrm.rb +8 -0
- data/test/build_realtest.rb +4 -4
- data/veewee.gemspec +8 -9
- metadata +55 -27
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
**VeeWee:** the tool to easily build vagrant base boxes or kvm,virtualbox and fusion images
|
2
2
|
|
3
3
|
Vagrant is a great tool to test new things or changes in a virtual machine(Virtualbox) using either chef or puppet.
|
4
|
-
The first step is to download an existing 'base box'. I believe this scares a lot of people as they don't know who or how this box was
|
4
|
+
The first step is to download an existing 'base box'. I believe this scares a lot of people as they don't know who or how this box was built. Therefore lots of people end up first building their own base box to use with vagrant.
|
5
5
|
|
6
6
|
Besides building Vagrant boxes, veewee can also be used for:
|
7
7
|
|
data/Rakefile
CHANGED
@@ -25,33 +25,33 @@ Rake::TestTask.new do |t|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
desc 'Verify ISO'
|
28
|
-
task :iso, [:template_name] do |t,args|
|
28
|
+
task :iso, [:template_name] do |t, args|
|
29
29
|
require 'net/http'
|
30
30
|
#if args.to_hash.size!=1
|
31
31
|
#puts "needs one arguments: rake iso [\"yourname\"]"
|
32
32
|
#exit
|
33
33
|
#end
|
34
34
|
Dir.glob("templates/*").each do |name|
|
35
|
-
definition_name=File.basename(name)
|
35
|
+
definition_name = File.basename(name)
|
36
36
|
puts name
|
37
|
-
definition=Veewee::Environment.new(:cwd => "."
|
38
|
-
next if definition.nil? || definition.iso_src.nil? || definition.iso_src==""
|
37
|
+
definition = Veewee::Environment.new(:cwd => ".", :definition_dir => "templates").definitions[definition_name]
|
38
|
+
next if definition.nil? || definition.iso_src.nil? || definition.iso_src == ""
|
39
39
|
begin
|
40
|
-
url=definition.iso_src
|
41
|
-
found=false
|
40
|
+
url = definition.iso_src
|
41
|
+
found = false
|
42
42
|
response = nil
|
43
|
-
while found==false
|
44
|
-
uri=URI.parse(url)
|
43
|
+
while found == false
|
44
|
+
uri = URI.parse(url)
|
45
45
|
if uri.is_a?(URI::HTTP)
|
46
|
-
Net::HTTP.start(uri.host,uri.port) {|http|
|
46
|
+
Net::HTTP.start(uri.host, uri.port) { |http|
|
47
47
|
response = http.head(uri.path)
|
48
48
|
}
|
49
49
|
unless response['location'].nil?
|
50
50
|
#puts "Redirecting to "+response['location']
|
51
|
-
url=response['location']
|
51
|
+
url = response['location']
|
52
52
|
else
|
53
|
-
length=response['content-length']
|
54
|
-
found=true
|
53
|
+
length = response['content-length']
|
54
|
+
found = true
|
55
55
|
end
|
56
56
|
elsif uri.is_a?(URI::FTP)
|
57
57
|
require 'net/ftp'
|
@@ -62,7 +62,7 @@ task :iso, [:template_name] do |t,args|
|
|
62
62
|
found = true
|
63
63
|
rescue Net::FTPReplyError => e
|
64
64
|
reply = e.message
|
65
|
-
err_code = reply[0,3].to_i
|
65
|
+
err_code = reply[0, 3].to_i
|
66
66
|
unless err_code == 500 || err_code == 502
|
67
67
|
# other problem, raise
|
68
68
|
raise "Got ftp site but doesn't support size subcommand"
|
@@ -75,22 +75,22 @@ task :iso, [:template_name] do |t,args|
|
|
75
75
|
if length.to_i < 10000
|
76
76
|
puts definition.iso_src
|
77
77
|
puts "Incorrect length #{length.to_i}"
|
78
|
-
puts uri.host,uri.port, uri.path,response.code
|
78
|
+
puts uri.host, uri.port, uri.path, response.code
|
79
79
|
end
|
80
80
|
rescue Exception => ex
|
81
|
-
puts "Error"+ex.to_s+definition.iso_src
|
81
|
+
puts "Error" + ex.to_s + definition.iso_src
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
desc 'Autobuilds all templates and runs validation.'
|
87
|
-
task :autotest, [:pattern] do |t,args|
|
87
|
+
task :autotest, [:pattern] do |t, args|
|
88
88
|
|
89
89
|
# We overrule all timeouts for tcp and ssh
|
90
90
|
#ENV['VEEWEE_TIMEOUT']='600'
|
91
91
|
|
92
|
-
ve=Veewee::Environment.new
|
93
|
-
ve.templates.each do |name,template|
|
92
|
+
ve = Veewee::Environment.new
|
93
|
+
ve.templates.each do |name, template|
|
94
94
|
|
95
95
|
# If pattern was given, only take the ones that match the pattern
|
96
96
|
unless args[:pattern].nil?
|
@@ -98,11 +98,11 @@ task :autotest, [:pattern] do |t,args|
|
|
98
98
|
end
|
99
99
|
|
100
100
|
begin
|
101
|
-
ve.definitions.define("auto",name, { 'force' => true})
|
102
|
-
vd=ve.definitions["auto"]
|
103
|
-
box=ve.providers["virtualbox"].get_box("auto")
|
101
|
+
ve.definitions.define("auto", name, { 'force' => true })
|
102
|
+
vd = ve.definitions["auto"]
|
103
|
+
box = ve.providers["virtualbox"].get_box("auto")
|
104
104
|
puts "AUTO: Building #{name}"
|
105
|
-
box.build({"auto" => true,"force" => true, 'nogui' => true })
|
105
|
+
box.build({ "auto" => true, "force" => true, 'nogui' => true })
|
106
106
|
puts "AUTO: Validating #{name}"
|
107
107
|
box.validate_vagrant
|
108
108
|
puts "AUTO: Success #{name}"
|
@@ -111,7 +111,7 @@ task :autotest, [:pattern] do |t,args|
|
|
111
111
|
puts "AUTO: Template #{name} failed - #{ex}"
|
112
112
|
if box.running?
|
113
113
|
begin
|
114
|
-
screenshot="screenshot-auto-#{name}.png"
|
114
|
+
screenshot = "screenshot-auto-#{name}.png"
|
115
115
|
puts "AUTO: Taking snapshot #{screenshot}"
|
116
116
|
box.screenshot(screenshot)
|
117
117
|
rescue Veewee::Error => ex
|
data/bin/veewee
CHANGED
data/doc/kvm.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
# KVM Provider
|
2
2
|
|
3
|
-
|
3
|
+
NOTE: Virtualbox doesn't like KVM to be enabled
|
4
4
|
|
5
|
-
|
5
|
+
## Prerequisites
|
6
|
+
|
7
|
+
To check if your kernel can run kvm :
|
6
8
|
|
7
9
|
# kvm_ok or kvm-ok command (on Ubuntu at least)
|
8
10
|
kvm_ok
|
@@ -11,10 +13,59 @@ To check if you're kernel can run kvm :
|
|
11
13
|
|
12
14
|
The modules needed are the following : kvm, kvm_intel or kvm-amd.
|
13
15
|
|
14
|
-
|
16
|
+
You need to have at least one storage pool defined in libvirt. You can check all
|
17
|
+
available storage pools with
|
18
|
+
|
19
|
+
virsh pool-list
|
20
|
+
|
21
|
+
If no storage pool is listed, you can create a new storage pool which saves all
|
22
|
+
VM images in the directory /var/lib/libvirt/images with
|
23
|
+
|
24
|
+
mkdir -p /var/lib/libvirt/images
|
25
|
+
cat > /tmp/pool.xml << EOF
|
26
|
+
<pool type="dir">
|
27
|
+
<name>virtimages</name>
|
28
|
+
<target>
|
29
|
+
<path>/var/lib/libvirt/images</path>
|
30
|
+
<format type='qcow2'/>
|
31
|
+
</target>
|
32
|
+
</pool>
|
33
|
+
EOF
|
34
|
+
virsh pool-create /tmp/pool.xml
|
35
|
+
|
36
|
+
You need to have at least one network defined. You can check all available
|
37
|
+
networks with
|
38
|
+
|
39
|
+
virsh net-list
|
40
|
+
|
41
|
+
If there is no default network, consult the documentation of your operating
|
42
|
+
system to find out how to creat it.
|
43
|
+
|
44
|
+
If you are using libvirt with a URI different than the default `qemu:///system`,
|
45
|
+
you need to create a config file for fog.io. If your libvirt endpoint is
|
46
|
+
accessible at `qemu+ssh://cloud@myhost.com/system` you can create the .fog config
|
47
|
+
file with
|
48
|
+
|
49
|
+
cat > ~/.fog << EOF
|
50
|
+
:default:
|
51
|
+
:libvirt_uri: qemu+ssh://cloud@myhost.com/system
|
52
|
+
|
53
|
+
## Using VeeWee
|
54
|
+
|
55
|
+
List available templates
|
56
|
+
|
57
|
+
veewee kvm templates
|
58
|
+
|
59
|
+
Use one of the listed templates to define a new box e.g. with
|
60
|
+
|
61
|
+
veewee kvm define 'My Ubuntu 12.10 box' 'ubuntu-12.10-server-amd64'
|
62
|
+
|
63
|
+
Build the box using KVM / Quemu (this will take a while)
|
64
|
+
|
65
|
+
veewee kvm build 'My Ubuntu 12.10 box'
|
15
66
|
|
16
|
-
|
17
|
-
|
67
|
+
You may want to use the VNC console (e.g. through virt-manager) to monitor /
|
68
|
+
check the build process.
|
18
69
|
|
19
70
|
## Options
|
20
71
|
|
@@ -25,9 +76,7 @@ There is currently few options supported :
|
|
25
76
|
2. **network_bridge_name**: the name of the bridge. It is used just in case
|
26
77
|
**network_type** is set to _bridge_.
|
27
78
|
3. **pool_name**: the _storage_ pool name to be used when creating the box. If
|
28
|
-
not specified, the default one is used.
|
29
|
-
with the current fog version (1.7.0) but should be fixed as soon as the fog
|
30
|
-
gem is released_.
|
79
|
+
not specified, the default one is used.
|
31
80
|
|
32
81
|
## Notes
|
33
82
|
|
data/doc/providers.md
CHANGED
@@ -18,6 +18,6 @@ To interact with the screen , veewee enables VNC on the created vmware fusion ma
|
|
18
18
|
|
19
19
|
## KVM
|
20
20
|
|
21
|
-
To interact with KVM veewee, uses [libvirt support](http://libvirt.org/ruby/) provided through [Fog gem](http://fog.io)
|
21
|
+
To interact with KVM veewee, uses [libvirt support](http://libvirt.org/ruby/) provided through [Fog gem](http://fog.io).
|
22
22
|
|
23
|
-
To interact with the screen , veewee enables VNC on the created
|
23
|
+
To interact with the screen , veewee enables VNC on the created kvm machines and use the [Ruby-VNC gem](http://code.google.com/p/ruby-vnc/) to send the keystrokes. Here too , sending keystrokes too fast is a problem.
|
data/doc/vagrant.md
CHANGED
@@ -3,7 +3,7 @@ Let's define a Ubuntu 10.10 server i386 basebox called myunbuntubox
|
|
3
3
|
this is essentially making a copy based on the templates provided above.
|
4
4
|
|
5
5
|
$ veewee vbox define 'myubuntubox' 'ubuntu-10.10-server-i386'
|
6
|
-
The basebox 'myubuntubox' has been
|
6
|
+
The basebox 'myubuntubox' has been successfully created from the template ''ubuntu-10.10-server-i386'
|
7
7
|
You can now edit the definition files stored in definitions/myubuntubox
|
8
8
|
or build the box with:
|
9
9
|
veewee vbox build 'myubuntubox'
|
data/lib/vagrant_init.rb
CHANGED
data/lib/veewee/cli.rb
CHANGED
@@ -30,7 +30,7 @@ module Veewee
|
|
30
30
|
# command listing.
|
31
31
|
# @param [Hash] opts Other options (not gone into detail here, look at
|
32
32
|
# the source instead).
|
33
|
-
def self.register(klass, name, usage, description, opts=nil)
|
33
|
+
def self.register(klass, name, usage, description, opts = nil)
|
34
34
|
opts ||= {}
|
35
35
|
|
36
36
|
if klass <= Command::GroupBase
|
data/lib/veewee/command.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Veewee
|
2
2
|
module Command
|
3
|
-
autoload :Base,
|
3
|
+
autoload :Base, 'veewee/command/base'
|
4
4
|
autoload :GroupBase, 'veewee/command/group_base'
|
5
|
-
autoload :Helpers,
|
5
|
+
autoload :Helpers, 'veewee/command/helpers'
|
6
6
|
autoload :NamedBase, 'veewee/command/named_base'
|
7
7
|
end
|
8
8
|
end
|
@@ -93,7 +93,7 @@ module Veewee
|
|
93
93
|
venv=Veewee::Environment.new(options)
|
94
94
|
venv.ui=env.ui
|
95
95
|
venv.definitions.define(definition_name,template_name,options)
|
96
|
-
env.ui.info "The basebox '#{definition_name}' has been
|
96
|
+
env.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
|
97
97
|
env.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
|
98
98
|
env.ui.info "veewee fusion build '#{definition_name}'"
|
99
99
|
end
|
@@ -106,7 +106,7 @@ module Veewee
|
|
106
106
|
venv=Veewee::Environment.new(options)
|
107
107
|
venv.ui=env.ui
|
108
108
|
venv.definitions.undefine(definition_name,options)
|
109
|
-
env.ui.info "Definition #{definition_name}
|
109
|
+
env.ui.info "Definition #{definition_name} successfully removed",:prefix => false
|
110
110
|
rescue Error => ex
|
111
111
|
env.ui.error "#{ex}" , :prefix => false
|
112
112
|
exit -1
|
data/lib/veewee/command/kvm.rb
CHANGED
@@ -60,7 +60,7 @@ module Veewee
|
|
60
60
|
venv=Veewee::Environment.new(options)
|
61
61
|
venv.ui=env.ui
|
62
62
|
venv.definitions.define(definition_name,template_name,options)
|
63
|
-
env.ui.info "The basebox '#{definition_name}' has been
|
63
|
+
env.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
|
64
64
|
env.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
|
65
65
|
env.ui.info "veewee kvm build '#{definition_name}'"
|
66
66
|
end
|
@@ -57,7 +57,7 @@ module Veewee
|
|
57
57
|
venv=Veewee::Environment.new(options)
|
58
58
|
venv.ui=env.ui
|
59
59
|
venv.definitions.define(definition_name,template_name,options)
|
60
|
-
env.ui.info "The basebox '#{definition_name}' has been
|
60
|
+
env.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
|
61
61
|
env.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
|
62
62
|
env.ui.info "veewee parallels build '#{definition_name}'"
|
63
63
|
end
|
@@ -70,7 +70,7 @@ module Veewee
|
|
70
70
|
venv=Veewee::Environment.new(options)
|
71
71
|
venv.ui=env.ui
|
72
72
|
venv.definitions.undefine(definition_name,options)
|
73
|
-
env.ui.info "Definition #{definition_name}
|
73
|
+
env.ui.info "Definition #{definition_name} successfully removed",:prefix => false
|
74
74
|
rescue Error => ex
|
75
75
|
env.ui.error "#{ex}" , :prefix => false
|
76
76
|
exit -1
|
@@ -33,7 +33,7 @@ module Veewee
|
|
33
33
|
definition_name=argv[0]
|
34
34
|
template_name=argv[1]
|
35
35
|
venv.definitions.define(definition_name,template_name,options)
|
36
|
-
venv.ui.info "The basebox '#{definition_name}' has been
|
36
|
+
venv.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
|
37
37
|
venv.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
|
38
38
|
venv.ui.info "vagrant basebox build '#{definition_name}'"
|
39
39
|
rescue Veewee::Error => ex
|
@@ -28,7 +28,7 @@ module Veewee
|
|
28
28
|
venv.ui=@env.ui
|
29
29
|
definition_name=argv[0]
|
30
30
|
venv.definitions.undefine(definition_name,options)
|
31
|
-
venv.ui.info("Definition '#{definition_name}'
|
31
|
+
venv.ui.info("Definition '#{definition_name}' successfully removed",:prefix => false)
|
32
32
|
rescue Veewee::Error => ex
|
33
33
|
venv.ui.error(ex,:prefix => false)
|
34
34
|
exit -1
|
data/lib/veewee/command/vbox.rb
CHANGED
@@ -79,7 +79,7 @@ module Veewee
|
|
79
79
|
venv=Veewee::Environment.new(options)
|
80
80
|
venv.ui=env.ui
|
81
81
|
venv.definitions.define(definition_name,template_name,options)
|
82
|
-
env.ui.info "The basebox '#{definition_name}' has been
|
82
|
+
env.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
|
83
83
|
env.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
|
84
84
|
env.ui.info "veewee vbox build '#{definition_name}'"
|
85
85
|
rescue Error => ex
|
@@ -96,7 +96,7 @@ module Veewee
|
|
96
96
|
venv=Veewee::Environment.new(options)
|
97
97
|
venv.ui=env.ui
|
98
98
|
venv.definitions.undefine(definition_name,options)
|
99
|
-
env.ui.info "Definition #{definition_name}
|
99
|
+
env.ui.info "Definition #{definition_name} successfully removed" , :prefix => false
|
100
100
|
rescue Error => ex
|
101
101
|
env.ui.error("#{ex}",:prefix => false)
|
102
102
|
exit -1
|
data/lib/veewee/config.rb
CHANGED
@@ -10,18 +10,18 @@ module Veewee
|
|
10
10
|
attr_reader :env
|
11
11
|
|
12
12
|
def initialize(options)
|
13
|
-
@env=options[:env]
|
13
|
+
@env = options[:env]
|
14
14
|
|
15
15
|
# Initialize with defaults
|
16
|
-
@veewee
|
16
|
+
@veewee = ::Veewee::Config::Veewee.new(self)
|
17
17
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def define()
|
21
|
-
config=OpenStruct.new
|
21
|
+
config = OpenStruct.new
|
22
22
|
|
23
23
|
# Expose the veewee config
|
24
|
-
config.veewee
|
24
|
+
config.veewee = @veewee
|
25
25
|
|
26
26
|
# Process config file
|
27
27
|
yield config
|
@@ -30,12 +30,12 @@ module Veewee
|
|
30
30
|
|
31
31
|
# We put a long name to not clash with any function in the Veewee file itself
|
32
32
|
def load_veewee_config()
|
33
|
-
veewee_configurator=self
|
33
|
+
veewee_configurator = self
|
34
34
|
begin
|
35
|
-
filename=File.join(Dir.pwd,"Veeweefile")
|
35
|
+
filename = File.join(Dir.pwd, "Veeweefile")
|
36
36
|
if File.exists?(filename)
|
37
|
-
veeweefile=File.read(filename)
|
38
|
-
veeweefile["Veewee::Config.run"]="veewee_configurator.define"
|
37
|
+
veeweefile = File.read(filename)
|
38
|
+
veeweefile["Veewee::Config.run"] = "veewee_configurator.define"
|
39
39
|
# http://www.dan-manges.com/blog/ruby-dsls-instance-eval-with-delegation
|
40
40
|
instance_eval(veeweefile)
|
41
41
|
else
|
@@ -57,7 +57,5 @@ module Veewee
|
|
57
57
|
return self
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
60
|
end #End Class
|
63
61
|
end #End Module
|
data/lib/veewee/definition.rb
CHANGED
@@ -10,18 +10,18 @@ module Veewee
|
|
10
10
|
attr_accessor :env
|
11
11
|
attr_accessor :path
|
12
12
|
|
13
|
-
attr_accessor :cpu_count
|
13
|
+
attr_accessor :cpu_count, :memory_size, :video_memory_size, :iso_file
|
14
14
|
attr_accessor :disk_size, :disk_format, :disk_variant
|
15
15
|
|
16
16
|
attr_accessor :os_type_id
|
17
17
|
|
18
|
-
attr_accessor :boot_wait
|
18
|
+
attr_accessor :boot_wait, :boot_cmd_sequence
|
19
19
|
|
20
|
-
attr_accessor :kickstart_port
|
20
|
+
attr_accessor :kickstart_port, :kickstart_ip, :kickstart_timeout, :kickstart_file
|
21
21
|
|
22
|
-
attr_accessor :ssh_login_timeout, :ssh_user
|
22
|
+
attr_accessor :ssh_login_timeout, :ssh_user, :ssh_password, :ssh_key, :ssh_host_port, :ssh_guest_port
|
23
23
|
|
24
|
-
attr_accessor :winrm_login_timeout, :winrm_user
|
24
|
+
attr_accessor :winrm_login_timeout, :winrm_user, :winrm_password, :winrm_host_port, :winrm_guest_port
|
25
25
|
|
26
26
|
attr_accessor :sudo_cmd
|
27
27
|
attr_accessor :shutdown_cmd
|
@@ -32,10 +32,9 @@ module Veewee
|
|
32
32
|
|
33
33
|
attr_accessor :floppy_files
|
34
34
|
|
35
|
+
attr_accessor :use_hw_virt_ext, :use_pae, :hostiocache, :use_sata
|
35
36
|
|
36
|
-
attr_accessor :
|
37
|
-
|
38
|
-
attr_accessor :iso_dowload_timeout, :iso_src,:iso_md5 ,:iso_download_instructions
|
37
|
+
attr_accessor :iso_dowload_timeout, :iso_src, :iso_md5, :iso_download_instructions
|
39
38
|
|
40
39
|
attr_accessor :virtualbox
|
41
40
|
attr_accessor :vmfusion
|
@@ -50,22 +49,22 @@ module Veewee
|
|
50
49
|
@_ui
|
51
50
|
end
|
52
51
|
|
53
|
-
def initialize(name,path,env)
|
52
|
+
def initialize(name, path, env)
|
54
53
|
|
55
|
-
@name=name
|
56
|
-
@env=env
|
54
|
+
@name = name
|
55
|
+
@env = env
|
57
56
|
|
58
|
-
if path.nil?
|
59
|
-
@path=File.join(env.definition_dir,name)
|
57
|
+
if path.nil?
|
58
|
+
@path = File.join(env.definition_dir, name)
|
60
59
|
else
|
61
|
-
@path=path
|
60
|
+
@path = path
|
62
61
|
end
|
63
62
|
|
64
|
-
# Default is 1 CPU + 256 Mem of memory
|
65
|
-
@cpu_count='1' ; @memory_size='256';
|
63
|
+
# Default is 1 CPU + 256 Mem of memory + 8 Mem of video memory
|
64
|
+
@cpu_count = '1' ; @memory_size = '256'; @video_memory_size = '8'
|
66
65
|
|
67
66
|
# Default there is no ISO file mounted
|
68
|
-
@iso_file = nil, @iso_src = nil ; @iso_md5 = nil ; @iso_download_timeout=1000 ; @iso_download_instructions = nil
|
67
|
+
@iso_file = nil, @iso_src = nil ; @iso_md5 = nil ; @iso_download_timeout = 1000 ; @iso_download_instructions = nil
|
69
68
|
|
70
69
|
# Shares to add
|
71
70
|
@add_shares = []
|
@@ -75,10 +74,10 @@ module Veewee
|
|
75
74
|
|
76
75
|
# Default there are no post install files
|
77
76
|
@pre_postinstall_file = nil
|
78
|
-
@postinstall_files=[]; @postinstall_timeout = 10000;
|
77
|
+
@postinstall_files = [] ; @postinstall_timeout = 10000 ;
|
79
78
|
|
80
|
-
@iso_file=""
|
81
|
-
@disk_size = '10240'; @disk_format = 'VDI'; @disk_variant = 'Standard'
|
79
|
+
@iso_file = ""
|
80
|
+
@disk_size = '10240' ; @disk_format = 'VDI' ; @disk_variant = 'Standard'
|
82
81
|
@use_sata = true
|
83
82
|
|
84
83
|
# :hostiocache => 'off' ,
|
@@ -86,17 +85,17 @@ module Veewee
|
|
86
85
|
# :boot_wait => "10", :boot_cmd_sequence => [ "boot"],
|
87
86
|
# :kickstart_port => "7122", :kickstart_ip => "127.0.0.1", :kickstart_timeout => 10000,#
|
88
87
|
# :ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "",
|
89
|
-
@ssh_host_port = "2222"; @ssh_guest_port = "22"
|
88
|
+
@ssh_host_port = "2222" ; @ssh_guest_port = "22"
|
90
89
|
# :ssh_host_port => "2222", :ssh_guest_port => "22", :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
|
91
90
|
# :shutdown_cmd => "shutdown -h now",
|
92
91
|
# :kickstart_file => nil,
|
93
|
-
@winrm_host_port = "5985"; @winrm_guest_port = "5985"
|
92
|
+
@winrm_host_port = "5985" ; @winrm_guest_port = "5985"
|
94
93
|
@winrm_login_timeout = "10000"
|
95
94
|
@boot_cmd_sequence = [] # Empty list by default
|
96
95
|
|
97
|
-
@virtualbox={:vm_options => {}}
|
98
|
-
@vmfusion={:vm_options => {}}
|
99
|
-
@kvm={:vm_options => {}}
|
96
|
+
@virtualbox = { :vm_options => {} }
|
97
|
+
@vmfusion = { :vm_options => {} }
|
98
|
+
@kvm = { :vm_options => {} }
|
100
99
|
|
101
100
|
end
|
102
101
|
|
@@ -111,56 +110,56 @@ module Veewee
|
|
111
110
|
end
|
112
111
|
|
113
112
|
# Class method to loading a definition
|
114
|
-
def self.load(name,env)
|
113
|
+
def self.load(name, env)
|
115
114
|
|
116
115
|
# Construct the path to the definition
|
117
116
|
|
118
|
-
path=File.join(env.definition_dir,name)
|
119
|
-
definition=Veewee::Definition.new(name,path,env)
|
117
|
+
path = File.join(env.definition_dir, name)
|
118
|
+
definition = Veewee::Definition.new(name, path, env)
|
120
119
|
env.logger.info "Loading definition directory #{definition.path}"
|
121
120
|
unless definition.exists?
|
122
|
-
raise Veewee::DefinitionNotExist,"Error: Definition #{name} does not seem to exist"
|
121
|
+
raise Veewee::DefinitionNotExist, "Error: Definition #{name} does not seem to exist"
|
123
122
|
end
|
124
123
|
|
125
124
|
# We create this longer name to avoid clashes
|
126
|
-
veewee_definition=definition
|
125
|
+
veewee_definition = definition
|
127
126
|
|
128
127
|
if definition.exists?
|
129
|
-
definition_file=File.join(definition.path,"definition.rb")
|
130
|
-
content=File.read(definition_file)
|
128
|
+
definition_file = File.join(definition.path, "definition.rb")
|
129
|
+
content = File.read(definition_file)
|
131
130
|
|
132
|
-
content.gsub!("Veewee::Session.declare","veewee_definition.declare")
|
133
|
-
content.gsub!("Veewee::Definition.declare","veewee_definition.declare")
|
131
|
+
content.gsub!("Veewee::Session.declare", "veewee_definition.declare")
|
132
|
+
content.gsub!("Veewee::Definition.declare", "veewee_definition.declare")
|
134
133
|
|
135
134
|
env.logger.info(content)
|
136
135
|
|
137
136
|
begin
|
138
|
-
cwd=FileUtils.pwd
|
137
|
+
cwd = FileUtils.pwd
|
139
138
|
env.logger.info("Entering path #{definition.path}")
|
140
139
|
FileUtils.cd(definition.path)
|
141
140
|
self.instance_eval(content)
|
142
|
-
env.logger.info("Returning to
|
141
|
+
env.logger.info("Returning to path #{cwd}")
|
143
142
|
FileUtils.cd(cwd)
|
144
143
|
rescue NameError => ex
|
145
|
-
raise Veewee::DefinitionError,"NameError reading definition from file #{definition_file} #{ex}"
|
144
|
+
raise Veewee::DefinitionError, "NameError reading definition from file #{definition_file} #{ex}"
|
146
145
|
rescue Exception => ex
|
147
|
-
raise Veewee::DefinitionError,"Error in the definition from file #{definition_file}\n#{ex}"
|
146
|
+
raise Veewee::DefinitionError, "Error in the definition from file #{definition_file}\n#{ex}"
|
148
147
|
end
|
149
148
|
else
|
150
149
|
env.logger.fatal("#{definition_file} not found")
|
151
|
-
raise Veewee::DefinitionNotExist,"#{definition_file} not found"
|
150
|
+
raise Veewee::DefinitionNotExist, "#{definition_file} not found"
|
152
151
|
end
|
153
152
|
|
154
153
|
if definition.valid?
|
155
154
|
return definition
|
156
155
|
else
|
157
156
|
env.logger.fatal("Invalid Definition")
|
158
|
-
raise Veewee::DefinitionError,"Invalid Definition"
|
157
|
+
raise Veewee::DefinitionError, "Invalid Definition"
|
159
158
|
end
|
160
159
|
end
|
161
160
|
|
162
161
|
def exists?
|
163
|
-
filename=File.join(path,"definition.rb")
|
162
|
+
filename = File.join(path, "definition.rb")
|
164
163
|
unless File.exists?(filename)
|
165
164
|
return false
|
166
165
|
end
|
@@ -190,6 +189,7 @@ module Veewee
|
|
190
189
|
end
|
191
190
|
|
192
191
|
private
|
192
|
+
|
193
193
|
def ostype_valid?
|
194
194
|
unless env.ostypes.has_key?(@os_type_id)
|
195
195
|
env.ui.info("The ostype: #{@os_type_id} is not available")
|