diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-07-10 17:51:06 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-07-10 17:51:06 +0000 |
commit | a50f44d85caefe94a0e15dd5b24232c8af29440c (patch) | |
tree | 12486ca2e6e76bb4230664837e0bcfbde5720c57 /src | |
parent | aecb51a66cada9bcbae27c3f6047050880cffa96 (diff) | |
download | bcfg2-a50f44d85caefe94a0e15dd5b24232c8af29440c.tar.gz bcfg2-a50f44d85caefe94a0e15dd5b24232c8af29440c.tar.bz2 bcfg2-a50f44d85caefe94a0e15dd5b24232c8af29440c.zip |
* 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
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Client/Toolset.py | 7 |
1 files changed, 5 insertions, 2 deletions
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): |