Skip to content

utils.py: write_file_if_needed, temp_to_permanent_file, get_umask

Added new utility function get_umask() to retrieve the process umask.
On Linux it will do this in a thread-safe way.

Changed temp_to_permanent_file() to honor the process umask instead of
hard-coding the final file mode.

Added mode keyword argument to temp_to_permanent_file() to make it
more flexible.

Changed write_file_if_needed() to use temp_to_permanent_file() to
make it operate atomically. Also it now returns a boolean indicating
whether or not the file was updated.

Changed refresh_cdb_json_file() to use utils.temp_to_permanent_file().

Added/updated related tests.


Related MRs:

Edited by Ahmon Dancy

Merge request reports