Refactor #25966

Updated by Evgeni Golov over 2 years ago

Today, there is no ordering between the setup of Qpid (and its queues) and the setup of Candlepin. However, Candlepin requires Qpid to be up and the queues to be created to properly work.

In the past (until Candlepin 2.5.9), if we would make a request to Candlepin (like <code>GET /candlepin/admin/init</code>) while the Qpid connection wasn't set up yet, Candlepin would let that request wait and process it when the Qpid connection succeeded.
Starting with Candlepin 2.5.10, these requests will fail as Candlepin will be in <code>SUSPEND</code> mode and answer with a 503.

To make the installer more resilient, we should only start Candlepin *after* we have started Qpid and created all the queues.

Currently, the Katello 3.10 installer fails with Candlepin 2.5.11 with the following:
[ERROR 2019-01-31T09:50:47 verbose] '/usr/bin/wget --no-proxy --timeout=30 --tries=40 --wait=20 --retry-connrefused -qO- http://localhost:8080/candlepin/admin/init > /var/log/candlepin/cpinit.log 2>&1 && touch /var/lib/candlepin/cpinit_done' returned 8 instead of one of [0]

And while why the call to <code>/admin/init</code> is not necessary (and removed in 3.11), it would fail when doing <code>foreman-rake db:seed</code> instead.