~seyeongkim/charm-helpers/fixing-filenotfounderror

Viewing all changes in revision 782.

  • Committer: David Ames
  • Date: 2017-08-14 14:39:48 UTC
  • mfrom: (780.1.3 charm-helpers)
  • Revision ID: david.ames@canonical.com-20170814143948-7w16oaqzii3nrjy7
[tinwood, r=thedac] 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
DEBUG/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: