class Construqt::Flavour::Ubuntu::EtcNetworkInterfaces::Entry::Header

Constants

AUTO
MODE_DHCP
MODE_LOOPBACK
MODE_MANUAL
PROTO_INET4
PROTO_INET6

Public Class Methods

new(entry) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 258
def initialize(entry)
  @entry = entry
  @auto = true
  @mode = MODE_MANUAL
  @protocol = PROTO_INET4
  @interface_name = nil
end

Public Instance Methods

commit() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 274
            def commit
              return "" if @entry.skip_interfaces?
              ipv6_dhcp = "iface #{get_interface_name} inet6 dhcp" if @dhcpv6
              out = <<OUT
# #{@entry.iface.clazz}
#{@auto ? "auto #{get_interface_name}" : ""}
#{ipv6_dhcp||""}
iface #{get_interface_name} #{@protocol.to_s} #{@mode.to_s}
  up   /bin/bash /etc/network/#{get_interface_name}-up.iface
  down /bin/bash /etc/network/#{get_interface_name}-down.iface
OUT
            end
dhcpv4() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 238
def dhcpv4
  @mode = MODE_DHCP
  self
end
dhcpv6() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 243
def dhcpv6
  @dhcpv6 = true
  self
end
get_interface_name() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 270
def get_interface_name
  @interface_name || @entry.iface.name
end
interface_name(name) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 266
def interface_name(name)
  @interface_name = name
end
mode(mode) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 233
def mode(mode)
  @mode = mode
  self
end
noauto() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 253
def noauto
  @auto = false
  self
end
protocol(protocol) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb, line 248
def protocol(protocol)
  @protocol = protocol
  self
end