Pre-install apache2 for openstack dashboard

Bug #1799500 reported by Narinder Gupta on 2018-10-23
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack openstack-dashboard charm
High
David Ames

Bug Description

Apache2 is a dependency of openstack-dashboard which gets installed in
the install() function. However, prior to that we register configs
which does a check of the apache2 package version leading to a chicken
and egg race.

Pre-install apache2 in the bash install script to avoid this race.

tags: added: field-medium
David Ames (thedac) wrote :
Changed in charm-openstack-dashboard:
status: New → In Progress
importance: Undecided → High
assignee: nobody → David Ames (thedac)
milestone: none → 18.11

Given that the install.real hook doesn't actually do anything with configs, what is the unexpected behavior in this bug? Looking through the code suggests that the install.real hook will end up installing the packages and nothing else, after which, the config-changed hook will fire, using the correctly installed list of packages?

David Ames (thedac) wrote :

In global scope register_configs is called:

https://github.com/openstack/charm-openstack-dashboard/blob/master/hooks/horizon_hooks.py#L107

The directory check *should* protect this.
https://github.com/openstack/charm-openstack-dashboard/blob/master/hooks/horizon_utils.py#L199

But Narinder is seeing this problem consistently. The fix was trivial to add apache2 to the bash install.

Reviewed: https://review.openstack.org/611914
Committed: https://git.openstack.org/cgit/openstack/charm-openstack-dashboard/commit/?id=0d1dec7e0b9eadedf86ae0ff93dee48b634a21ea
Submitter: Zuul
Branch: master

commit 0d1dec7e0b9eadedf86ae0ff93dee48b634a21ea
Author: David Ames <email address hidden>
Date: Fri Oct 19 09:06:01 2018 -0700

    Pre-install apache2

    Apache2 is a dependency of openstack-dashboard which gets installed in
    the install() function. However, prior to that we register configs
    which does a check of the apache2 package version leading to a chicken
    and egg race.

    Pre-install apache2 in the bash install script to avoid this race.

    Closes-Bug: #1799500

    Change-Id: I1f73a6b0284ca4e0a4018bff73fd4f8a778c4db5

Changed in charm-openstack-dashboard:
status: In Progress → Fix Committed
David Ames (thedac) on 2018-11-20
Changed in charm-openstack-dashboard:
status: Fix Committed → Fix Released
David Ames (thedac) on 2018-11-28
Changed in charm-openstack-dashboard:
status: Fix Released → Triaged
milestone: 18.11 → 19.04

Fix proposed to branch: master
Review: https://review.openstack.org/620688

Changed in charm-openstack-dashboard:
status: Triaged → In Progress
David Ames (thedac) wrote :

The original failure:

2018-11-28 21:31:43 INFO juju-log Registered config file: /etc/apache2/ports.conf
2018-11-28 21:31:44 DEBUG install Traceback (most recent call last):
2018-11-28 21:31:44 DEBUG install File "/var/lib/juju/agents/unit-openstack-dashboard-0/charm/hooks/install.real", line 109, in <module>
2018-11-28 21:31:44 DEBUG install CONFIGS = register_configs()
2018-11-28 21:31:44 DEBUG install File "/var/lib/juju/agents/unit-openstack-dashboard-0/charm/hooks/horizon_utils.py", line 199, in register_configs
2018-11-28 21:31:44 DEBUG install if os.path.isdir(APACHE_CONF_DIR) and cmp_pkgrevno('apache2', '2.4') >= 0:
2018-11-28 21:31:44 DEBUG install File "/var/lib/juju/agents/unit-openstack-dashboard-0/charm/charmhelpers/core/host_factory/ubuntu.py", line 91, in cmp_pkgrevno

Changed in charm-openstack-dashboard:
status: In Progress → Confirmed
Changed in charm-openstack-dashboard:
status: Confirmed → In Progress
David Ames (thedac) wrote :

Root cause for future travellers:

The local cloud-init configuration installs ruby by default which installs javascript-common which creates /etc/apache2/conf-available/javascript-common.conf. The charm was tripping over the fact that /etc/apache2 existed before the apache2 package was installed.

The PR https://review.openstack.org/620688 removes the apache 2.2 checks entirely. This should be backported to stable as the previous attempted fixes made things worse.

Reviewed: https://review.openstack.org/620688
Committed: https://git.openstack.org/cgit/openstack/charm-openstack-dashboard/commit/?id=e9caae0a23461f3b503035e94865ccc3c8509a32
Submitter: Zuul
Branch: master

commit e9caae0a23461f3b503035e94865ccc3c8509a32
Author: David Ames <email address hidden>
Date: Wed Nov 28 12:12:30 2018 -0800

    Remove apache 2.2 workarounds

    From trusty onwards apache 2.4 is installed. The charm no longer needs
    to check for apache 2.2 configurations.

    This also solves Bug #1799500 where a package like javascript-common
    pre-creates the /etc/apache directory leading to a failed
    register_configs.

    Note: The previous fix for Bug #1799500 was incorrect.
    Reverting and adding a set -e to avoid future breakage.

    This will need to be backported to stable.

    Change-Id: Ic6025bd10568a748e39faaf3a97b4b6a2c35a4d2
    Closes-Bug: #1799500

Changed in charm-openstack-dashboard:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/621235
Committed: https://git.openstack.org/cgit/openstack/charm-openstack-dashboard/commit/?id=2f069990d35e473828ce9f6c565d7a7fd5410c67
Submitter: Zuul
Branch: stable/18.11

commit 2f069990d35e473828ce9f6c565d7a7fd5410c67
Author: David Ames <email address hidden>
Date: Wed Nov 28 12:12:30 2018 -0800

    Remove apache 2.2 workarounds

    From trusty onwards apache 2.4 is installed. The charm no longer needs
    to check for apache 2.2 configurations.

    This also solves Bug #1799500 where a package like javascript-common
    pre-creates the /etc/apache directory leading to a failed
    register_configs.

    Note: The previous fix for Bug #1799500 was incorrect.
    Reverting and adding a set -e to avoid future breakage.

    This will need to be backported to stable.

    Change-Id: Ic6025bd10568a748e39faaf3a97b4b6a2c35a4d2
    Closes-Bug: #1799500
    (cherry picked from commit e9caae0a23461f3b503035e94865ccc3c8509a32)

Ryan Beisner (1chb1n) on 2018-12-06
Changed in charm-openstack-dashboard:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers