diff --git a/hobo/agent/hobo/management/commands/hobo_deploy.py b/hobo/agent/hobo/management/commands/hobo_deploy.py index d996369..8683cf1 100644 --- a/hobo/agent/hobo/management/commands/hobo_deploy.py +++ b/hobo/agent/hobo/management/commands/hobo_deploy.py @@ -7,6 +7,7 @@ from hobo.agent.common.management.commands import hobo_deploy from hobo.deploy.signals import notify_agents from hobo.environment.models import AVAILABLE_SERVICES, Hobo, Variable from hobo.multitenant.middleware import TenantMiddleware, TenantNotFound +from hobo.profile.models import AttributeDefinition class Command(hobo_deploy.Command): @@ -97,6 +98,20 @@ class Command(hobo_deploy.Command): variable.value = me['slug'] variable.save() + # and reproduce profile settings from primary + if 'profile' in hobo_environment: + seen = [] + for i, field in enumerate(hobo_environment['profile']['fields']): + attribute, created = AttributeDefinition.objects.get_or_create( + name=field['name'], + defaults={'label': field['label']}) + for k, v in field.items(): + setattr(attribute, k, v) + attribute.order = i + 1 + attribute.save() + seen.append(attribute.name) + AttributeDefinition.objects.exclude(name__in=seen).delete() + if me.get('secondary'): # on the primary hobo, notify other primary services, this will # get authentic to know about secondary services