diff options
| author | dann frazier <dannf@ubuntu.com> | 2014-11-20 09:42:07 -0600 |
|---|---|---|
| committer | dann frazier <dannf@ubuntu.com> | 2014-11-20 09:42:07 -0600 |
| commit | 3bc4c03f57339725afef516fcee0408d8b11dfba (patch) | |
| tree | 3a4ba4ad42d99d7565868c404c49b87a88a3ac57 | |
| parent | e489a2b1a3948ba758403f3e88fa53aa838a0e72 (diff) | |
Use ppa:mongodb-arm64/ppa by default when running on arm64/trusty
We know that the version of mongodb that shipped in trusty is insufficient for arm64, so there's no point in having the charm try to use it. Instead, default to pulling from a Canonical-maintained PPA - but still respect a user's "source" config setting if specified.
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | hooks/hooks.py | 17 |
2 files changed, 19 insertions, 0 deletions
@@ -6,6 +6,8 @@ This charm deploys [MongoDB](http://mongodb.org) in three configurations: - Replica set - Sharded clusters +By default, the MongoDB application is installed from the Ubuntu archive, except for arm64 platforms. The version of MongoDB in the archive is known to have issues on arm64, so by default this charm will use ppa:mongodb-arm64/ppa which contains backported fixes for this architecture. + # Usage ## Review the configurable options diff --git a/hooks/hooks.py b/hooks/hooks.py index d6a590a..a7aa4cd 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -45,6 +45,7 @@ from charmhelpers.core.hookenv import log as juju_log from charmhelpers.core.host import ( service, + lsb_release, ) hooks = Hooks() @@ -718,6 +719,17 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin """ % (cron_runtime, script_filename)) +# We can remove this quirk when charm no longer supports trusty +def arm64_trusty_quirk(): + arch = subprocess.check_output(['dpkg', '--print-architecture']).strip() + if arch != 'arm64': + return + if lsb_release()['DISTRIB_CODENAME'] != 'trusty': + return + ppa = 'ppa:mongodb-arm64/ppa' + juju_log("*** Detected trusty/arm64. Archive version contains incomplete " + "mongodb port, enabling installs from %s ***" % (ppa)) + add_source(ppa) ############################################################################### # Hook functions @@ -726,6 +738,11 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin def install_hook(): juju_log("Installing mongodb") add_source(config('source'), config('key')) + + # Allow users to bypass arm64/trusty workaround by adding their own source + if config('source') == 'None': + arm64_trusty_quirk() + apt_update(fatal=True) apt_install(packages=['mongodb-server', 'mongodb-clients', 'python-yaml'], fatal=True) |
