Пример #1
0
    extra_args = {}
    if feedback:
        extra_args['feedback'] = feedback

    if reviewers:
        extra_args['reviewers'] = reviewers

    if feedback or reviewers:
        # Need product and component to get the right flag id
        if 'PRODUCT' in values and 'COMPONENT' in values:
            extra_args['product'] = values['PRODUCT']
            extra_args['component'] = values['COMPONENT']
        else:
            buginfo = bz.get_bug(auth,
                                 bug,
                                 include_fields=['product', 'component'])
            extra_args['product'] = buginfo['product']
            extra_args['component'] = buginfo['component']

    description = values['ATTACHMENT_DESCRIPTION']
    if opts['number']:
        description = "Patch " + opts['number'] + " - " + description

    contents.seek(0)
    try:
        result = create_attachment(ui,
                                   api_server,
                                   auth,
                                   bug,
                                   BINARY_CACHE_FILENAME,
Пример #2
0
        return

    extra_args = {}
    if feedback:
        extra_args['feedback'] = feedback

    if reviewers:
        extra_args['reviewers'] = reviewers

    if feedback or reviewers:
        # Need product and component to get the right flag id
        if 'PRODUCT' in values and 'COMPONENT' in values:
            extra_args['product'] = values['PRODUCT']
            extra_args['component'] = values['COMPONENT']
        else:
            buginfo = bz.get_bug(auth, bug, include_fields=['product', 'component'])
            extra_args['product'] = buginfo['product']
            extra_args['component'] = buginfo['component']

    description = values['ATTACHMENT_DESCRIPTION']
    if opts['number']:
        description = "Patch " + opts['number'] + " - " + description

    contents.seek(0)
    try:
        result = create_attachment(ui, api_server, auth,
                                   bug, BINARY_CACHE_FILENAME, contents.read(),
                                   filename=filename,
                                   description=description,
                                   comment=values['ATTACHCOMMENT'],
                                   **extra_args)
        return

    extra_args = {}
    if feedback:
        extra_args['feedback'] = feedback

    if reviewers:
        extra_args['reviewers'] = reviewers

    if feedback or reviewers:
        # Need product and component to get the right flag id
        if 'PRODUCT' in values and 'COMPONENT' in values:
            extra_args['product'] = values['PRODUCT']
            extra_args['component'] = values['COMPONENT']
        else:
            buginfo = json.load(urlopen(ui, bz.get_bug(api_server, auth, bug, include_fields=['product', 'component'])))
            extra_args['product'] = buginfo['product']
            extra_args['component'] = buginfo['component']

    description = values['ATTACHMENT_DESCRIPTION']
    if opts['number']:
        description = "Patch " + opts['number'] + " - " + description

    contents.seek(0)
    result = create_attachment(ui, api_server, auth,
                               bug, BINARY_CACHE_FILENAME, contents.read(),
                               filename=filename,
                               description=description,
                               comment=values['ATTACHCOMMENT'],
                               **extra_args)
    attachment_url = urlparse.urljoin(bugzilla,