From deb71da91e8e2761482dabfee5d98198afb9884e Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 26 Feb 2012 12:10:57 -0500 Subject: [PATCH] trim md5sum string so it does not contain the filename also fix a bug/typo in the reporting from playbook --- lib/ansible/playbook.py | 2 +- library/copy | 4 ++-- library/template | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index 6c2df6ab62..d8a5437947 100755 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -183,7 +183,7 @@ class PlayBook(object): if not self.changed.has_key(host): self.changed[host] = 1 else: - self.changes[host] = self.changed[host] + 1 + self.changed[host] = self.changed[host] + 1 # flag which notify handlers need to be run diff --git a/library/copy b/library/copy index 3dfe792c0f..aa944924ef 100644 --- a/library/copy +++ b/library/copy @@ -22,11 +22,11 @@ if not os.path.exists(source): md5sum = None changed = False if os.path.exists(dest): - md5sum = os.popen("md5sum %s" % dest).read() + md5sum = os.popen("md5sum %s" % dest).read().split()[0] os.system("cp %s %s" % (source, dest)) -md5sum2 = os.popen("md5sum %s" % dest).read() +md5sum2 = os.popen("md5sum %s" % dest).read().split()[0] if md5sum != md5sum2: changed = True diff --git a/library/template b/library/template index 76f97607b6..3bbcbdfcc3 100644 --- a/library/template +++ b/library/template @@ -45,7 +45,7 @@ source = file(source).read() changed = False md5sum = None if os.path.exists(dest): - md5sum = os.popen("md5sum %s" % dest).read() + md5sum = os.popen("md5sum %s" % dest).read().split()[0] # call Jinja2 here and save the new template file template = jinja2.Template(source) @@ -58,7 +58,7 @@ f.close() # other end unless things were successful # record m5sum and return success and whether things have changed -md5sum2 = os.popen("md5sum %s" % dest).read() +md5sum2 = os.popen("md5sum %s" % dest).read().split()[0] if md5sum != md5sum2: changed = True