def run(self):
try:
manifest = yaml.safe_load(self.wd.read('manifest'))
except:
log.error("No snapshot found")
return (False, "no snapshot found")
fails = []
for filepath in manifest:
f = File(filepath)
s = File(manifest[filepath], parent=self.wd)
diff = list(difflib.unified_diff(f.content.splitlines(), s.content.splitlines()))
if len(diff):
fails.append(filepath)
log.info("Check for {} failed with diff:")
log.info("\n".join(diff))
if len(fails):
return (False, "the following files have changed: {}".format(', '.join(fails)))
else:
return (True, "no files have changed")
评论列表
文章目录