From cad5641f1dd4ae6fa8913dfb0c808e3cd4b18a46 Mon Sep 17 00:00:00 2001 From: Nichita Herciu <nherciu@cloudbasesolutions.com> Date: Thu, 17 May 2018 20:04:44 +0300 Subject: [PATCH] Add missing packages to charm hook. Fixes 'ImportError: No module named MySQLdb' error in apache2/error.log by installing libmysqlclient-dev and mysql-python. --- charms/garr-dashboard/hooks/hooks.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charms/garr-dashboard/hooks/hooks.py b/charms/garr-dashboard/hooks/hooks.py index 92cbe13..ef31395 100644 --- a/charms/garr-dashboard/hooks/hooks.py +++ b/charms/garr-dashboard/hooks/hooks.py @@ -19,6 +19,11 @@ from charmhelpers.core.hookenv import ( WARNING ) +from charmhelpers.fetch import ( + apt_install, + apt_purge, + apt_update, +) def dashboard_plugin_context(): for rid in relation_ids("dashboard-plugin"): @@ -147,6 +152,8 @@ def dashboard_plugin_relation_changed(): install_project_costs_plugin(ctxt['openstack_dir']) install_admin_costs_plugin(ctxt['openstack_dir']) install_theme(ctxt['openstack_dir']) + apt_install('libmysqlclient-dev', fatal=True) + pip_install('mysql-python', fatal=True) pip_install('gnocchiclient==3.3.1', fatal=True) pip_install('sqlalchemy==1.2.0', fatal=True) service_restart('apache2') -- GitLab