Class: Construqt::Flavour::Ubuntu::EtcNetworkVrrp
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ubuntu::EtcNetworkVrrp
- Defined in:
- lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb
Defined Under Namespace
Classes: Vrrp
Instance Method Summary collapse
- #commit(result) ⇒ Object
- #get(ifname) ⇒ Object
-
#initialize ⇒ EtcNetworkVrrp
constructor
A new instance of EtcNetworkVrrp.
Constructor Details
#initialize ⇒ EtcNetworkVrrp
Returns a new instance of EtcNetworkVrrp.
399 400 401 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 399 def initialize @interfaces = {} end |
Instance Method Details
#commit(result) ⇒ Object
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 441 def commit(result) @interfaces.keys.sort.each do |ifname| vrrp = @interfaces[ifname] result.add(self, "#!/bin/bash\n\#{vrrp.render_backups}\nexit 0\n", Construqt::Resources::Rights.root_0755(Construqt::Resources::Component::VRRP), "etc", "network", "vrrp.#{ifname}.stop.sh") result.add(self, "#!/bin/bash\n\nTYPE=$1\nNAME=$2\nSTATE=$3\n\ncase $STATE in\n\"MASTER\")\n\#{vrrp.render_masters}\n exit 0\n ;;\n\"BACKUP\")\n\#{vrrp.render_backups}\n exit 0\n ;;\n*) echo \"unknown state\"\n exit 1\n ;;\nesac\n", Construqt::Resources::Rights.root_0755(Construqt::Resources::Component::VRRP), "etc", "network", "vrrp.#{ifname}.sh") end end |
#get(ifname) ⇒ Object
437 438 439 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 437 def get(ifname) @interfaces[ifname] ||= Vrrp.new end |