summaryrefslogtreecommitdiff
path: root/hooks
diff options
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/hooks.py17
1 files changed, 17 insertions, 0 deletions
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)