Sha256: 9ac09a177a76431184751f2f60b4c533416464755cacd50ecde6828964a0205b

Contents?: true

Size: 783 Bytes

Versions: 65

Compression:

Stored size: 783 Bytes

Contents

require "log4r"

module Vagrant
  module Action
    module Builtin
      # This middleware sets the hostname of the guest according to the
      # "vm.hostname" configuration parameter if it is set. This middleware
      # should be placed such that the after the @app.call, a booted machine
      # is available (this generally means BEFORE the boot middleware).
      class SetHostname
        def initialize(app, env)
          @app = app
        end

        def call(env)
          @app.call(env)

          hostname = env[:machine].config.vm.hostname
          if !hostname.nil?
            env[:ui].info I18n.t("vagrant.actions.vm.hostname.setting")
            env[:machine].guest.capability(:change_host_name, hostname)
          end
        end
      end
    end
  end
end

Version data entries

65 entries across 58 versions & 10 rubygems

Version Path
vagrant-unbundled-2.2.9.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.8.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.7.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.6.2 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.6.1 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.6.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.5.0 lib/vagrant/action/builtin/set_hostname.rb
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.4.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.3.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.2.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.2.0.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.1.4.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-unbundled-2.1.2.0 lib/vagrant/action/builtin/set_hostname.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/lib/vagrant/action/builtin/set_hostname.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/lib/vagrant/action/builtin/set_hostname.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/lib/vagrant/action/builtin/set_hostname.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/lib/vagrant/action/builtin/set_hostname.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/lib/vagrant/action/builtin/set_hostname.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/lib/vagrant/action/builtin/set_hostname.rb