summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugin.py')
-rw-r--r--src/lib/Server/Plugin.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index 269508b13..829ab64fd 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -4,6 +4,7 @@ __revision__ = '$Revision$'
import copy
import logging
import lxml.etree
+import os
import posixpath
import re
@@ -62,17 +63,21 @@ class Plugin(object):
self.core = core
self.data = "%s/%s" % (datastore, self.name)
self.logger = logging.getLogger('Bcfg2.Plugins.%s' % (self.name))
+
+ @staticmethod
+ def make_path(path):
+ p_comp = path.split('/')
+ for i in range(2, len(p_comp) + 1):
+ ppath = '/' + '/'.join(p_comp[1:i])
+ try:
+ os.stat(ppath)
+ except:
+ os.mkdir(ppath)
@classmethod
- def init_repo(self, repo):
- path = "%s/%s" % (repo, self.name)
- newpath = ''
- for subdir in path.split('/'):
- newpath = newpath + subdir + '/'
- try:
- os.mkdir(newpath)
- except:
- return
+ def init_repo(cls, repo):
+ path = "%s/%s" % (repo, cls.name)
+ cls.make_path(path)
class Generator(object):
'''Generator plugins contribute to literal client configurations'''