Class: Berkshelf::Vagrant::Action::Upload

Inherits:
Object
  • Object
show all
Defined in:
lib/berkshelf/vagrant/action/upload.rb

Overview

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Upload

Returns a new instance of Upload.



8
9
10
11
# File 'lib/berkshelf/vagrant/action/upload.rb', line 8

def initialize(app, env)
  @app       = app
  @berksfile = Berksfile.from_file(env[:vm].config.berkshelf.berksfile_path)
end

Instance Attribute Details

#berksfileObject (readonly)

Returns the value of attribute berksfile.



6
7
8
# File 'lib/berkshelf/vagrant/action/upload.rb', line 6

def berksfile
  @berksfile
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/berkshelf/vagrant/action/upload.rb', line 13

def call(env)
  if Berkshelf::Vagrant.chef_client?(env[:vm].config)
    upload(env)
  end

  @app.call(env)
rescue BerkshelfError => e
  raise VagrantWrapperError.new(e)
end