diff --git a/hooks/horizon_utils.py b/hooks/horizon_utils.py index 5043a39a4426079115b40942dad23d58d3cfab97..86c638dc66382b004c6f43b37dd10b4f6d13ed3e 100644 --- a/hooks/horizon_utils.py +++ b/hooks/horizon_utils.py @@ -196,24 +196,13 @@ def register_configs(): for conf in confs: configs.register(conf, CONFIG_FILES[conf]['hook_contexts']) - if os.path.isdir(APACHE_CONF_DIR) and cmp_pkgrevno('apache2', '2.4') >= 0: - for conf in [APACHE_CONF, APACHE_SSL, APACHE_DEFAULT]: - if os.path.isfile(conf): - log('Removing old config %s' % (conf)) - os.remove(conf) - configs.register(APACHE_24_DEFAULT, - CONFIG_FILES[APACHE_24_DEFAULT]['hook_contexts']) - configs.register(APACHE_24_CONF, - CONFIG_FILES[APACHE_24_CONF]['hook_contexts']) - configs.register(APACHE_24_SSL, - CONFIG_FILES[APACHE_24_SSL]['hook_contexts']) - else: - configs.register(APACHE_DEFAULT, - CONFIG_FILES[APACHE_DEFAULT]['hook_contexts']) - configs.register(APACHE_CONF, - CONFIG_FILES[APACHE_CONF]['hook_contexts']) - configs.register(APACHE_SSL, - CONFIG_FILES[APACHE_SSL]['hook_contexts']) + # From Trusty on use Apache 2.4 + configs.register(APACHE_24_DEFAULT, + CONFIG_FILES[APACHE_24_DEFAULT]['hook_contexts']) + configs.register(APACHE_24_CONF, + CONFIG_FILES[APACHE_24_CONF]['hook_contexts']) + configs.register(APACHE_24_SSL, + CONFIG_FILES[APACHE_24_SSL]['hook_contexts']) if os.path.exists(os.path.dirname(ROUTER_SETTING)): configs.register(ROUTER_SETTING, diff --git a/hooks/install b/hooks/install index 32f374abc2af395ff0381f80867b9eac012cb459..262631be62923e594847c8751740efcf56bf1bd7 100755 --- a/hooks/install +++ b/hooks/install @@ -2,7 +2,9 @@ # Wrapper to deal with newer Ubuntu versions that don't have py2 installed # by default. -declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml' 'dnspython', 'apache2') +set -e + +declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml' 'dnspython') check_and_install() { pkg="${1}-${2}" diff --git a/unit_tests/test_horizon_utils.py b/unit_tests/test_horizon_utils.py index 05caf16c3cb313c63043dfec6c6afc48c86854af..f1b4e4544196bbcecc54c713a87be4fd249226da 100644 --- a/unit_tests/test_horizon_utils.py +++ b/unit_tests/test_horizon_utils.py @@ -158,33 +158,12 @@ class TestHorizonUtils(CharmTestCase): 'cloud:precise-havana' ) - @patch('os.path.isdir') - def test_register_configs(self, _isdir): - _isdir.return_value = True - self.os_release.return_value = 'havana' - self.cmp_pkgrevno.return_value = -1 - configs = horizon_utils.register_configs() - confs = [horizon_utils.LOCAL_SETTINGS, - horizon_utils.HAPROXY_CONF, - horizon_utils.PORTS_CONF, - horizon_utils.APACHE_DEFAULT, - horizon_utils.APACHE_CONF, - horizon_utils.APACHE_SSL] - calls = [] - for conf in confs: - calls.append( - call(conf, - horizon_utils.CONFIG_FILES[conf]['hook_contexts'])) - configs.register.assert_has_calls(calls) - - @patch('os.remove') @patch('os.path.isfile') @patch('os.path.isdir') - def test_register_configs_apache24(self, _isdir, _isfile, _remove): + def test_register_configs(self, _isdir, _isfile): _isdir.return_value = True _isfile.return_value = True self.os_release.return_value = 'havana' - self.cmp_pkgrevno.return_value = 1 configs = horizon_utils.register_configs() confs = [horizon_utils.LOCAL_SETTINGS, horizon_utils.HAPROXY_CONF, @@ -197,13 +176,6 @@ class TestHorizonUtils(CharmTestCase): calls.append( call(conf, horizon_utils.CONFIG_FILES[conf]['hook_contexts'])) configs.register.assert_has_calls(calls) - oldconfs = [horizon_utils.APACHE_CONF, - horizon_utils.APACHE_SSL, - horizon_utils.APACHE_DEFAULT] - rmcalls = [] - for conf in oldconfs: - rmcalls.append(call(conf)) - _remove.assert_has_calls(rmcalls) @patch('os.path.isdir') def test_register_configs_pre_install(self, _isdir): @@ -213,9 +185,9 @@ class TestHorizonUtils(CharmTestCase): confs = [horizon_utils.LOCAL_SETTINGS, horizon_utils.HAPROXY_CONF, horizon_utils.PORTS_CONF, - horizon_utils.APACHE_DEFAULT, - horizon_utils.APACHE_CONF, - horizon_utils.APACHE_SSL] + horizon_utils.APACHE_24_DEFAULT, + horizon_utils.APACHE_24_CONF, + horizon_utils.APACHE_24_SSL] calls = [] for conf in confs: calls.append(