Module: BoxExtension

Included in:
Vagrant::Box
Defined in:
lib/vagrant-box-gcs/extensions/box.rb

Instance Method Summary collapse

Instance Method Details

#load_metadata(**download_options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/vagrant-box-gcs/extensions/box.rb', line 5

def (**download_options)
  uri = URI.parse(@metadata_url)
  if uri.scheme == 'gs'
    tf = Tempfile.new('vagrant-load-metadata')
    tf.close
    VagrantPlugins::BoxGCS::Storage.download(uri, tf.path)
    Vagrant::BoxMetadata.new(File.open(tf.path, 'r'))
  else
    super(**download_options)
  end
end