-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAS-131168 / 25.04 / harden ix-apps metadata handling (#14510)
This commit makes two minor changes to harden our ix-apps metadata to avoid crashes due to yaml_loads returning None instead of the expected dict. One reason this can happen is that the file in question is empty when read. 1. Switch to using the middleware io util `write_if_changed` This makes writes to the metadata yaml files de-facto atomic as we write to temporary file, flush it, then rename over existing file. Since the files are only used by middlewared I am proactively setting permissions on them to 0o600. 2. Add a wrapper around yaml.safe_load to return an empty dict instead of None type if file is empty. Consumers of these methods expect to receive a dict and so we must handle this edge case. --------- Co-authored-by: M. Rehan <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters