From a50f44d85caefe94a0e15dd5b24232c8af29440c Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 10 Jul 2006 17:51:06 +0000 Subject: * Fix pkgtool setup for base Toolset * Implement current_diff support for ConfigFile entries (from Chris Vuletich) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1923 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Toolset.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py index 4035402b8..307f626ea 100644 --- a/src/lib/Client/Toolset.py +++ b/src/lib/Client/Toolset.py @@ -5,7 +5,7 @@ from stat import S_ISVTX, S_ISGID, S_ISUID, S_IXUSR, S_IWUSR, S_IRUSR, S_IXGRP from stat import S_IWGRP, S_IRGRP, S_IXOTH, S_IWOTH, S_IROTH, ST_MODE, S_ISDIR from stat import S_IFREG, ST_UID, ST_GID, S_ISREG, S_IFDIR, S_ISLNK -import binascii, copy, grp, logging, lxml.etree, os, popen2, pwd, stat, sys +import binascii, copy, difflib, grp, logging, lxml.etree, os, popen2, pwd, stat, sys def calcPerms(initial, perms): '''This compares ondisk permissions with specified ones''' @@ -43,7 +43,7 @@ class Toolset(object): '''The toolset class contains underlying command support and all states''' __important__ = [] __name__ = 'Toolset' - pkgtool = ('echo', ('%s', ['name'])) + pkgtool = {'echo': ('%s', ['name'])} def __init__(self, cfg, setup): '''Install initial configs, and setup state structures''' @@ -395,6 +395,9 @@ class Toolset(object): # file does not exist return False contentStatus = content == tempdata + if not contentStatus: + diff = '\n'.join([x for x in difflib.unified_diff(content.split('\n'), tempdata.split('\n'))]) + entry.set("current_diff", diff) return contentStatus and permissionStatus def InstallConfigFile(self, entry): -- cgit v1.2.3-1-g7c22