~ajkavanagh/charm-helpers/clean-up-render

Viewing all changes in revision 781.

  • Committer: Alex Kavanagh
  • Date: 2017-08-10 14:31:31 UTC
  • Revision ID: alex.kavanagh@canonical.com-20170810143131-2kclw7lym1vi8efg
Update the core.host.write_file(...) function to do less work

The primary motivation for this change is to do less work, touch the
filesystem less, and try to clean the logs up a bit.  This change is
to the rendering of configuration files, which generates noise in the
logs (at INFO) level, and often results in writing the exact same
content, thus updating the atime of the file even when the contents
haven't changed.

This change detects if the content will change, and if not, doesn't
write the file.  It does detect if the uid,gid is changing and takes
the appropriate action.  The logs are demoted to the lowest level of
TRACE, and are only generated IFF the file is actually written or
the uid/gid is changed.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: