Merge lp://qastaging/~gnuoy/charms/precise/openstack-dashboard/fix-for-apache24 into lp://qastaging/~openstack-charmers-archive/charms/precise/openstack-dashboard/trunk

Proposed by Liam Young
Status: Merged
Merged at revision: 28
Proposed branch: lp://qastaging/~gnuoy/charms/precise/openstack-dashboard/fix-for-apache24
Merge into: lp://qastaging/~openstack-charmers-archive/charms/precise/openstack-dashboard/trunk
Diff against target: 244 lines (+89/-39)
3 files modified
hooks/charmhelpers/core/host.py (+14/-0)
hooks/horizon_utils.py (+33/-9)
unit_tests/test_horizon_utils.py (+42/-30)
To merge this branch: bzr merge lp://qastaging/~gnuoy/charms/precise/openstack-dashboard/fix-for-apache24
Reviewer Review Type Date Requested Status
Liam Young (community) Needs Resubmitting
James Page Needs Fixing
Review via email: mp+219510@code.qastaging.launchpad.net

Description of the change

The name of the default vhosts was sensibly changed by the debian package maintainers for apache 2.4 (see line ~56 http://sources.debian.net/src/apache2/2.4.9-1/debian/apache2.NEWS). This caused the charm to update the wrong vhost config.

This branch registers two new configs files corresponding to the new default http{,s} vhosts and uses them in preference to the old ones if the installed version of apache2 >= 2.4

There is a corresponding mp to add the cmp_pkgrevno function to charmhelpers ( https://code.launchpad.net/~gnuoy/charm-helpers/add-packacerevno-method/+merge/219509 )

While writing the unit tests it became apparent that some of the existing tests where not checking that the list of calls to register config exactly matched the test list but rather that the call had happened at some point:

"assert_any_call(*args, **kwargs): ...The assert passes if the mock has ever been called, unlike assert_called_with() and assert_called_once_with() that only pass if the call is the most recent one."

I've switched these tests to use assert_has_calls to ensure there is no mix of 2.2 and 2.4 config.

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

I've tested with precise/havana and icehouse/trusty

29. By Liam Young

Correct ordering of configs so DEFAULT comes before CONF and SSL

Revision history for this message
James Page (james-page) wrote :

Generally looks good - however:

58 +APACHE_24_SSL = "%s/sites-available/000-default.conf" % (APACHE_CONF_DIR)
59 +APACHE_24_DEFAULT = "%s/sites-available/default-ssl.conf" % (APACHE_CONF_DIR)

These constants are named incorrectly - _SSL refers to the non-ssl site config and vica-versa.

review: Needs Fixing
30. By Liam Young

Fixed apache config file misnaming

31. By Liam Young

Added template symlinks with newnames pointing to old

Revision history for this message
James Page (james-page) wrote :

Almost:

======================================================================
FAIL: test_restart_map (unit_tests.test_horizon_utils.TestHorizonUtils)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jamespage/src/charms/landing/openstack-dashboard/unit_tests/test_horizon_utils.py", line 49, in test_restart_map
    self.assertEquals(horizon_utils.restart_map(), ex_map)
AssertionError: OrderedDict([('/etc/openstack-dashboard/local_settings.py', ['apache2']), ('/etc/apache2/conf.d/openstack-dashboard.conf', ['apache2']), ('/etc/apache2/conf-available/openstack-dashboard.conf', ['apache2']), ('/etc/apache2/sites-available/default-ssl', ['apache2']), ('/etc/apache2/sites-available/default-ssl.conf', ['apache2']), ('/etc/apache2/sites-available/default', ['apache2']), ('/etc/apache2/sites-available/000-default.conf', ['apache2']), ('/etc/apache2/ports.conf', ['apache2']), ('/etc/haproxy/haproxy.cfg', ['haproxy'])]) != OrderedDict([('/etc/openstack-dashboard/local_settings.py', ['apache2']), ('/etc/apache2/conf.d/openstack-dashboard.conf', ['apache2']), ('/etc/apache2/conf-available/openstack-dashboard.conf', ['apache2']), ('/etc/apache2/sites-available/default-ssl', ['apache2']), ('/etc/apache2/sites-available/000-default.conf', ['apache2']), ('/etc/apache2/sites-available/default', ['apache2']), ('/etc/apache2/sites-available/default-ssl.conf', ['apache2']), ('/etc/apache2/ports.conf', ['apache2']), ('/etc/haproxy/haproxy.cfg', ['haproxy'])])

review: Needs Fixing
32. By Liam Young

Fix ordering in restart map in unit test after last commit

Revision history for this message
Liam Young (gnuoy) wrote :

Argh, apologies. Fixed now

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches