summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugin.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-07-13 20:08:59 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-07-13 20:08:59 +0000
commit3248a42b83731ff31b6ee3a449421ae0dd06e601 (patch)
tree0ba983b5b2a42c116d968ae8c3c01d561be0de68 /src/lib/Server/Plugin.py
parent3f3257a6a0af296efbfa798bbee053d43648f3c1 (diff)
downloadbcfg2-3248a42b83731ff31b6ee3a449421ae0dd06e601.tar.gz
bcfg2-3248a42b83731ff31b6ee3a449421ae0dd06e601.tar.bz2
bcfg2-3248a42b83731ff31b6ee3a449421ae0dd06e601.zip
bcfg2-admin init: fix traceback (reported by somekool on irc)
Apparently classmethods aren't callable from subclasses if overridden git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5322 ce84e21b-d406-0410-9b95-82705330c041
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'''