Class: Construqt::Flavour::Ubuntu::Services::Radvd

Inherits:
Object
  • Object
show all
Defined in:
lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ Radvd

Returns a new instance of Radvd.



58
59
60
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 58

def initialize(service)
  @service = service
end

Instance Method Details

#down(ifname) ⇒ Object



66
67
68
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 66

def down(ifname)
  "kill `cat /run/radvd.#{ifname}.pid`"
end

#interfaces(host, ifname, iface, writer) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 75

def interfaces(host, ifname, iface, writer)
  #      binding.pry
  return unless iface.address && iface.address.first_ipv6
  writer.lines.up(up(ifname))
  writer.lines.down(down(ifname))
  host.result.add(self, "interface \#{ifname}\n{\n        AdvManagedFlag on;\n        AdvSendAdvert on;\n        AdvOtherConfigFlag on;\n        #AdvAutonomous on;\n        #AdvLinkMTU 1480;\n        #MinRtrAdvInterval 3;\n        #MaxRtrAdvInterval 60;\n        prefix \#{iface.address.first_ipv6.network.to_string}\n        {\n      AdvOnLink on;\n      AdvAutonomous off;\n      AdvRouterAddr on;\n        };\n\n};\n", Construqt::Resources::Rights::ROOT_0644, "etc", "network", "radvd.#{ifname}.conf")
end

#up(ifname) ⇒ Object



62
63
64
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 62

def up(ifname)
  "/usr/sbin/radvd -C /etc/network/radvd.#{ifname}.conf -p /run/radvd.#{ifname}.pid"
end

#vrrp(host, ifname, iface) ⇒ Object



70
71
72
73
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 70

def vrrp(host, ifname, iface)
  #binding.pry
  host.result.etc_network_vrrp(iface.name).add_master(up(ifname)).add_backup(down(ifname))
end