예제 #1
0
파일: bugello.py 프로젝트: jdlrobson/bingle
    parser.add_option("-c", "--config", dest="config",
                      help="Path to bugello config file", default="bugello.ini")
    (options, args) = parser.parse_args()
    config = ConfigParser.ConfigParser()
    config.optionxform = str # needed to preserve case of option names
    config.read(options.config)
    trelloConfig = config.items('trello')
    debug = config.getboolean('debug', 'debug')
    picklePath = config.get('paths', 'picklePath')
    product = config.get('bugzilla', 'product').split(',')
    component = config.get('bugzilla', 'component').split(',')

    trello = Trello(config=trelloConfig, debug=debug)
    tListId = trello.getBugListId()

    bingle = Bingle(debug=debug, picklePath=picklePath)
    fromTime = bingle.getTimeFromPickle()
    params = {
        'product': product,
        'status': ['UNCONFIRMED', 'NEW'],
        'last_change_time': fromTime
    }
    if len(component[0]) > 1:
        params['component'] = component

    bugzillaPayload = {
        'method': 'Bug.search',
        'params': json.dumps([params])
    }

    for entry in bingle.getBugEntries(bugzillaPayload):
예제 #2
0
파일: bingle.py 프로젝트: wikimedia/bingle
    url = '%s%s/%s/comments.xml' % (apiBaseUrl, 'cards', mingle_id)
    # the first comment is already used in the summary of the mingle card.
    comments = comments.get('comments')[1:]
    for comment in comments:
        payload = {
            'comment[content]': '%s\n#%s' % (comment.get('text'), mingle_id)
        }
        response = requests.post(url,
                                 data=payload,
                                 auth=(auth.get('username'),
                                       auth.get('password')),
                                 headers=headers)


if __name__ == "__main__":
    bingle = Bingle(debug=debug, picklePath=picklePath)
    bingle.info("Pretend mode: %s" % options.pretend)

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    fromTime = bingle.getTimeFromPickle()
    bugzillaPayload = {
        'method':
        'Bug.search',
        'params':
        json.dumps([{
            'product': product,
            'component': component,
            'status': ['UNCONFIRMED', 'NEW'],
            'last_change_time': fromTime,
예제 #3
0
파일: bugello.py 프로젝트: drdee/bingle
    r = requests.get(tListUrl, params=baseParams)
    # don't try/except, because we can't do anything without this.
    r.raise_for_status()
    tListId = None
    tListName = config.get('trello', 'targetListName')
    for tList in r.json():
        if tList['name'].lower() == tListName.lower():
            tListId = tList['id']
            if debug:
                print "List id: %s" % tListId
            break
    if not tListId:
        print "Could not find list: %s" % tListName
        sys.exit(1)

    bingle = Bingle(debug=debug, picklePath=picklePath, feedUrl=config.get(
        'urls', 'bugzillaFeed'))

    for entry in bingle.getFeedEntries():
        # 1 look for existence of the card
        cardTitle = entry.title.encode('UTF-8', 'ignore')
        cardQueryParams = {
            'query': cardTitle,
            'card_fields': 'name',
            'modelTypes': 'cards'
        }
        payload = dict(baseParams.items() + cardQueryParams.items())
        try:
            r = requests.get('https://trello.com/1/search', params=payload)
            r.raise_for_status()
        except requests.exceptions.HTTPError as e:
            if debug:
예제 #4
0
파일: bingle.py 프로젝트: jdlrobson/bingle
    headers = {'content-type': 'application/x-www-form-urlencoded'}
    url = '%s%s/%s/comments.xml' % (apiBaseUrl, 'cards', mingle_id)
    # the first comment is already used in the summary of the mingle card.
    comments = comments.get('comments')[1:]
    for comment in comments:
        payload = {'comment[content]': '%s\n#%s' % (
            comment.get('text'), mingle_id)}
        response = requests.post(url,
                                 data=payload,
                                 auth=(auth.get(
                                       'username'), auth.get('password')),
                                 headers=headers)


if __name__ == "__main__":
    bingle = Bingle(debug=debug, picklePath=picklePath)
    bingle.info("Pretend mode: %s" % options.pretend)

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    fromTime = bingle.getTimeFromPickle()
    bugzillaPayload = {'method': 'Bug.search', 'params': json.dumps([{
        'product': product,
        'component': component,
        'status': ['UNCONFIRMED', 'NEW'],
        'last_change_time': fromTime,
    }])}
    for bug in bingle.getBugEntries(bugzillaPayload):
        bingle.info("Bug XML: %s" % bug)
예제 #5
0
파일: bugello.py 프로젝트: skierpage/bingle
    r = requests.get(tListUrl, params=baseParams)
    # don't try/except, because we can't do anything without this.
    r.raise_for_status()
    tListId = None
    tListName = config.get('trello', 'targetListName')
    for tList in r.json():
        if tList['name'].lower() == tListName.lower():
            tListId = tList['id']
            if debug:
                print "List id: %s" % tListId
            break
    if not tListId:
        print "Could not find list: %s" % tListName
        sys.exit(1)

    bingle = Bingle(debug=debug, picklePath=picklePath)
    fromTime = bingle.getTimeFromPickle()
    params = {
        'product': product,
        'status': ['UNCONFIRMED', 'NEW'],
        'last_change_time': fromTime
    }
    if len(component[0]) > 1:
        params['component'] = component

    bugzillaPayload = {
        'method': 'Bug.search',
        'params': json.dumps([params])
    }

    for entry in bingle.getBugEntries(bugzillaPayload):
예제 #6
0

if __name__ == "__main__":
    # config overrides
    config = ConfigParser.ConfigParser()
    config.read(options.config)
    picklePath = config.get('paths', 'picklePath') + '_resolved'
    statusResolved = config.get('bingle', 'statusResolved')
    mingleStatusField = config.get('bingle', 'mingleStatusField')
    mingleResolvedStatus = config.get('bingle', 'mingleResolvedStatus')
    mingleIterationPropertyName = config.get('bingle',
                                             'mingleIterationPropertyName')
    mingleResolvedIteration = config.get('bingle', 'mingleResolvedIteration')
    mingleIgnoreResolved = [
        item.strip()
        for item in config.get('bingle', 'mingleIgnoreResolved').split(',')
    ]

    bingle = Bingle(debug=debug, picklePath=picklePath)
    bingle.info("Pretend mode: %s" % options.pretend)
    bingle.info("Ignoring bugs in: %s" % mingleIgnoreResolved)

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    fromTime = bingle.getTimeFromPickle()
    execute(standalone=True,
            pretend=options.pretend,
            bingle=bingle,
            mingle=mingle)
예제 #7
0
    debug = config.getboolean('debug', 'debug')
    picklePath = config.get('paths', 'picklePath') + '_resolved'
    apiBaseUrl = config.get('urls', 'mingleApiBase')
    mingleUrlBase = config.get('urls', 'mingleUrlBase')
    bugCard = config.get('mingle', 'bugCard')
    bugIdFieldName = config.get('mingle', 'bugIdFieldName')
    product = config.get('bugzilla', 'product').split(',')
    component = config.get('bugzilla', 'component').split(',')
    bugzillaProperties = createDictionaryFromPropertiesList(
        config.get('bugzilla', 'properties'))
    mingleProperties = createDictionaryFromPropertiesList(
        config.get('mingle', 'properties'))
    mapping = createDictionaryFromPropertiesList(
        config.get('mapping', 'properties'))

    bingle = Bingle(debug=debug, picklePath=picklePath)
    bingle.info("Pretend mode: %s" % options.pretend)

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    fromTime = bingle.getTimeFromPickle()
    bzSearchParams = {
        'product': product,
        'component': component,
        'status': ['RESOLVED'],  # make configurable
    }
    if fromTime:
        bzSearchParams['last_change_time'] = fromTime
        bingle.info(bzSearchParams)
    bugzillaPayload = {
예제 #8
0
파일: bingle.py 프로젝트: skierpage/bingle
    debug = config.getboolean('debug', 'debug')
    picklePath = config.get('paths', 'picklePath')
    apiBaseUrl = config.get('urls', 'mingleApiBase')
    mingleUrlBase = config.get('urls', 'mingleUrlBase')
    bugCard = config.get('mingle', 'bugCard')
    bugIdFieldName = config.get('mingle', 'bugIdFieldName')
    product = config.get('bugzilla', 'product').split(',')
    component = config.get('bugzilla', 'component').split(',')
    bugzillaProperties = createDictionaryFromPropertiesList(
        config.get('bugzilla', 'properties'))
    mingleProperties = createDictionaryFromPropertiesList(
        config.get('mingle', 'properties'))
    mapping = createDictionaryFromPropertiesList(
        config.get('mapping', 'properties'))

    bingle = Bingle(debug=debug, picklePath=picklePath)

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    fromTime = bingle.getTimeFromPickle()
    bugzillaPayload = {'method': 'Bug.search', 'params': json.dumps([{
        'product': product,
        'component': component,
        'status': ['UNCONFIRMED', 'NEW'],
        'last_change_time': fromTime,
    }])}
    for bug in bingle.getBugEntries(bugzillaPayload):
        bingle.info("Bug XML: %s" % bug)
        # see if there's a mingle card matching this bug
        if len(bugIdFieldName) > 0:
예제 #9
0
파일: bingle.py 프로젝트: drdee/bingle
    component = config.get('bugzilla', 'component').split(',')
    tags = config.get('mingle', 'tags')
    bugzillaProperties = createDictionaryFromPropertiesList(
        config.get('bugzilla', 'properties'))
    mingleProperties = createDictionaryFromPropertiesList(
        config.get('mingle', 'properties'))
    mapping = createDictionaryFromPropertiesList(
        config.get('mapping', 'properties'))
    payload = {'method': 'Bug.search', 'params': json.dumps([{
        'product': product,
        'component': component,
        'status': ['UNCONFIRMED', 'NEW'],
        'creation_time': '2012-08-01 00:00 UTC',
    }])}

    bingle = Bingle(payload, debug=debug, picklePath=picklePath, feedUrl=config.get(
        'urls', 'bugzillaFeed'))

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    for bug in bingle.getBugEntries():
        bingle.info("Bug XML: %s" % bug)
        # look for card
        foundBugs = mingle.findCardByName(
            bugCard, bug.get('summary'), bug.get('id'))
        bingle.info(mingle.dumpRequest())
        if len(foundBugs) > 0:
            continue

        # retrieve bug comments
        comment_payload = {'method': 'Bug.comments', 'params': json.dumps(
예제 #10
0
    reconcileMingle(bingle, mingle, bugs, options.pretend)
    if standalone and not pretend:
        # update pickle
        bingle.updatePickleTime()


if __name__ == "__main__":
    # config overrides
    config = ConfigParser.ConfigParser()
    config.read(options.config)
    picklePath = config.get('paths', 'picklePath') + '_resolved'
    statusResolved = config.get('bingle', 'statusResolved')
    mingleStatusField = config.get('bingle', 'mingleStatusField')
    mingleResolvedStatus = config.get('bingle', 'mingleResolvedStatus')
    mingleIterationPropertyName = config.get('bingle',
                                             'mingleIterationPropertyName')
    mingleResolvedIteration = config.get('bingle', 'mingleResolvedIteration')
    mingleIgnoreResolved = [item.strip() for item in config.get(
        'bingle', 'mingleIgnoreResolved').split(',')]

    bingle = Bingle(debug=debug, picklePath=picklePath)
    bingle.info("Pretend mode: %s" % options.pretend)
    bingle.info("Ignoring bugs in: %s" % mingleIgnoreResolved)

    # prepare Mingle instance
    mingle = Mingle(auth, apiBaseUrl)

    fromTime = bingle.getTimeFromPickle()
    execute(standalone=True, pretend=options.pretend, bingle=bingle,
            mingle=mingle)
예제 #11
0
                      help="Path to bugello config file",
                      default="bugello.ini")
    (options, args) = parser.parse_args()
    config = ConfigParser.ConfigParser()
    config.optionxform = str  # needed to preserve case of option names
    config.read(options.config)
    trelloConfig = config.items('trello')
    debug = config.getboolean('debug', 'debug')
    picklePath = config.get('paths', 'picklePath')
    product = config.get('bugzilla', 'product').split(',')
    component = config.get('bugzilla', 'component').split(',')

    trello = Trello(config=trelloConfig, debug=debug)
    tListId = trello.getBugListId()

    bingle = Bingle(debug=debug, picklePath=picklePath)
    fromTime = bingle.getTimeFromPickle()
    params = {
        'product': product,
        'status': ['UNCONFIRMED', 'NEW'],
        'last_change_time': fromTime
    }
    if len(component[0]) > 1:
        params['component'] = component

    bugzillaPayload = {'method': 'Bug.search', 'params': json.dumps([params])}

    for entry in bingle.getBugEntries(bugzillaPayload):
        cardExists = False
        bugId = entry.get('id', '---')
        bugTitle = entry.get('summary').encode('UTF-8', 'ignore')