#380 Update Sync can't handle new packages
Closed: Fixed None Opened 11 years ago by tflink.

= bug description =

The update sync process blows up if a new package is submitted as a blocker fix.

This does cause problems in the sync process and needs to be fixed ASAP.

= bug analysis =

The problem is that update_sync assumes there is a push time for anything "pending stable" which is not true for new packages - they just get pushed stable. This causes a TB like the following during sync:

{{{
Traceback (most recent call last):
File "sync_db.py", line 116, in <module>
update_sync.full_sync_updates(release)
File "/home/blockerbugs/blockerbugs/blockerbugs/util/update_sync.py", line 180, in full_sync_updates
self.sync_bug_updates(release, bugs)
File "/home/blockerbugs/blockerbugs/blockerbugs/util/update_sync.py", line 158, in sync_bug_updates
updates = self.search_updates([bug.bugid], release.number)
File "/home/blockerbugs/blockerbugs/blockerbugs/util/update_sync.py", line 146, in search_updates
updateinfos.append(self.extract_information(update))
File "/home/blockerbugs/blockerbugs/blockerbugs/util/update_sync.py", line 56, in extract_information
updateinfo['date_pushed_testing'] = date_pushed
UnboundLocalError: local variable 'date_pushed' referenced before assignment
}}}

= fix recommendation =

The root of the problem is this code in UpdateSync.extract_information():

{{{
if update.date_pushed:
date_pushed = datetime.strptime(update.date_pushed, '%Y-%m-%d %H:%M:%S')
}}}
and later
{{{
if update.status == 'pending':
updateinfo['pending'] = True

        if update.request == 'stable':
            updateinfo['status'] = 'stable'
            updateinfo['date_pushed_testing'] = date_pushed
        elif update.request == 'testing':
            updateinfo['status'] = 'testing'
        else:
            updateinfo['status'] = 'undefined'
    else:
        updateinfo['status'] = str(update.status)
        if update.status == 'testing':
            updateinfo['date_pushed_testing'] = date_pushed
        elif update.status == 'stable':
            updateinfo['date_pushed_stable'] = date_pushed

}}}

Either date_pushed needs to be initialized to 'None' or the assignments need to make sure that date_pushed actually exists before attempting to access it.


This has been fixed in git and production:

46cba60751c18790ddb0b066efed8925f919040f

Log in to comment on this ticket.

Metadata