Sha256: 865d6573f7dc63d9457954e46865a5d164f84ae83fb22bd30503a9e3541be0e0

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

require "ipaddr"

module VagrantPlugins
  module GuestTinyCore
    module Cap
      class ConfigureNetworks
        def self.configure_networks(machine, networks)
          machine.communicate.tap do |comm|
            networks.each do |n|
              ifc = "/sbin/ifconfig eth#{n[:interface]}"
              broadcast = (IPAddr.new(n[:ip]) | (~ IPAddr.new(n[:netmask]))).to_s
              comm.sudo("#{ifc} down")
              comm.sudo("#{ifc} #{n[:ip]} netmask #{n[:netmask]} broadcast #{broadcast}")
              comm.sudo("#{ifc} up")
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/guests/tinycore/cap/configure_networks.rb