From 476050b46021130654a7417bbb41647a5214dbcc Mon Sep 17 00:00:00 2001
From: Daniel Watkins <daniel@daniel-watkins.co.uk>
Date: Mon, 9 Sep 2019 19:12:21 +0000
Subject: atomic_helper: add DEBUG logging to write_file

LP: #1843276
---
 cloudinit/atomic_helper.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py
index 587b9945..1f61faa2 100644
--- a/cloudinit/atomic_helper.py
+++ b/cloudinit/atomic_helper.py
@@ -1,11 +1,13 @@
 # This file is part of cloud-init. See LICENSE file for license information.
 
 import json
+import logging
 import os
 import stat
 import tempfile
 
 _DEF_PERMS = 0o644
+LOG = logging.getLogger(__name__)
 
 
 def write_file(filename, content, mode=_DEF_PERMS,
@@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS,
     try:
         tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename),
                                          delete=False, mode=omode)
+        LOG.debug(
+            "Atomically writing to file %s (via temporary file %s) - %s: [%o]"
+            " %d bytes/chars",
+            filename, tf.name, omode, mode, len(content))
         tf.write(content)
         tf.close()
         os.chmod(tf.name, mode)
-- 
cgit v1.2.3