summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Schwager <schwag09@gmail.com>2012-10-10 12:26:48 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-02-12 08:35:32 -0500
commit2ad656a8b9fe4fd364dff3a4f6e419699438c714 (patch)
treeb1ff88468e89d6588896b1191ebc27b29f9c5002
parent1ce53cdcd4803d4b0c3c9440ec352addf534bd67 (diff)
downloadbcfg2-2ad656a8b9fe4fd364dff3a4f6e419699438c714.tar.gz
bcfg2-2ad656a8b9fe4fd364dff3a4f6e419699438c714.tar.bz2
bcfg2-2ad656a8b9fe4fd364dff3a4f6e419699438c714.zip
Fixed 'event name' error on server startup with ACL as a plugin. Now parsing IP XML file correctly
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Acl.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Acl.py b/src/lib/Bcfg2/Server/Plugins/Acl.py
index 907d2b6a6..61162dfca 100644
--- a/src/lib/Bcfg2/Server/Plugins/Acl.py
+++ b/src/lib/Bcfg2/Server/Plugins/Acl.py
@@ -1,18 +1,35 @@
import os
+import logging
import Bcfg2.Server.Plugin
class AclFile(Bcfg2.Server.Plugin.XMLFileBacked):
""" representation of ACL config.xml """
+ # 'name' error without this tag
+ __identifier__ = None
+
def __init__(self, filename, core=None):
+ # create config.xml if missing
+ if not os.path.exists(filename):
+ LOGGER.warning("Acl: %s missing. "
+ "Creating empty one for you." % filename)
+ open(filename, "w").write("<Acl></Acl>")
+
try:
fam = core.fam
except AttributeError:
fam = None
+
Bcfg2.Server.Plugin.XMLFileBacked.__init__(self, filename, fam=fam,
should_monitor=True)
self.core = core
self.ips = []
+ self.logger = logging.getLogger(self.__class__.__name__)
+
+ def Index(self):
+ Bcfg2.Server.Plugin.XMLFileBacked.Index(self)
+ for entry in self.xdata.xpath('//IPs'):
+ [self.ips.append(i.get('name')) for i in entry.findall('IP')]
class Acl(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.Connector):
@@ -22,3 +39,4 @@ class Acl(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore)
Bcfg2.Server.Plugin.Connector.__init__(self)
self.config = AclFile(os.path.join(self.data, 'config.xml'), core=core)
+