ooiservices/app/main/notifications_redmine.py
def reissue_notification_redmine(alert, definition, notification):
    """ Create another (re-issue) redmine ticket as a part of notification process (for alerts only).
    """
    result = None
    try:
        # Populate required fields to create a redmine ticket and get current redmine ticket
        project = current_app.config['REDMINE_PROJECT_ID']
        redmine_ticket = get_redmine_ticket_for_notification(alert.ticket_id)

        # Set  new notification assigned_id to be same user assigned in alert.ticket_id
        if 'assigned_to' in redmine_ticket:
            assigned_id = redmine_ticket['assigned_to']
        else:
            # Use user_event_notification for determining assigned user's redmine id
            redmine_id = 1
            assigned_user = User.query.get(notification.user_id)
            if assigned_user is not None:
                name = assigned_user.first_name + ' ' + assigned_user.last_name
                tmp_id = get_user_redmine_id(project, name)
                if tmp_id is not None:
                    redmine_id = tmp_id
            else:
                message = 'Invalid User ID, User record not found.'
                current_app.logger.info(message)
                raise exception(message)
            assigned_id = redmine_id

        # Update description to indicate previously issued ticket id for this alert.
        update_info = '\n* Associated with previously issued ticket: %d' % alert.ticket_id

        # Create new redmine ticket; on error, log info and return None
        prefix = (alert.event_type).upper() + '*: '
        subject = prefix + alert.event_response
        description = alert.event_response + update_info
        priority = definition.severity
        ticket_id = create_redmine_ticket_for_notification(project, subject, description, priority, assigned_id)
        if ticket_id is None:
            message = 'Failed to reissue (create another)_redmine_ticket.'
            current_app.logger.info('[reissue_redmine_notification_ticket] %s ' % message)
            return result

        result = ticket_id
        return result

    except Exception as err:
        message = '[reissue_redmine_notification_ticket] message: %s' % err.message
        current_app.logger.info(message)
        return result
 Create another (re-issue) redmine ticket as a part of notification process (for alerts only).
    
Create another (re-issue) redmine ticket as a part of notification process (for alerts only).
Create another ( re - issue ) redmine ticket as a part of notification process ( for alerts only ) .
def reissue_notification_redmine(alert, definition, notification):
    result = None
    try:
        project = current_app.config['REDMINE_PROJECT_ID']
        redmine_ticket = get_redmine_ticket_for_notification(alert.ticket_id)
        if 'assigned_to' in redmine_ticket:
            assigned_id = redmine_ticket['assigned_to']
        else:
            redmine_id = 1
            assigned_user = User.query.get(notification.user_id)
            if assigned_user is not None:
                name = assigned_user.first_name + ' ' + assigned_user.last_name
                tmp_id = get_user_redmine_id(project, name)
                if tmp_id is not None:
                    redmine_id = tmp_id
            else:
                message = 'Invalid User ID, User record not found.'
                current_app.logger.info(message)
                raise exception(message)
            assigned_id = redmine_id
        update_info = '\n* Associated with previously issued ticket: %d' % alert.ticket_id
        prefix = (alert.event_type).upper() + '*: '
        subject = prefix + alert.event_response
        description = alert.event_response + update_info
        priority = definition.severity
        ticket_id = create_redmine_ticket_for_notification(project, subject, description, priority, assigned_id)
        if ticket_id is None:
            message = 'Failed to reissue (create another)_redmine_ticket.'
            current_app.logger.info('[reissue_redmine_notification_ticket] %s ' % message)
            return result
        result = ticket_id
        return result
    except Exception as err:
        message = '[reissue_redmine_notification_ticket] message: %s' % err.message
        current_app.logger.info(message)
        return result
def reissue_notification_redmine ( alert , definition , notification ) : result = None try : project = current_app . config [ 'REDMINE_PROJECT_ID' ] redmine_ticket = get_redmine_ticket_for_notification ( alert . ticket_id ) if 'assigned_to' in redmine_ticket : assigned_id = redmine_ticket [ 'assigned_to' ] else : redmine_id = 1 assigned_user = User . query . get ( notification . user_id ) if assigned_user is not None : name = assigned_user . first_name + ' ' + assigned_user . last_name tmp_id = get_user_redmine_id ( project , name ) if tmp_id is not None : redmine_id = tmp_id else : message = 'Invalid User ID, User record not found.' current_app . logger . info ( message ) raise exception ( message ) assigned_id = redmine_id update_info = '\n* Associated with previously issued ticket: %d' % alert . ticket_id prefix = ( alert . event_type ) . upper ( ) + '*: ' subject = prefix + alert . event_response description = alert . event_response + update_info priority = definition . severity ticket_id = create_redmine_ticket_for_notification ( project , subject , description , priority , assigned_id ) if ticket_id is None : message = 'Failed to reissue (create another)_redmine_ticket.' current_app . logger . info ( '[reissue_redmine_notification_ticket] %s ' % message ) return result result = ticket_id return result except Exception as err : message = '[reissue_redmine_notification_ticket] message: %s' % err . message current_app . logger . info ( message ) return result
Create another (re-issue) redmine ticket as a part of notification process (for alerts only).
Create another ( re - issue ) redmine ticket as a part of notification process ( for alerts only ) .
""" Create another (re-issue) redmine ticket as a part of notification process (for alerts only).
    """ # Populate required fields to create a redmine ticket and get current redmine ticket # Set  new notification assigned_id to be same user assigned in alert.ticket_id # Use user_event_notification for determining assigned user's redmine id # Update description to indicate previously issued ticket id for this alert. # Create new redmine ticket; on error, log info and return None
alert
definition
notification