Class: Y2Network::AutoinstProfile::NetworkingSection

Inherits:
Object
  • Object
show all
Defined in:
src/lib/y2network/autoinst_profile/networking_section.rb

Overview

This class represents an AutoYaST <networking> section

<!-- the routing configuration -->

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dnsDNSSection


41
42
43
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 41

def dns
  @dns
end

#interfacesInterfacesSection


43
44
45
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 43

def interfaces
  @interfaces
end

#routingRoutingSection


39
40
41
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 39

def routing
  @routing
end

#s390_devicesS390DevicesSection


47
48
49
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 47

def s390_devices
  @s390_devices
end

#udev_rulesUdevRulesSection


45
46
47
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 45

def udev_rules
  @udev_rules
end

Class Method Details

.new_from_hashes(hash) ⇒ NetworkingSection

Creates an instance based on the profile representation used by the AutoYaST modules (hash with nested hashes and arrays).


54
55
56
57
58
59
60
61
62
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 54

def self.new_from_hashes(hash)
  result = new
  result.routing = RoutingSection.new_from_hashes(hash["routing"]) if hash["routing"]
  result.dns = DNSSection.new_from_hashes(hash["dns"]) if hash["dns"]
  result.interfaces = InterfacesSection.new_from_hashes(hash["interfaces"]) if hash["interfaces"]
  result.udev_rules = UdevRulesSection.new_from_hashes(hash["net-udev"]) if hash["net-udev"]
  result.s390_devices = S390DevicesSection.new_from_hashes(hash["s390-devices"]) if hash["s390-devices"]
  result
end

.new_from_network(config) ⇒ NetworkingSection

Creates an instance based on the network configuration representation


68
69
70
71
72
73
74
75
76
77
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 68

def self.new_from_network(config)
  result = new
  return result unless config
  result.routing = RoutingSection.new_from_network(config.routing) if config.routing
  result.dns = DNSSection.new_from_network(config.dns) if config.dns
  result.interfaces = InterfacesSection.new_from_network(config.connections)
  result.udev_rules = UdevRulesSection.new_from_network(config.interfaces)
  result.s390_devices = S390DevicesSection.new_from_network(config.connections)
  result
end

Instance Method Details

#to_hashesHash

Export the section to a hash so it might be used when cloning the system


82
83
84
85
86
87
88
89
90
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 82

def to_hashes
  {
    "routing"      => routing.to_hashes,
    "dns"          => dns.to_hashes,
    "interfaces"   => interfaces.to_hashes,
    "net-udev"     => udev_rules.to_hashes,
    "s390-devices" => s390_devices.to_hashes
  }
end