summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Client/Tools/POSIX.py16
-rw-r--r--src/lib/Server/Plugin.py3
-rw-r--r--src/lib/Server/Plugins/Compat.py32
-rw-r--r--src/lib/Server/Plugins/__init__.py10
4 files changed, 51 insertions, 10 deletions
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py
index bfbe79066..bc9626e88 100644
--- a/src/lib/Client/Tools/POSIX.py
+++ b/src/lib/Client/Tools/POSIX.py
@@ -79,11 +79,11 @@ def isString(strng):
class POSIX(Bcfg2.Client.Tools.Tool):
'''POSIX File support code'''
name = 'POSIX'
- __handles__ = [('ConfigFile', None), ('Directory', None),
- ('Path', 'ConfigFile'), ('Path', 'Device'),
- ('Path', 'Directory'), ('Path', 'Perms'),
- ('Path', 'SymLink'), ('Permissions', None),
- ('SymLink', None)]
+ __handles__ = [('ConfigFile', None), ('ConfigFile', 'Compat'),
+ ('Directory', None), ('Path', 'ConfigFile'),
+ ('Path', 'Device'), ('Path', 'Directory'),
+ ('Path', 'Perms'), ('Path', 'SymLink'),
+ ('Permissions', None), ('SymLink', None)]
__req__ = {'ConfigFile': ['name', 'owner', 'group', 'perms'],
'Directory': ['name', 'owner', 'group', 'perms'],
'Path': ['name', 'type'],
@@ -149,6 +149,12 @@ class POSIX(Bcfg2.Client.Tools.Tool):
except OSError:
return False
+ def VerifyDevice(self, entry, _):
+ return False
+
+ def InstallDevice(self, entry):
+ return False
+
def VerifyDirectory(self, entry, modlist):
'''Verify Directory Entry'''
while len(entry.get('perms', '')) < 4:
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index 5289dad56..6c6d5aab3 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -708,6 +708,7 @@ class GroupSpool(Plugin, Generator):
if self.data[-1] == '/':
self.data = self.data[:-1]
self.Entries['ConfigFile'] = {}
+ self.Entries['Path'] = {}
self.entries = {}
self.handles = {}
self.AddDirectoryMonitor('')
@@ -735,6 +736,7 @@ class GroupSpool(Plugin, Generator):
self.es_child_cls,
self.encoding)
self.Entries['ConfigFile'][ident] = self.entries[ident].bind_entry
+ self.Entries['Path'][ident] = self.entries[ident].bind_entry
if not posixpath.isdir(epath):
# do not pass through directory events
self.entries[ident].handle_event(event)
@@ -746,6 +748,7 @@ class GroupSpool(Plugin, Generator):
# a directory was deleted
del self.entries[fbase]
del self.Entries['ConfigFile'][fbase]
+ del self.Entries['Path'][fbase]
else:
self.entries[ident].handle_event(event)
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)
diff --git a/src/lib/Server/Plugins/__init__.py b/src/lib/Server/Plugins/__init__.py
index 0d54fc873..88f84e536 100644
--- a/src/lib/Server/Plugins/__init__.py
+++ b/src/lib/Server/Plugins/__init__.py
@@ -1,8 +1,8 @@
'''imports for Bcfg2.Server.Plugins'''
__revision__ = '$Revision$'
-__all__ = ['Account', 'Base', 'Bundler', 'Cfg', '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', 'Compat', 'Decisions',
+ 'GBundler', 'Git', 'Hostbase', 'Metadata', 'NagiosGen', 'Packages',
+ 'Properties', 'Probes', 'Pkgmgr', 'Rules', 'SSHbase', 'Snapshots',
+ 'Statistics', 'Svcmgr', 'Svn', 'TCheetah', 'Trigger', 'SGenshi',
+ 'TGenshi', 'GroupPatterns', 'Ohai']