Fix issue with loading None version schema

This commit is contained in:
Joshua Boniface 2021-06-14 21:06:15 -04:00
parent 96f1d7df83
commit 953e46055a
1 changed files with 6 additions and 1 deletions

View File

@ -538,6 +538,8 @@ try:
node_schema_version = int(zkhandler.read(('node.data.active_schema', myhostname))) node_schema_version = int(zkhandler.read(('node.data.active_schema', myhostname)))
except Exception: except Exception:
node_schema_version = zkhandler.read('base.schema.version') node_schema_version = zkhandler.read('base.schema.version')
if node_schema_version is None:
node_schema_version = 0
zkhandler.write([ zkhandler.write([
(('node.data.active_schema', myhostname), node_schema_version) (('node.data.active_schema', myhostname), node_schema_version)
]) ])
@ -559,7 +561,10 @@ zkhandler.write([
def update_schema(new_schema_version, stat, event=''): def update_schema(new_schema_version, stat, event=''):
global zkhandler, update_timer, node_schema_version global zkhandler, update_timer, node_schema_version
try:
new_schema_version = int(new_schema_version.decode('ascii')) new_schema_version = int(new_schema_version.decode('ascii'))
except Exception:
new_schema_version = 0
if new_schema_version == node_schema_version: if new_schema_version == node_schema_version:
return True return True