def report_worker(url, device_ip):
    update_data = report_handler.check_url_info(url, device_ip)
    update_data.update({
        "action": "api-coverage",
        "user_info": app_context.user_info
    })
    report(update_data)
Example #2
0
def report_worker(url, device_ip):
    update_data = report_handler.check_url_info(url, device_ip)
    update_data.update({
        "reporter": "lyrebird.hunter",
        "user_info": app_context.user_info
    })
    report(update_data)
Example #3
0
def issue():
    issue_req = request.json
    template_info = issue_req['template']
    template = template_loader.get_template(template_info['path'])

    issue_data = issue_req['issue']
    attachments = issue_req['attachments']
    snapshots = issue_req['snapshots']

    all_bugit_message = ''

    # Export Snapshot
    for snapshot in snapshots:
        attachments.append(attachment.export_snapshot(snapshot))
    # Set bugit script context
    context = {'issue': issue_data, 'attachments': attachments}
    # Set submit actions
    submit_action_functions = template.submit()
    # Do submit
    for action_function in submit_action_functions:
        try:
            bug_url = action_function(context)
            if bug_url:
                all_bugit_message += bug_url
        except Exception as e:
            if e.__class__.__name__ == 'BugitFormInputError':
                return application.make_fail_response(str(e))
            error_message = traceback.format_exc()
            trace = "<br/>".join(error_message.split("\n"))
            lyrebird.report({
                'action': 'bugit.submit',
                'bugit': {
                    'status': 'failure',
                    'data': issue_data,
                    'error': error_message
                }
            })
            return application.make_fail_response(
                f'Script function "{action_function.__name__}" crash.<br/>{trace}'
            )
    lyrebird.report({
        'action': 'bugit.submit',
        'bugit': {
            'status': 'success',
            'data': issue_data
        }
    })
    #Delete Snapshot
    attachment.remove_attach()
    return application.make_ok_response(
        message=f'Create issue success! {all_bugit_message}')
Example #4
0
def issue():
    issue_req = request.json
    template_info = issue_req['template']
    template = template_loader.get_template(template_info['path'])

    issue_data = issue_req['issue']
    attachments = issue_req['attachments']

    # Set bugit script context
    context = {'issue': issue_data, 'attachments': attachments}
    # Set submit actions
    submit_action_functions = template.submit()
    # Do submit
    for action_function in submit_action_functions:
        try:
            action_function(context)
        except Exception:
            error_message = traceback.format_exc()
            trace = "<br/>".join(error_message.split("\n"))
            lyrebird.report({
                'action': 'bugit.submit',
                'bugit': {
                    'status': 'failure',
                    'data': issue_data,
                    'error': error_message
                }
            })
            return application.make_fail_response(f'Script function "{action_function.__name__}" crash.<br/>{trace}')
    lyrebird.report({
        'action': 'bugit.submit',
        'bugit': {
            'status': 'success',
            'data': issue_data
        }
    })
    return application.make_ok_response(message="Create issue success!")