From cbf331efad0597d0843518ea4a685f27750cfeba Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 9 Sep 2009 22:42:58 +0000 Subject: POSIXCompat: Change name of Compat plugin to POSIXCompat Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5425 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/POSIX.py | 11 +++++------ src/lib/Server/Plugins/Compat.py | 37 ----------------------------------- src/lib/Server/Plugins/POSIXCompat.py | 37 +++++++++++++++++++++++++++++++++++ src/lib/Server/Plugins/__init__.py | 34 +++++++++++++++++++++++++++----- 4 files changed, 71 insertions(+), 48 deletions(-) delete mode 100644 src/lib/Server/Plugins/Compat.py create mode 100644 src/lib/Server/Plugins/POSIXCompat.py (limited to 'src') diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py index 610305a09..81471f910 100644 --- a/src/lib/Client/Tools/POSIX.py +++ b/src/lib/Client/Tools/POSIX.py @@ -79,12 +79,11 @@ def isString(strng): class POSIX(Bcfg2.Client.Tools.Tool): '''POSIX File support code''' name = 'POSIX' - __handles__ = [('ConfigFile', None), ('ConfigFile', 'Compat'), - ('Directory', None), ('Path', 'ConfigFile'), - ('Path', 'Device'), ('Path', 'Directory'), - ('Path', 'HardLink'), ('Path', 'Perms'), - ('Path', 'SymLink'), ('Permissions', None), - ('SymLink', None)] + __handles__ = [('ConfigFile', None), ('Directory', None), + ('Path', 'ConfigFile'), ('Path', 'Device'), + ('Path', 'Directory'), ('Path', 'HardLink'), + ('Path', 'Perms'), ('Path', 'SymLink'), + ('Permissions', None), ('SymLink', None)] __req__ = {'ConfigFile': ['name', 'owner', 'group', 'perms'], 'Directory': ['name', 'owner', 'group', 'perms'], 'Path': ['name', 'type'], diff --git a/src/lib/Server/Plugins/Compat.py b/src/lib/Server/Plugins/Compat.py deleted file mode 100644 index bf0ea6bc7..000000000 --- a/src/lib/Server/Plugins/Compat.py +++ /dev/null @@ -1,37 +0,0 @@ -''' - 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 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 = entry.get('type') - del entry.attrib['type'] - # FIXME: use another attribute? old clients only - # know about type=None - #entry.set('type', 'Compat') - goal.replace(oldentry, entry) 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) diff --git a/src/lib/Server/Plugins/__init__.py b/src/lib/Server/Plugins/__init__.py index 88f84e536..127035919 100644 --- a/src/lib/Server/Plugins/__init__.py +++ b/src/lib/Server/Plugins/__init__.py @@ -1,8 +1,32 @@ '''imports for Bcfg2.Server.Plugins''' __revision__ = '$Revision$' -__all__ = ['Account', 'Base', 'Bundler', 'Cfg', 'Compat', 'Decisions', - 'GBundler', 'Git', 'Hostbase', 'Metadata', 'NagiosGen', 'Packages', - 'Properties', 'Probes', 'Pkgmgr', 'Rules', 'SSHbase', 'Snapshots', - 'Statistics', 'Svcmgr', 'Svn', 'TCheetah', 'Trigger', 'SGenshi', - 'TGenshi', 'GroupPatterns', 'Ohai'] +__all__ = [ + 'Account', + 'Base', + 'Bundler', + 'Cfg', + 'Decisions', + 'GBundler', + 'Git', + 'GroupPatterns', + 'Hostbase', + 'Metadata', + 'NagiosGen', + 'Ohai', + 'Packages', + 'Properties', + 'Probes', + 'Pkgmgr', + 'POSIXCompat', + 'Rules', + 'SSHbase', + 'Snapshots', + 'Statistics', + 'Svcmgr', + 'Svn', + 'TCheetah', + 'Trigger', + 'SGenshi', + 'TGenshi', + ] -- cgit v1.2.3-1-g7c22