From 014ac7597f6ac16a3c27a1fd47c6ae2225298b42 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 16 Jan 2017 16:26:17 +0100 Subject: [PATCH] hobo_deploy: call import-template with template_name (#13154) If the current project has an import-template command and the current service has a template_name we call the first with the second as a parameter. --- hobo/agent/common/management/commands/hobo_deploy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hobo/agent/common/management/commands/hobo_deploy.py b/hobo/agent/common/management/commands/hobo_deploy.py index c6a366d..a60f25b 100644 --- a/hobo/agent/common/management/commands/hobo_deploy.py +++ b/hobo/agent/common/management/commands/hobo_deploy.py @@ -9,7 +9,7 @@ import urlparse from django.conf import settings from django.core.management.base import BaseCommand, CommandError -from django.core.management import call_command +from django.core.management import call_command, get_commands from hobo.multitenant.middleware import TenantMiddleware, TenantNotFound from hobo.theme.utils import get_theme @@ -98,6 +98,7 @@ class Command(BaseCommand): self.generate_saml_keys(tenant, prefix='sp-') self.configure_service_provider(hobo_environment, tenant) self.configure_theme(hobo_environment, tenant) + self.configure_template(hobo_environment, tenant) def generate_saml_keys(self, tenant, prefix=''): @@ -179,3 +180,9 @@ class Command(BaseCommand): target_dir = os.path.join(settings.THEMES_DIRECTORY, theme.get('overlay'), part) atomic_symlink(target_dir, os.path.join(tenant_dir, part)) + + def configure_template(self, hobo_environment, tenant): + me = [x for x in hobo_environment.get('services') if x.get('this') is True][0] + + if 'import-template' in get_commands() and me.get('template_name'): + call_command('import-template', me['template_name']) -- 2.1.4