diff options
| author | Charles Butler <charles.butler@ubuntu.com> | 2015-01-13 10:52:30 -0500 |
|---|---|---|
| committer | Charles Butler <charles.butler@ubuntu.com> | 2015-01-13 10:52:30 -0500 |
| commit | 52a54738e916ffbb025b0a7fffe51f9409d37ab9 (patch) | |
| tree | 6dfba182393e5113eb40f51c85ff10f0d648b60d /hooks | |
| parent | 990163689c5f2c7e0f0acd5e2b7657152011b45d (diff) | |
| parent | 3bc4c03f57339725afef516fcee0408d8b11dfba (diff) | |
[r=lazypower] dann frazier 2014-11-20 Use ppa:mongodb-arm64/ppa by default when running on arm64/trusty
Diffstat (limited to 'hooks')
| -rwxr-xr-x | hooks/hooks.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hooks/hooks.py b/hooks/hooks.py index 3d686a9..5e70e29 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() @@ -720,6 +721,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 @@ -728,6 +740,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) |
