Skip to content

Commit

Permalink
Ensure validate writes a valid schema version
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaboniface committed Jun 15, 2021
1 parent 5f11b31 commit 2331852
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions daemon-common/zkhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,12 @@ def apply(self, zkhandler):
for key in self.keys(elem):
kpath = f'{elem}.{key}'
if not zkhandler.zk_conn.exists(self.path(kpath)):
zkhandler.zk_conn.create(self.path(kpath), ''.encode(zkhandler.encoding))
# Ensure that we create base.schema.version with the current valid version value
if kpath == 'base.schema.version':
data = str(self.version)
else:
data = ''
zkhandler.zk_conn.create(self.path(kpath), data.encode(zkhandler.encoding))

for elem in ['node', 'domain', 'network', 'osd', 'pool']:
# First read all the subelements of the key class
Expand Down Expand Up @@ -806,8 +811,6 @@ def apply(self, zkhandler):
if not zkhandler.zk_conn.exists(self.path(kpath, child)):
zkhandler.zk_conn.create(self.path(kpath, child), ''.encode(zkhandler.encoding))

zkhandler.zk_conn.create(self.path('base.schema.version'), self.version)

# Migrate key diffs
def run_migrate(self, zkhandler, changes):
diff_add = changes['add']
Expand Down

0 comments on commit 2331852

Please sign in to comment.