diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-09-07 01:54:44 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-09-07 01:54:44 +0000 |
commit | f431b4b08bf2e0b28225bfdf84f62aa2a8aa9bbb (patch) | |
tree | d9375a98a21eb3991e9039fba5fc6cd3eda3de9a /src/lib/Server/Plugins/Compat.py | |
parent | 869f3f2cc0fabdb46e2e0863d830b7d8525c13ee (diff) | |
download | bcfg2-f431b4b08bf2e0b28225bfdf84f62aa2a8aa9bbb.tar.gz bcfg2-f431b4b08bf2e0b28225bfdf84f62aa2a8aa9bbb.tar.bz2 bcfg2-f431b4b08bf2e0b28225bfdf84f62aa2a8aa9bbb.zip |
POSIX: Add support for unified Path entries
This commit adds support for a new Path entry which unifies all the
various POSIX entry types. A new plugin is included which will allow you
to transform new Path entries back into their old format (for
compatibility with old clients).
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5414 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/Compat.py')
-rw-r--r-- | src/lib/Server/Plugins/Compat.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/Server/Plugins/Compat.py b/src/lib/Server/Plugins/Compat.py new file mode 100644 index 000000000..c68e7181c --- /dev/null +++ b/src/lib/Server/Plugins/Compat.py @@ -0,0 +1,32 @@ +''' + This plugin provides a compatibility layer which turns new-style + POSIX entries into old-style entries. +''' +__revision__ = '$Revision:$' + +import Bcfg2.Server.Plugin + +COMPAT_DICT = {'configfile': 'ConfigFile', + 'device': 'Device', + 'directory': 'Directory', + 'permissions': 'Permissions', + 'symlink': 'SymLink'} + +class Compat(Bcfg2.Server.Plugin.Plugin, + Bcfg2.Server.Plugin.GoalValidator): + name = 'Compat' + __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 = COMPAT_DICT['%s' % entry.get('type')] + entry.set('type', 'Compat') + goal.replace(oldentry, entry) |