Sha256: e34b1a97c9855c950ae61735da1d50c57adfd465315f7816dd200849f36f51b6

Contents?: true

Size: 1.58 KB

Versions: 7

Compression:

Stored size: 1.58 KB

Contents

require "vagrant"

require Vagrant.source_root.join("plugins/guests/debian/guest")

module VagrantPlugins
  module GuestUbuntu
    class Guest < VagrantPlugins::GuestDebian::Guest
      def mount_shared_folder(name, guestpath, options)
        # Mount it like normal
        super

        # Emit an upstart event if upstart is available
        vm.communicate.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
      end

      def mount_nfs(ip, folders)
        # Mount it like normal
        super

        # Emit an upstart events if upstart is available
        folders.each do |name, opts|
          real_guestpath = expanded_guest_path(opts[:guestpath])
          vm.communicate.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{real_guestpath}")
        end
      end

      def change_host_name(name)
        vm.communicate.tap do |comm|
          if !comm.test("sudo hostname | grep '^#{name}$'")
            comm.sudo("sed -i 's/.*$/#{name}/' /etc/hostname")
            comm.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
            if comm.test("[ `lsb_release -c -s` = hardy ]")
                # hostname.sh returns 1, so I grep for the right name in /etc/hostname just to have a 0 exitcode
                comm.sudo("/etc/init.d/hostname.sh start; grep '#{name}' /etc/hostname")
            else
                comm.sudo("service hostname start")
            end
            comm.sudo("hostname --fqdn > /etc/mailname")
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
vagrantup-1.1.3 plugins/guests/ubuntu/guest.rb
vagrantup-1.1.2 plugins/guests/ubuntu/guest.rb
vagrantup-1.1.1 plugins/guests/ubuntu/guest.rb
vagrantup-1.1.0 plugins/guests/ubuntu/guest.rb
vagrantup-1.1.4 plugins/guests/ubuntu/guest.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/plugins/guests/ubuntu/guest.rb
vagrant-lxc-0.0.1 vendor/vagrant/plugins/guests/ubuntu/guest.rb