Permalink
Browse files

merged in jedi4ever/veewee master

  • Loading branch information...
hh committed Oct 29, 2012
2 parents 6084cdc + 546abda commit 6731611a21e9ffab4c4605a51257295063f30b73
Showing 393 changed files with 7,772 additions and 2,195 deletions.
View
@@ -6,6 +6,7 @@
source "http://rubygems.org"
#gem "veewee", :path => "."
+#gem "fission", :path => '/Users/patrick/dev/fission'
group :test do
gem "rake"
View
@@ -11,18 +11,18 @@ Besides building Vagrant boxes, veewee can also be used for:
Before you start read through:
-- the [requirements](veewee/tree/master/doc/requirements.md)
-- the [installation](veewee/tree/master/doc/installation.md) procedure
+- the [requirements](https://github.com/jedi4ever/veewee/tree/master/doc/requirements.md)
+- the [installation](https://github.com/jedi4ever/veewee/tree/master/doc/installation.md) procedure
Depending on how you want to use veewee, read through one of the following guides: (**work in progres**)
-- [guide for vagrant](veewee/tree/master/doc/vagrant.md)
+- [guide for vagrant](https://github.com/jedi4ever/veewee/tree/master/doc/vagrant.md)
-- [guide for Virtualbox](veewee/tree/master/doc/vbox.md)
-- [guide for Vmware fusion](veewee/tree/master/doc/fusion.md)
-- [guide for KVM](veewee/tree/master/doc/kvm.md)
+- [guide for Virtualbox](https://github.com/jedi4ever/veewee/tree/master/doc/vbox.md)
+- [guide for Vmware fusion](https://github.com/jedi4ever/veewee/tree/master/doc/fusion.md)
+- [guide for KVM](https://github.com/jedi4ever/veewee/tree/master/doc/kvm.md)
-You can also look at the more detailed pages on each subject in the [documentation directory](veewee/tree/master/doc)
+You can also look at the more detailed pages on each subject in the [documentation directory](https://github.com/jedi4ever/veewee/tree/master/doc)
People have reported good experiences, why don't you give it a try?
View
@@ -42,20 +42,39 @@ task :iso, [:template_name] do |t,args|
response = nil
while found==false
uri=URI.parse(url)
- Net::HTTP.start(uri.host,uri.port) {|http|
- response = http.head(uri.path)
- }
- unless response['location'].nil?
- #puts "Redirecting to "+response['location']
- url=response['location']
- else
- found=true
+ if uri.is_a?(URI::HTTP)
+ Net::HTTP.start(uri.host,uri.port) {|http|
+ response = http.head(uri.path)
+ }
+ unless response['location'].nil?
+ #puts "Redirecting to "+response['location']
+ url=response['location']
+ else
+ length=response['content-length']
+ found=true
+ end
+ elsif uri.is_a?(URI::FTP)
+ require 'net/ftp'
+ ftp = Net::FTP.new(uri.host)
+ ftp.login
+ begin
+ length = ftp.size(uri.path)
+ found = true
+ rescue Net::FTPReplyError => e
+ reply = e.message
+ err_code = reply[0,3].to_i
+ unless err_code == 500 || err_code == 502
+ # other problem, raise
+ raise "Got ftp site but doesn't support size subcommand"
+ end
+ # fallback solution
+ end
+
end
end
- length=response['content-length']
if length.to_i < 10000
puts definition.iso_src
- p response['content-type']
+ puts "Incorrect length #{length.to_i}"
puts uri.host,uri.port, uri.path,response.code
end
rescue Exception => ex
View
@@ -1,4 +1,9 @@
#!/usr/bin/env ruby
+begin
+ require 'rubygems'
+rescue LoadError
+end
+
require 'veewee'
env = Veewee::Environment.new
View
@@ -1,12 +1,16 @@
# Veewee definition
## Creating a definition
-A definition is create be 'cloning' a *template*.
+A definition is created by 'cloning' a *template*.
To create a definition you use the 'define' subcommand:
veewee vbox define 'myubuntu' 'ubuntu-10.10-server-amd64'
+If you want to use an external repo for the definition you can specify a git-url
+
+ veewee vbox define 'myubuntu' 'git://github.com/jedi4ever/myubuntu'
+
## Modifying a definition
Definitions are stored under a directory 'definitions' relative to the current directory.
@@ -48,6 +52,9 @@ The 'Veewee::Session.declare' is now deprecated and you should use 'Veewee::Defi
The default user of definitions is now 'veewee' and not 'vagrant'. This is because on other virtualizations like fusion and kvm, there is not relationship with the 'vagrant'. Users 'vagrant' are created by the 'vagrant.sh' script and not by the preseed or kickstart.
+_Using ERB in files_
+
+Add '.erb' to your files in a definition and they will get rendered (useful for generting kickstart,postinstall) (thx @mconigilaro)
## Listing existing definitions
View
@@ -1 +1,7 @@
-Coming Soon
+More Coming Soon
+
+Development Libraries:
+
+libxslt1-dev
+libxml2-dev
+zlib1g-dev
View
@@ -17,7 +17,7 @@ this is essentially making a copy based on the templates provided above.
Veewee::Definition.declare( {
:cpu_count => '1', :memory_size=> '256',
- :disk_size => '10140', :disk_format => 'VDI',
+ :disk_size => '10140', :disk_format => 'VDI', :disk_variant => 'Standard',
:os_type_id => 'Ubuntu',
:iso_file => "ubuntu-10.10-server-i386.iso",
:iso_src => "http://releases.ubuntu.com/maverick/ubuntu-10.10-server-i386.iso",
@@ -104,7 +104,7 @@ I suggest the easiest way is to get an account on github and fork of the veewee
If you don't use rvm, be sure to execute vagrant through bundle exec
- $ alias vagrant="bundle exec vagrant"
+ $ alias veewee="bundle exec veewee"
Start of an existing one
View
@@ -5,9 +5,10 @@
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
-require 'fission/error'
+#require 'fission/error'
require 'fission/cli'
require 'fission/command'
+require 'fission/command_helpers'
require 'fission/command/clone'
require 'fission/command/snapshot_create'
require 'fission/command/snapshot_list'
@@ -16,12 +17,12 @@
require 'fission/command/status'
require 'fission/command/stop'
require 'fission/command/suspend'
-require 'fission/command/delete'
require 'fission/config'
require 'fission/core_ext/class'
require 'fission/core_ext/file'
require 'fission/core_ext/object'
require 'fission/fusion'
+require 'fission/lease'
require 'fission/metadata'
require 'fission/response'
require 'fission/ui'
@@ -35,7 +36,4 @@ def config
@config ||= Fission::Config.new
end
- def ui
- @ui ||= Fission::UI.new
- end
end
View
@@ -1,76 +0,0 @@
-module Fission
- class CLI
- def self.execute(args=ARGV)
- optparse = OptionParser.new do |opts|
- opts.banner = "\nUsage: fission [options] COMMAND [arguments]"
-
- opts.on_head('-v', '--version', 'Output the version of fission') do
- Fission.ui.output Fission::VERSION
- exit(0)
- end
-
- opts.on_head('-h', '--help', 'Displays this message') do
- show_all_help(optparse)
- exit(0)
- end
-
- opts.define_tail do
- commands_banner
- end
-
- end
-
- begin
- optparse.order! args
- rescue OptionParser::InvalidOption => e
- Fission.ui.output e
- show_all_help(optparse)
- exit(1)
- end
-
- if commands.include?(args.first)
- @cmd = Fission::Command.const_get(args.first.capitalize).new args.drop 1
- elsif is_snapshot_command?(args)
- klass = args.take(2).map {|c| c.capitalize}.join('')
- @cmd = Fission::Command.const_get(klass).new args.drop 2
- else
- show_all_help(optparse)
- exit(1)
- end
-
- begin
- @cmd.execute
- rescue Error => e
- puts "Error: #{e}"
- end
- end
-
- def self.commands
- cmds = Dir.entries(File.join(File.dirname(__FILE__), 'command')).select do |file|
- !File.directory? file
- end
-
- cmds.map { |cmd| File.basename(cmd, '.rb').gsub '_', ' ' }
- end
-
- private
- def self.is_snapshot_command?(args)
- args.first == 'snapshot' && args.count > 1 && commands.include?(args.take(2).join(' '))
- end
-
- def self.commands_banner
- text = "\nCommands:\n"
- Fission::Command.descendants.each do |command_klass|
- text << (command_klass.send :help)
- end
-
- text
- end
-
- def self.show_all_help(options)
- Fission.ui.output options
- Fission.ui.output commands_banner
- end
-
- end
-end
View
@@ -1,15 +0,0 @@
-module Fission
- class Command
- attr_reader :options, :args
-
- def initialize(args=[])
- @options = OpenStruct.new
- @args = args
- end
-
- def self.help
- self.new.option_parser.to_s
- end
-
- end
-end
@@ -1,68 +0,0 @@
-module Fission
- class Command
- class Clone < Command
-
- def initialize(args=[])
- super
- @options.start = false
- end
-
- def execute
- option_parser.parse! @args
-
- unless @args.count > 1
- Fission.ui.output self.class.help
- Fission.ui.output ""
- Fission.ui.output_and_exit "Incorrect arguments for clone command", 1
- end
-
- source_vm_name = @args.first
- target_vm_name = @args[1]
- source_vm=Fission::VM.new(source_vm_name)
- target_vm=Fission::VM.new(target_vm_name)
-
- unless source_vm.exists?
- Fission.ui.output_and_exit "Unable to find the source vm #{source_vm_name} (#{source_vm.path})", 1
- end
-
- if target_vm.exists?
- Fission::ui.output_and_exit "The target vm #{target_vm_name} already exists", 1
- end
-
- clone_task = Fission::VM.clone source_vm_name, target_vm_name
-
- if clone_task.successful?
- Fission.ui.output ''
- Fission.ui.output 'Clone complete!'
-
- if @options.start
- Fission.ui.output "Starting '#{target_vm_name}'"
-
- start_task = target_vm.start
-
- if start_task.successful?
- Fission.ui.output "VM '#{target_vm_name}' started"
- else
- Fission.ui.output_and_exit "There was an error starting the VM. The error was:\n#{start_task.output}", start_task.code
- end
- end
- else
- Fission.ui.output_and_exit "There was an error cloning the VM. The error was:\n#{clone_task.output}", clone_task.code
- end
- end
-
- def option_parser
- optparse = OptionParser.new do |opts|
- opts.banner = "\nclone usage: fission clone source_vm target_vm [options]"
-
- opts.on '--start', 'Start the VM after cloning' do
- @options.start = true
- end
- end
-
- optparse
- end
-
- end
- end
-end
Oops, something went wrong.

0 comments on commit 6731611

Please sign in to comment.