st2client/st2client/commands/action.py
def _format_for_common_representation(self, task):
        '''
        Formats a task for common representation between mistral and action-chain.
        '''
        # This really needs to be better handled on the back-end but that would be a bigger
        # change so handling in cli.
        context = getattr(task, 'context', None)
        if context and 'chain' in context:
            task_name_key = 'context.chain.name'
        elif context and 'mistral' in context:
            task_name_key = 'context.mistral.task_name'
        # Use LiveAction as the object so that the formatter lookup does not change.
        # AKA HACK!
        return models.action.LiveAction(**{
            'id': task.id,
            'status': task.status,
            'task': jsutil.get_value(vars(task), task_name_key),
            'action': task.action.get('ref', None),
            'start_timestamp': task.start_timestamp,
            'end_timestamp': getattr(task, 'end_timestamp', None)
        })

        Formats a task for common representation between mistral and action-chain.
        
Formats a task for common representation between mistral and action-chain.
Formats a task for common representation between mistral and action - chain .
def _format_for_common_representation(self, task):
        context = getattr(task, 'context', None)
        if context and 'chain' in context:
            task_name_key = 'context.chain.name'
        elif context and 'mistral' in context:
            task_name_key = 'context.mistral.task_name'
        return models.action.LiveAction(**{
            'id': task.id,
            'status': task.status,
            'task': jsutil.get_value(vars(task), task_name_key),
            'action': task.action.get('ref', None),
            'start_timestamp': task.start_timestamp,
            'end_timestamp': getattr(task, 'end_timestamp', None)
        })
def _format_for_common_representation ( self , task ) : context = getattr ( task , 'context' , None ) if context and 'chain' in context : task_name_key = 'context.chain.name' elif context and 'mistral' in context : task_name_key = 'context.mistral.task_name' return models . action . LiveAction ( ** { 'id' : task . id , 'status' : task . status , 'task' : jsutil . get_value ( vars ( task ) , task_name_key ) , 'action' : task . action . get ( 'ref' , None ) , 'start_timestamp' : task . start_timestamp , 'end_timestamp' : getattr ( task , 'end_timestamp' , None ) } )
Formats a task for common representation between mistral and action-chain.
Formats a task for common representation between mistral and action - chain .
'''
        Formats a task for common representation between mistral and action-chain.
        ''' # This really needs to be better handled on the back-end but that would be a bigger # change so handling in cli. # Use LiveAction as the object so that the formatter lookup does not change. # AKA HACK!
self
task