Sha256: e1ec2c156ddad49c035834e76f4bee79996f95903b5c20fc8ab2a54876ebcbe6

Contents?: true

Size: 971 Bytes

Versions: 17

Compression:

Stored size: 971 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
              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

17 entries across 17 versions & 2 rubygems

Version Path
vagrantup-0.9.99.2 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.99.1 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.7 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.6 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.5 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.4 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.3 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.2 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.1 lib/vagrant/action/vm/customize.rb
vagrantup-0.9.0 lib/vagrant/action/vm/customize.rb
vagrant-0.9.7 lib/vagrant/action/vm/customize.rb
vagrant-0.9.5 lib/vagrant/action/vm/customize.rb
vagrant-0.9.4 lib/vagrant/action/vm/customize.rb
vagrant-0.9.3 lib/vagrant/action/vm/customize.rb
vagrant-0.9.2 lib/vagrant/action/vm/customize.rb
vagrant-0.9.1 lib/vagrant/action/vm/customize.rb
vagrant-0.9.0 lib/vagrant/action/vm/customize.rb