diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-02-02 16:38:01 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-02-02 16:38:01 +0000 |
commit | 67ea84767b1c06c9efd0449f435cae103cb03fb0 (patch) | |
tree | b08b4ed7cb02086993034879122f978780fcb71d | |
parent | 527fa203685fc8c93f6094f8cfe61ff4a39f1e2e (diff) | |
download | bcfg2-67ea84767b1c06c9efd0449f435cae103cb03fb0.tar.gz bcfg2-67ea84767b1c06c9efd0449f435cae103cb03fb0.tar.bz2 bcfg2-67ea84767b1c06c9efd0449f435cae103cb03fb0.zip |
Split out connector interface to allow for additional data generation based on complete group list
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5055 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | doc/1.0-roadmap | 4 | ||||
-rw-r--r-- | src/lib/Server/Core.py | 8 | ||||
-rw-r--r-- | src/lib/Server/Plugin.py | 12 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Metadata.py | 6 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Probes.py | 8 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Properties.py | 5 |
6 files changed, 26 insertions, 17 deletions
diff --git a/doc/1.0-roadmap b/doc/1.0-roadmap index 6078494d7..45814ba95 100644 --- a/doc/1.0-roadmap +++ b/doc/1.0-roadmap @@ -9,20 +9,20 @@ server. *** make out of tree plugins work *** properties switch to connector plugin *** Version Control Backend +*** Change to mode attribute for services ** Left *** Fix the POSIX path problem *** Clean up client/server statistics data format *** Multithreaded server (sync from Cobalt) *** Reporting System and Database +*** add support for pre/post connectors **** Schema fixes **** Performance - * Other Goals ** ticket triage ** bind failure annotations ** plugin self-bootstrap (get out of bcfg2-admin init) ** core plugin filtering (for bcfg2-admin & co) -** Change to mode attribute for services *** Document * Pie in the sky diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 120835a65..c57e983f8 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -232,10 +232,12 @@ class Core(object): def build_metadata(self, client_name): imd = self.metadata.get_initial_metadata(client_name) for conn in self.connectors: - grps, data = conn.get_additional_metadata(imd) - self.metadata.merge_additional_metadata(imd, conn.name, grps, data) + grps = conn.get_additional_groups(imd) + self.metadata.merge_additional_groups(imd, grps) + for conn in self.connectors: + data = conn.get_additional_data(imd) + self.metadata.merge_additional_data(imd, conn.name, data) return imd - def process_statistics(self, client_name, statistics): meta = self.build_metadata(client_name) diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 21699657f..a1d82200a 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -83,10 +83,14 @@ class Metadata(object): raise PluginExecutionError class Connector(object): - '''MetadataConnectorPlugins augment client metadata instances''' - def get_additional_metadata(self, metadata): - '''determine additional ([groups], {k:v}) for metadata''' - return (list(), dict()) + '''Connector Plugins augment client metadata instances''' + def get_additional_groups(self, metadata): + '''determine additional groups for metadata''' + return list() + + def get_additional_data(self, metadata): + '''determine additional data for metadata inst''' + return dict() class Probing(object): '''Signal probe capability for this plugin''' diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py index df7e3ddf2..f63e2d558 100644 --- a/src/lib/Server/Plugins/Metadata.py +++ b/src/lib/Server/Plugins/Metadata.py @@ -395,7 +395,7 @@ class Metadata(Bcfg2.Server.Plugin.Plugin, newcategories, uuid, password, (groupscopy, clientscopy)) - def merge_additional_metadata(self, imd, source, groups, data): + def merge_additional_groups(self, imd, groups): for group in groups: if group in self.categories and \ self.categories[group] in imd.categories: @@ -410,9 +410,11 @@ class Metadata(Bcfg2.Server.Plugin.Plugin, self.categories[g] in imd.categories: continue imd.groups.append(g) + + def merge_additional_data(self, imd, source, data): if not hasattr(imd, source): setattr(imd, source, data) - imd.connectors.append(source) + imd.connectors.append(source) def AuthenticateConnection(self, user, password, address): '''This function checks user and password''' diff --git a/src/lib/Server/Plugins/Probes.py b/src/lib/Server/Plugins/Probes.py index 10b729fde..f2973169b 100644 --- a/src/lib/Server/Plugins/Probes.py +++ b/src/lib/Server/Plugins/Probes.py @@ -139,6 +139,8 @@ class Probes(Bcfg2.Server.Plugin.Plugin, except KeyError: self.probedata[client.hostname] = { data.get('name'):dtext } - def get_additional_metadata(self, meta): - return (self.cgroups.get(meta.hostname, list()), - self.probedata.get(meta.hostname, dict())) + def get_additional_groups(self, meta): + return self.cgroups.get(meta.hostname, list()) + + def get_additional_data(self, meta): + return self.probedata.get(meta.hostname, dict()) diff --git a/src/lib/Server/Plugins/Properties.py b/src/lib/Server/Plugins/Properties.py index 2692c742e..87fcc16d3 100644 --- a/src/lib/Server/Plugins/Properties.py +++ b/src/lib/Server/Plugins/Properties.py @@ -20,11 +20,10 @@ class Properties(Bcfg2.Server.Plugin.Plugin, version = '$Revision: $' experimental = True - def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) Bcfg2.Server.Plugin.Connector.__init__(self) self.store = PropDirectoryBacked(self.data, core.fam) - def get_additional_metadata(self, _): - return ((), copy.deepcopy(self.store.entries)) + def get_additional_data(self, _): + return copy.deepcopy(self.store.entries) |