From: Sofer Athlan-Guyot Date: Tue, 8 Nov 2016 09:16:53 +0000 (+0100) Subject: Better way to ensure keepalived before haproxy. X-Git-Tag: opnfv-6.0.0~486^2~1 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=b11d048e55fc20a90bcf11eed0f4cea5e1b45f7c;p=apex-puppet-tripleo.git Better way to ensure keepalived before haproxy. The lastest patchset of https://review.openstack.org/393361 was actually not working. The `if defined` idiom depends on *evaluation* order. At the time it's red in the haproxy.pp class, the line that loads the class 'haproxy' has still not yet been reached and thus the `defined` result is false. The constraint is not added. For this reason, the use of `defined` in module is not advised by puppetlabs[1]. [1] https://docs.puppet.com/puppet/latest/reference/function.html#defined Change-Id: Ibd352cb313f8863d62db8987419378bed5b87256 Relates-To: #1638029 --- diff --git a/manifests/haproxy.pp b/manifests/haproxy.pp index 7c5ff39..2ca7a06 100644 --- a/manifests/haproxy.pp +++ b/manifests/haproxy.pp @@ -599,6 +599,8 @@ class tripleo::haproxy ( # This code will be removed once we switch undercloud and overcloud to use both haproxy & keepalived roles. if $keepalived { include ::tripleo::keepalived + # Make sure keepalive starts before haproxy. + Class['::keepalived::service'] -> Class['::haproxy'] } # TODO(bnemec): When we have support for SSL on private and admin endpoints, diff --git a/manifests/keepalived.pp b/manifests/keepalived.pp index 515dcd0..0e9262d 100644 --- a/manifests/keepalived.pp +++ b/manifests/keepalived.pp @@ -158,8 +158,4 @@ class tripleo::keepalived ( priority => 101, } } - # Make sure keepalive starts before haproxy. - if (defined(Class['::haproxy'])) { - Class['::keepalived::service'] -> Class['::haproxy'] - } }