Merge lp://qastaging/~ajkavanagh/charm-helpers/clean-up-render into lp://qastaging/charm-helpers

Proposed by Alex Kavanagh
Status: Merged
Merged at revision: 782
Proposed branch: lp://qastaging/~ajkavanagh/charm-helpers/clean-up-render
Merge into: lp://qastaging/charm-helpers
Diff against target: 93 lines (+36/-8)
3 files modified
charmhelpers/contrib/openstack/templating.py (+5/-2)
charmhelpers/core/hookenv.py (+1/-0)
charmhelpers/core/host.py (+30/-6)
To merge this branch: bzr merge lp://qastaging/~ajkavanagh/charm-helpers/clean-up-render
Reviewer Review Type Date Requested Status
David Ames (community) Approve
Review via email: mp+328859@code.qastaging.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
David Ames (thedac) wrote :

This looks good.

Before final approval I'd like to see it in one of our charms running an amulet full.

I realize this is a bit chicken and egg. But you can hijack the charm-helpers-hooks.yaml for this purpose.

Revision history for this message
David Ames (thedac) wrote :

Tests from the glance example pass.

Merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches