aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'os_net_config/utils.py')
-rw-r--r--os_net_config/utils.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index 0254d45..a2df823 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -14,6 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+import logging
+
+
+logger = logging.getLogger(__name__)
+
def write_config(filename, data):
with open(filename, "w") as f:
@@ -25,8 +30,13 @@ def get_file_data(filename):
with open(filename, "r") as f:
return f.read()
except IOError:
+ logger.error("Error reading file: %s" % filename)
return ""
def diff(filename, data):
- return not get_file_data(filename) == data
+ file_data = get_file_data(filename)
+ logger.debug("Diff file data:\n%s" % file_data)
+ logger.debug("Diff data:\n%s" % data)
+ # convert to string as JSON may have unicode in it
+ return not file_data == data