From 4c488944fa6508755d47c329050fe8bb885c4304 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley <edward.hope-morley@canonical.com> Date: Mon, 15 Sep 2014 11:50:24 +0100 Subject: [PATCH] [hopem,r=] Add config option to allow apache2 and libapache-mod-fastcgi to be installed from ceph.com. This enables support for patched packages contanining http 100-continue support. --- config.yaml | 10 ++++++++++ hooks/hooks.py | 32 ++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/config.yaml b/config.yaml index 0cb65e7e..ca1a8f95 100644 --- a/config.yaml +++ b/config.yaml @@ -46,3 +46,13 @@ options: default: False description: | If set to True, supporting services will log to syslog. + use-ceph-optimised-packages: + type: boolean + default: false + description: | + By default apache2 and libapache2-mod-fastcgi will be installed from the + Ubuntu archives. This option allows for an alternate ceph.com install + source which contains patched versions with added support for HTTP + 100-continue. See the following page for more info: + + http://ceph.com/docs/dumpling/radosgw/manual-install/#continue-support diff --git a/hooks/hooks.py b/hooks/hooks.py index 41b3641f..716f2724 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -30,6 +30,7 @@ from charmhelpers.fetch import ( apt_install, add_source, ) +from charmhelpers.core.host import lsb_release from utils import ( render_template, get_host_ip, @@ -52,16 +53,38 @@ def install_www_scripts(): NSS_DIR = '/var/lib/ceph/nss' -@hooks.hook('install') -def install(): - execd_preinstall() - enable_pocket('multiverse') +def install_ceph_optimised_packages(): + """Inktank provides patched/optimised packages for HTTP 100-continue support + that does has not yet been ported to upstream. These can optionally be + installed from ceph.com archives. + """ + prolog = "http://gitbuilder.ceph.com/" + epilog = "-x86_64-basic/ref/master" + rel = lsb_release()['DISTRIB_CODENAME'] + fastcgi_source = "%slibapache-mod-fastcgi-deb-%s%s" % (prolog, rel, epilog) + apache_source = "%sapache2-deb-%s%s" % (prolog, rel, epilog) + + for source in [fastcgi_source, apache_source]: + add_source(source, key='6EAEAE2203C3951A') + + +def install_packages(): add_source(config('source'), config('key')) + if config('use-ceph-optimised-packages'): + install_ceph_optimised_packages() + apt_update(fatal=True) apt_install(['radosgw', 'libapache2-mod-fastcgi', 'apache2', 'ntp'], fatal=True) + + +@hooks.hook('install') +def install(): + execd_preinstall() + enable_pocket('multiverse') + install_packages() os.makedirs(NSS_DIR) @@ -121,6 +144,7 @@ def apache_reload(): @hooks.hook('upgrade-charm', 'config-changed') def config_changed(): + install_packages() emit_cephconf() emit_apacheconf() install_www_scripts()