def resultContext(self, template, instance=None, **context):
        if 'application' not in context:
            context['application'] = self.action
        failure = context.pop('error', False)
        if isinstance(failure, Failure):
            if 'description' not in context:
                context['description'] = '[%s] %s: %s' % \
                        (self.action, getException(failure), failure.getErrorMessage())
            if 'code' not in context:
                context['code'] = -2
            context['error'] = True
            context['stacktrace'] = failure.getTraceback()
            self.log('Result context during exception\n%(stacktrace)s' % context)
            return context #failed so bad we need to shortcut out
        else:
            context['error'] = bool(failure)
        if instance: #this was made for AppManager's
            if hasattr(instance, 'version'):
                context['version'] = instance.version
            if hasattr(instance, 'label'):
                context['label'] = instance.label
            if hasattr(instance, 'running'):
                context['running'] = instance.running
        try: #fail-safe in case someone is a bonehead
            context['description'] = template % context
        except:
            failure = Failure()
            context['description'] = '[%s] %s: %s' % \
                    (self.action, getException(failure), failure.getErrorMessage())
            context['stacktrace'] = failure.getTraceback()
            if 'code' not in context:
                context['code'] = -2
        #be nice to blaster api and the remote client
        context.update({'code' : context.get('code',0) })
        return context
Attaches load balancer to one or more subnets.
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/models/action.py/AdminAction.resultContext--crossover with--dataset/ETHPy150Open darcyliu/storyboard/boto/ec2/elb/loadbalancer.py/LoadBalancer.attach_subnets