Pre-install apache2 for openstack dashboard

Bug #1799500 reported by Narinder Gupta
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard Charm
Fix Released
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: field-medium
tags: added: field-medium
Revision history for this message
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
Revision history for this message
Chris MacNaughton (chris.macnaughton) wrote :

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?

Revision history for this message
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.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-openstack-dashboard (master)

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)
Changed in charm-openstack-dashboard:
status: Fix Committed → Fix Released
David Ames (thedac)
Changed in charm-openstack-dashboard:
status: Fix Released → Triaged
milestone: 18.11 → 19.04
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-openstack-dashboard (master)

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

Changed in charm-openstack-dashboard:
status: Triaged → In Progress
Revision history for this message
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
Revision history for this message
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.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-openstack-dashboard (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-openstack-dashboard (stable/18.11)

Fix proposed to branch: stable/18.11
Review: https://review.openstack.org/621235

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-openstack-dashboard (stable/18.11)

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)
Changed in charm-openstack-dashboard:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.