Skip to content
  • Ahmon Dancy's avatar write_file_if_needed, temp_to_permanent_file, get_umask · 9356a86b
    Ahmon Dancy authored
    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.
    Change-Id: Iea957202dd45dad29b77d7d9fafd7ee44485704a