Sha256: 422765ab045c8e6faab543c7379e37a64bb83f8f63f1accb8e83fb18f2e842b4

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

require 'set'
require 'tempfile'

require "vagrant"
require 'vagrant/util/template_renderer'

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

module VagrantPlugins
  module GuestArch
    class Guest < VagrantPlugins::GuestLinux::Guest
      # Make the TemplateRenderer top-level
      include Vagrant::Util

      def change_host_name(name)
        # Only do this if the hostname is not already set
        if !vm.communicate.test("sudo hostname | grep '#{name}'")
          vm.communicate.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/rc.conf")
          vm.communicate.sudo("hostname #{name}")
          vm.communicate.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
        end
      end

      def configure_networks(networks)
        networks.each do |network|
          entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
                                          :options => network)

          temp = Tempfile.new("vagrant")
          temp.binmode
          temp.write(entry)
          temp.close

          vm.communicate.upload(temp.path, "/tmp/vagrant_network")
          vm.communicate.sudo("mv /tmp/vagrant_network /etc/network.d/interfaces/eth#{network[:interface]}")
          vm.communicate.sudo("netcfg interfaces/eth#{network[:interface]}")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

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