Fix error when version is None

Logs were reporting:

Failure instance: Traceback: <type 'exceptions.AttributeError'>: StrictVersion instance has no attribute 'version'
/Volumes/LBRY/LBRY.app/Contents/Resources/lib/python2.7/lbrynet/lbrynet_daemon/DaemonServer.py:121:requestReceived
twisted/web/server.pyc:183:process
twisted/web/server.pyc:234:render
/Volumes/LBRY/LBRY.app/Contents/Resources/lib/python2.7/lbrynet/lbrynet_daemon/Daemon.py:450:render
--- <exception caught here> ---
twisted/internet/defer.pyc:150:maybeDeferred
/Volumes/LBRY/LBRY.app/Contents/Resources/lib/python2.7/lbrynet/lbrynet_daemon/Daemon.py:1561:jsonrpc_version
/Volumes/LBRY/LBRY.app/Contents/Resources/lib/python2.7/lbrynet/core/utils.py:39:version_is_greater_than
distutils/version.pyc:140:__cmp__
This commit is contained in:
Job Evers-Meltzer 2016-10-11 20:48:29 -05:00
parent 897c113db1
commit ae4b984f0b

View file

@ -634,7 +634,7 @@ class Daemon(jsonrpc.JSONRPC):
) )
self.git_lbryum_version = version self.git_lbryum_version = version
return defer.succeed(None) return defer.succeed(None)
except: except Exception:
log.info("Failed to get lbryum version from git") log.info("Failed to get lbryum version from git")
self.git_lbryum_version = None self.git_lbryum_version = None
return defer.fail(None) return defer.fail(None)
@ -649,7 +649,7 @@ class Daemon(jsonrpc.JSONRPC):
) )
self.git_lbrynet_version = version self.git_lbrynet_version = version
return defer.succeed(None) return defer.succeed(None)
except: except Exception:
log.info("Failed to get lbrynet version from git") log.info("Failed to get lbrynet version from git")
self.git_lbrynet_version = None self.git_lbrynet_version = None
return defer.fail(None) return defer.fail(None)
@ -1553,6 +1553,16 @@ class Daemon(jsonrpc.JSONRPC):
""" """
platform_info = self._get_platform() platform_info = self._get_platform()
try:
lbrynet_update_available = utils.version_is_greater_than(
self.git_lbrynet_version, lbrynet_version)
except AttributeError:
lbrynet_update_available = False
try:
lbryum_update_available = utils.version_is_greater_than(
self.git_lbryum_version, lbryum_version)
except AttributeError:
lbryum_update_available = False
msg = { msg = {
'platform': platform_info['platform'], 'platform': platform_info['platform'],
'os_release': platform_info['os_release'], 'os_release': platform_info['os_release'],
@ -1562,8 +1572,8 @@ class Daemon(jsonrpc.JSONRPC):
'ui_version': self.ui_version, 'ui_version': self.ui_version,
'remote_lbrynet': self.git_lbrynet_version, 'remote_lbrynet': self.git_lbrynet_version,
'remote_lbryum': self.git_lbryum_version, 'remote_lbryum': self.git_lbryum_version,
'lbrynet_update_available': utils.version_is_greater_than(self.git_lbrynet_version, lbrynet_version), 'lbrynet_update_available': lbrynet_update_available,
'lbryum_update_available': utils.version_is_greater_than(self.git_lbryum_version, lbryum_version), 'lbryum_update_available': lbryum_update_available
} }
log.info("Get version info: " + json.dumps(msg)) log.info("Get version info: " + json.dumps(msg))