diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-09-09 22:42:58 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-09-09 22:42:58 +0000 |
commit | cbf331efad0597d0843518ea4a685f27750cfeba (patch) | |
tree | af2e2ea5108569d3a69f1e85611616c597bb26f5 /src/lib/Server/Plugins/POSIXCompat.py | |
parent | fce273a0e8fda3776d917f3f254b566a08c31ceb (diff) | |
download | bcfg2-cbf331efad0597d0843518ea4a685f27750cfeba.tar.gz bcfg2-cbf331efad0597d0843518ea4a685f27750cfeba.tar.bz2 bcfg2-cbf331efad0597d0843518ea4a685f27750cfeba.zip |
POSIXCompat: Change name of Compat plugin to POSIXCompat
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5425 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/POSIXCompat.py')
-rw-r--r-- | src/lib/Server/Plugins/POSIXCompat.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/Server/Plugins/POSIXCompat.py b/src/lib/Server/Plugins/POSIXCompat.py new file mode 100644 index 000000000..9964bf1f5 --- /dev/null +++ b/src/lib/Server/Plugins/POSIXCompat.py @@ -0,0 +1,37 @@ +''' + This plugin provides a compatibility layer which turns new-style + POSIX entries into old-style entries. +''' +__revision__ = '$Revision$' + +import Bcfg2.Server.Plugin + +# FIXME: We will need this mapping if we decide to change the +# specification to use lowercase types for new POSIX entry types +#COMPAT_DICT = {'configfile': 'ConfigFile', +# 'device': 'Device', +# 'directory': 'Directory', +# 'permissions': 'Permissions', +# 'symlink': 'SymLink'} + +class POSIXCompat(Bcfg2.Server.Plugin.Plugin, + Bcfg2.Server.Plugin.GoalValidator): + name = 'POSIXCompat' + __version__ = '$Id$' + __author__ = 'bcfg-dev@mcs.anl.gov' + + def __init__(self, core, datastore): + Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) + Bcfg2.Server.Plugin.GoalValidator.__init__(self) + + def validate_goals(self, metadata, goals): + for goal in goals: + for entry in goal.getchildren(): + if entry.tag == 'Path': + oldentry = entry + entry.tag = entry.get('type') + del entry.attrib['type'] + # FIXME: use another attribute? old clients only + # know about type=None + #entry.set('type', 'POSIXCompat') + goal.replace(oldentry, entry) |