Sha256: 147aeccbc02d472cdac1e53f0641f4037bcd2ab92906e73fdaa548f8ad5ee012

Contents?: true

Size: 976 Bytes

Versions: 23

Compression:

Stored size: 976 Bytes

Contents

module Vagrant
  module Action
    module VM
      class Customize
        def initialize(app, env)
          @app = app
        end

        def call(env)
          customizations = env[:vm].config.vm.customizations
          if !customizations.empty?
            env[:ui].info I18n.t("vagrant.actions.vm.customize.running")

            # Execute each customization command.
            customizations.each do |command|
              processed_command = command.collect do |arg|
                arg = env[:vm].uuid if arg == :id
                arg.to_s
              end

              result = env[:vm].driver.execute_command(processed_command)
              if result.exit_code != 0
                raise Errors::VMCustomizationFailed, {
                  :command => processed_command.inspect,
                  :error   => result.stderr
                }
              end
            end
          end

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 6 rubygems

Version Path
bmhatfield-vagrant-1.0.10 lib/vagrant/action/vm/customize.rb
bmhatfield-vagrant-1.0.9 lib/vagrant/action/vm/customize.rb
bmhatfield-vagrant-1.0.8 lib/vagrant/action/vm/customize.rb
bmhatfield-vagrant-1.0.7 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.7 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.6 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.5 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.4 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.3 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.2 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.1 lib/vagrant/action/vm/customize.rb
vagrantup-1.0.0 lib/vagrant/action/vm/customize.rb
vagrant-fixed-ssh-1.0.7 lib/vagrant/action/vm/customize.rb
vagrant-1.0.7 lib/vagrant/action/vm/customize.rb
vagrant-1.0.6 lib/vagrant/action/vm/customize.rb
boxcar-0.10005.1 lib/vagrant/action/vm/customize.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/vagrant-1.0.5/lib/vagrant/action/vm/customize.rb
vagrant-1.0.5 lib/vagrant/action/vm/customize.rb
vagrant-1.0.4 lib/vagrant/action/vm/customize.rb
vagrant-1.0.3 lib/vagrant/action/vm/customize.rb