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
This commit is contained in:
parent
882e78c5ad
commit
e9caae0a23
|
@ -196,24 +196,13 @@ def register_configs():
|
||||||
for conf in confs:
|
for conf in confs:
|
||||||
configs.register(conf, CONFIG_FILES[conf]['hook_contexts'])
|
configs.register(conf, CONFIG_FILES[conf]['hook_contexts'])
|
||||||
|
|
||||||
if os.path.isdir(APACHE_CONF_DIR) and cmp_pkgrevno('apache2', '2.4') >= 0:
|
# From Trusty on use Apache 2.4
|
||||||
for conf in [APACHE_CONF, APACHE_SSL, APACHE_DEFAULT]:
|
configs.register(APACHE_24_DEFAULT,
|
||||||
if os.path.isfile(conf):
|
CONFIG_FILES[APACHE_24_DEFAULT]['hook_contexts'])
|
||||||
log('Removing old config %s' % (conf))
|
configs.register(APACHE_24_CONF,
|
||||||
os.remove(conf)
|
CONFIG_FILES[APACHE_24_CONF]['hook_contexts'])
|
||||||
configs.register(APACHE_24_DEFAULT,
|
configs.register(APACHE_24_SSL,
|
||||||
CONFIG_FILES[APACHE_24_DEFAULT]['hook_contexts'])
|
CONFIG_FILES[APACHE_24_SSL]['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'])
|
|
||||||
|
|
||||||
if os.path.exists(os.path.dirname(ROUTER_SETTING)):
|
if os.path.exists(os.path.dirname(ROUTER_SETTING)):
|
||||||
configs.register(ROUTER_SETTING,
|
configs.register(ROUTER_SETTING,
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
|
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
|
||||||
# by default.
|
# 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() {
|
check_and_install() {
|
||||||
pkg="${1}-${2}"
|
pkg="${1}-${2}"
|
||||||
|
|
|
@ -158,33 +158,12 @@ class TestHorizonUtils(CharmTestCase):
|
||||||
'cloud:precise-havana'
|
'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.isfile')
|
||||||
@patch('os.path.isdir')
|
@patch('os.path.isdir')
|
||||||
def test_register_configs_apache24(self, _isdir, _isfile, _remove):
|
def test_register_configs(self, _isdir, _isfile):
|
||||||
_isdir.return_value = True
|
_isdir.return_value = True
|
||||||
_isfile.return_value = True
|
_isfile.return_value = True
|
||||||
self.os_release.return_value = 'havana'
|
self.os_release.return_value = 'havana'
|
||||||
self.cmp_pkgrevno.return_value = 1
|
|
||||||
configs = horizon_utils.register_configs()
|
configs = horizon_utils.register_configs()
|
||||||
confs = [horizon_utils.LOCAL_SETTINGS,
|
confs = [horizon_utils.LOCAL_SETTINGS,
|
||||||
horizon_utils.HAPROXY_CONF,
|
horizon_utils.HAPROXY_CONF,
|
||||||
|
@ -197,13 +176,6 @@ class TestHorizonUtils(CharmTestCase):
|
||||||
calls.append(
|
calls.append(
|
||||||
call(conf, horizon_utils.CONFIG_FILES[conf]['hook_contexts']))
|
call(conf, horizon_utils.CONFIG_FILES[conf]['hook_contexts']))
|
||||||
configs.register.assert_has_calls(calls)
|
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')
|
@patch('os.path.isdir')
|
||||||
def test_register_configs_pre_install(self, _isdir):
|
def test_register_configs_pre_install(self, _isdir):
|
||||||
|
@ -213,9 +185,9 @@ class TestHorizonUtils(CharmTestCase):
|
||||||
confs = [horizon_utils.LOCAL_SETTINGS,
|
confs = [horizon_utils.LOCAL_SETTINGS,
|
||||||
horizon_utils.HAPROXY_CONF,
|
horizon_utils.HAPROXY_CONF,
|
||||||
horizon_utils.PORTS_CONF,
|
horizon_utils.PORTS_CONF,
|
||||||
horizon_utils.APACHE_DEFAULT,
|
horizon_utils.APACHE_24_DEFAULT,
|
||||||
horizon_utils.APACHE_CONF,
|
horizon_utils.APACHE_24_CONF,
|
||||||
horizon_utils.APACHE_SSL]
|
horizon_utils.APACHE_24_SSL]
|
||||||
calls = []
|
calls = []
|
||||||
for conf in confs:
|
for conf in confs:
|
||||||
calls.append(
|
calls.append(
|
||||||
|
|
Loading…
Reference in New Issue