lib/fog/octocloud/requests/compute/convert_cube.rb
# Imports a box (a tarball from vagrant or tenderloin)
#
# @param [Pathname] target destination directory of the box contents
# @param [Pathname, String] path box source file (can be URL or file)
# @param [Hash] opts extra options
# @option opts [Boolean] :show_progress display progress when importing a remote box
#
Imports a box (a tarball from vagrant or tenderloin)
Imports a box ( a tarball from vagrant or tenderloin )
def import_box(target, path, opts = {})
          if path.to_s =~ /^http/
            show_progress = opts.is_a?(Hash) ? opts[:show_progress] == true : false
            downloaded_file = download_file path.to_s, show_progress
            input = Archive::Tar::Minitar::Input.new(downloaded_file)
          else
            input = Archive::Tar::Minitar::Input.new(open(path.to_s))
          end
          input.each do |entry|
            input.extract_entry(target, entry)
          end
          if !Dir[target.join('*.vmx')].empty?
          elsif !Dir[target.join('Vagrantfile')].empty?
            convert_box_ovf(target)
          else
            raise "Invalid box - No vmx or Vagrantfile"
          end
        end
def import_box ( target , path , opts = { } ) if path . to_s =~ / ^http / show_progress = opts . is_a? ( Hash ) ? opts [ :show_progress ] == true : false downloaded_file = download_file path . to_s , show_progress input = Archive :: Tar :: Minitar :: Input . new ( downloaded_file ) else input = Archive :: Tar :: Minitar :: Input . new ( open ( path . to_s ) ) end input . each do | entry | input . extract_entry ( target , entry ) end if ! Dir [ target . join ( '*.vmx' ) ] . empty? elsif ! Dir [ target . join ( 'Vagrantfile' ) ] . empty? convert_box_ovf ( target ) else raise "Invalid box - No vmx or Vagrantfile" end end
Imports a box (a tarball from vagrant or tenderloin)
Imports a box ( a tarball from vagrant or tenderloin )
# need to coerce path to a string, so open-uri can figure what it is # DO WE CONVERT?? # We can do nothing - it's already good for vmware # Need to import from Vagrant. Convert the ovf to vmx using OVFtool, then write a base tenderfile
target
<not_specific>
path
<not_specific>
opts
:show_progress display progress when importing a remote box
: show_progress display progress when importing a remote box
<not_specific>
opts extra options
opts extra options