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.
In the following code:
17 + try: info.UbuntuDist roInfo( ) distro. devel() : join(DEFAULT_ URL, self.st_release)
18 + ubuntu_distro = distro_
19 + except Exception as e:
20 + logging.error("Can not find distro info %s", e.message)
21 +
22 + if self.st_release != ubuntu_
23 + self.url = os.path.
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: distro_ devel = distro_ info.UbuntuDist roInfo( ).devel( ) error(. ..)
try:
ubuntu_
except:
logging.
exit
A fallback to a default distro might also be an option but it'll require to update the code every new release.