summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-12-10 16:01:05 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-12-10 16:01:05 +0000
commit2bf2b408e1ea37a47d36d93a8980d1ba1784b123 (patch)
treee15fbbe63891887c5c9263f9d681ca53e4124d23 /src
parentebdbc22d327a6c33794a0b62745bbbcb6893f943 (diff)
downloadbcfg2-2bf2b408e1ea37a47d36d93a8980d1ba1784b123.tar.gz
bcfg2-2bf2b408e1ea37a47d36d93a8980d1ba1784b123.tar.bz2
bcfg2-2bf2b408e1ea37a47d36d93a8980d1ba1784b123.zip
Snapshots: Revert changes from [5582] so that old client compatibility is maintained
Older clients (used via POSIXCompat) still have old-style posix entries. This commits allows for old or new client statistics to be uploaded to the snapshots database. Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5619 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/Snapshots.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/Server/Plugins/Snapshots.py b/src/lib/Server/Plugins/Snapshots.py
index 0da9f6ffc..5ee1e6d62 100644
--- a/src/lib/Server/Plugins/Snapshots.py
+++ b/src/lib/Server/Plugins/Snapshots.py
@@ -14,10 +14,14 @@ import threading
logger = logging.getLogger('Snapshots')
+ftypes = ['ConfigFile', 'SymLink', 'Directory']
datafields = {
'Package': ['version'],
'Path': ['type'],
'Service': ['status'],
+ 'ConfigFile': ['owner', 'group', 'perms'],
+ 'Directory': ['owner', 'group', 'perms'],
+ 'SymLink': ['to'],
}
def build_snap_ent(entry):
@@ -28,7 +32,8 @@ def build_snap_ent(entry):
state = dict([(key, unicode(entry.get(key))) for key in basefields])
desired.update([(key, unicode(entry.get(key))) for key in \
datafields[entry.tag]])
- if (entry.tag == 'Path') and (entry.get('type') == 'file'):
+ if entry.tag == 'ConfigFile' or \
+ ((entry.tag == 'Path') and (entry.get('type') == 'file')):
if entry.text == None:
desired['contents'] = None
else:
@@ -47,7 +52,7 @@ def build_snap_ent(entry):
state.update([(key, unicode(entry.get('current_' + key, entry.get(key)))) \
for key in datafields[entry.tag]])
- if entry.tag == 'Path' and entry.get('exists', 'true') == 'false':
+ if entry.tag in ['ConfigFile', 'Path'] and entry.get('exists', 'true') == 'false':
state = None
return [desired, state]
@@ -91,10 +96,16 @@ class Snapshots(Bcfg2.Server.Plugin.Statistics,
for entry in state.find('.//Bad'):
data = [False, False, unicode(entry.get('name'))] \
+ build_snap_ent(entry)
- etag = entry.tag
+ if entry.tag in ftypes:
+ etag = 'Path'
+ else:
+ etag = entry.tag
entries[etag][entry.get('name')] = data
for entry in state.find('.//Modified'):
- etag = entry.tag
+ if entry.tag in ftypes:
+ etag = 'Path'
+ else:
+ etag = entry.tag
if entry.get('name') in entries[etag]:
data = [True, False, unicode(entry.get('name'))] + \
build_snap_ent(entry)