Skip to content

Commit

Permalink
Fixed potential bug where if dynamic_fields fails before populating s…
Browse files Browse the repository at this point in the history
…tatedb, JSON is populated with null values
  • Loading branch information
assrinivasan committed May 29, 2024
1 parent 959c946 commit d89a8bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sonic-stormond/scripts/stormond
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ class DaemonStorage(daemon_base.DaemonBase):
self.fsio_rw_json = json.load(f)
self.fsio_json_file_loaded = True

for storage_device in self.storage.devices:
for field in self.statedb_json_sync_fields:

value = self.fsio_rw_json[storage_device][field]

self.fsio_rw_json[storage_device][field] = "0" if value == "null" else value

except Exception as e:
self.log_error("JSON file could not be loaded: {}".format(str(e)))

Expand Down

0 comments on commit d89a8bd

Please sign in to comment.