Class: Construqt::Flavour::Ubuntu::Services::ConntrackD
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ubuntu::Services::ConntrackD
- Defined in:
- lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb
Instance Method Summary collapse
- #down(ifname) ⇒ Object
-
#initialize(service) ⇒ ConntrackD
constructor
A new instance of ConntrackD.
- #interfaces(host, ifname, iface, writer) ⇒ Object
- #up(ifname) ⇒ Object
- #vrrp(host, ifname, iface) ⇒ Object
Constructor Details
#initialize(service) ⇒ ConntrackD
Returns a new instance of ConntrackD.
134 135 136 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 134 def initialize(service) @service = service end |
Instance Method Details
#down(ifname) ⇒ Object
142 143 144 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 142 def down(ifname) "/usr/share/doc/conntrackd/examples/sync/primary-backup.sh backup" end |
#interfaces(host, ifname, iface, writer) ⇒ Object
151 152 153 154 155 156 157 158 159 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 151 def interfaces(host, ifname, iface, writer) throw "only vrrp ifaces could be used to conntrack: #{ifname}:#{iface.name}" unless iface.vrrp throw "conntrack needs a ipv4 address #{ifname}:#{iface.name}" unless iface.address.first_ipv4 throw "conntrack currently a ipv4 address #{iface.host.name}:#{ifname}:#{iface.name}" unless iface.address.first_ipv4 other_if = iface.vrrp.delegate.interfaces.find{|i| i.host != host } throw "conntrack currently a ipv4 address #{other_if.host.name}:#{other_if.name}" unless other_if.address.first_ipv4 #binding.pry host.result.etc_conntrackd_conntrackd.add(ifname, iface.address.first_ipv4, other_if.address.first_ipv4) end |
#up(ifname) ⇒ Object
138 139 140 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 138 def up(ifname) "/usr/share/doc/conntrackd/examples/sync/primary-backup.sh primary" end |
#vrrp(host, ifname, iface) ⇒ Object
146 147 148 149 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb', line 146 def vrrp(host, ifname, iface) #binding.pry host.result.etc_network_vrrp(iface.name).add_master(up(ifname)).add_backup(down(ifname)) end |