summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2012-10-15 13:50:23 -0500
committerSol Jerome <sol.jerome@gmail.com>2012-10-15 13:50:23 -0500
commite88ef5ad2db84aa2664330096881a4d627d62b8c (patch)
tree064f76b2a50ca08c549ef4ff1d4abb3a3316f27c /src/lib/Bcfg2/Server
parentca1237602fff7678041e8c338b067453c267712d (diff)
downloadbcfg2-e88ef5ad2db84aa2664330096881a4d627d62b8c.tar.gz
bcfg2-e88ef5ad2db84aa2664330096881a4d627d62b8c.tar.bz2
bcfg2-e88ef5ad2db84aa2664330096881a4d627d62b8c.zip
POSIXCompat: Revive compatibility plugin for POSIX
This plugin adds back the perms attribute for older client compatibility. Can be removed in a future release. Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Bcfg2/Server')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/POSIXCompat.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py b/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py
new file mode 100644
index 000000000..9b9d33337
--- /dev/null
+++ b/src/lib/Bcfg2/Server/Plugins/POSIXCompat.py
@@ -0,0 +1,22 @@
+"""This plugin provides a compatibility layer which turns new-style
+POSIX entries into old-style entries.
+"""
+
+import Bcfg2.Server.Plugin
+
+
+class POSIXCompat(Bcfg2.Server.Plugin.Plugin,
+ Bcfg2.Server.Plugin.GoalValidator):
+ """POSIXCompat is a goal validator plugin for POSIX entries."""
+ name = 'POSIXCompat'
+
+ 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):
+ """Verify that we are generating correct old POSIX entries."""
+ for goal in goals:
+ for entry in goal.getchildren():
+ if entry.tag == 'Path' and 'mode' in entry.keys():
+ entry.set('perms', entry.get('mode'))