Code review comment for lp:~psivaa/utah/bug-1343881

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

In the following code:

17 + try:
18 + ubuntu_distro = distro_info.UbuntuDistroInfo()
19 + except Exception as e:
20 + logging.error("Can not find distro info %s", e.message)
21 +
22 + if self.st_release != ubuntu_distro.devel():
23 + self.url = os.path.join(DEFAULT_URL, self.st_release)
24 + else:

If distro info data is obsolete, ubuntu_distro will be undefined and the rest of the code will fail. I'd rather do:
try:
    ubuntu_distro_devel = distro_info.UbuntuDistroInfo().devel()
except:
    logging.error(...)
    exit

A fallback to a default distro might also be an option but it'll require to update the code every new release.

review: Needs Fixing

« Back to merge proposal