From 1affc07c26fad2528a5847a77db33a9baabb9fc8 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Sun, 11 Jan 2009 16:36:27 +0000 Subject: Split pull functionality into PullSource/PullTarget and rebase Cfg and SSHbase on PullTarget git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5011 ce84e21b-d406-0410-9b95-82705330c041 --- doc/plugin-roles | 19 ++++++++++++++++--- src/lib/Server/Admin/Pull.py | 2 +- src/lib/Server/Plugin.py | 17 +++++++++-------- src/lib/Server/Plugins/Cfg.py | 2 +- src/lib/Server/Plugins/SSHbase.py | 2 +- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/doc/plugin-roles b/doc/plugin-roles index 5552c0545..8cb6fb76c 100644 --- a/doc/plugin-roles +++ b/doc/plugin-roles @@ -12,13 +12,14 @@ This documents available plugin roles. | Generator | Generator | done | | Goals Val | GoalValidator | done | | Statistics | Statistics | class defined | -| Pull | PullSource | done | +| Pull Source | PullSource | class defined | +| Pull Target | PullTarget | done | | Decision | Decision | done | | Remote | Remote | none | | Syncing | Syncing | none | |---------------+--------------------+---------------| -2) Plugin Functions +2) Plugin Capabilities * Metadata ** Initial metadata construction @@ -28,11 +29,19 @@ This documents available plugin roles. * Connector ** Provide additional data for ClientMetadata instances * Probing +** send executable probes to clients and receive data responses * Structure +** Produce a list of configuration entries that should be included in + client configurations * Structure Validation +** Validate a client entry list's internal consistency, modifying if needed * Generator * Goals Validation -* Pull +** Validate client goals, modifying if needed +* Pull Source +** Plugin can provide entry information about clients +* Pull Target +** Plugin can accept entry data and merge it into the specification * Decision 3) Configuration of plugins @@ -62,5 +71,9 @@ pairs included with metadata is now available as metadata.Probes way, they will likewise change names to metadata.Properties from their current name. +Plugin configuration will change. A single field "plugins" in +bcfg2.conf will supercede the combination of the "generators" and +"structures" fields. + 5) Notes * Need to fix host specific probe behavior (with basenames) diff --git a/src/lib/Server/Admin/Pull.py b/src/lib/Server/Admin/Pull.py index 60f528c1d..2a6432f22 100644 --- a/src/lib/Server/Admin/Pull.py +++ b/src/lib/Server/Admin/Pull.py @@ -98,7 +98,7 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): self.errExit("Got wrong numbers of matching generators for entry:" \ + "%s" % ([g.name for g in glist])) plugin = glist[0] - if not isinstance(plugin, Bcfg2.Server.Plugin.PullSource): + if not isinstance(plugin, Bcfg2.Server.Plugin.PullTarget): self.errExit("Configuration upload not supported by plugin %s" \ % (plugin.name)) try: diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 35af42355..ccdb9d631 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -58,14 +58,6 @@ class Generator(object): '''This is the slow-path handler for configuration entry binding''' raise PluginExecutionError - def AcceptChoices(self, entry, metadata): - raise PluginExecutionError - - def AcceptPullData(self, specific, new_entry, verbose): - '''This is the null per-plugin implementation - of bcfg2-admin pull''' - raise PluginExecutionError - class Structure(object): '''Structure Plugins contribute to abstract client configurations''' def BuildStructures(self, metadata): @@ -122,6 +114,15 @@ class PullSource(object): def GetCurrentEntry(self, client, e_type, e_name): raise PluginExecutionError +class PullTarget(object): + def AcceptChoices(self, entry, metadata): + raise PluginExecutionError + + def AcceptPullData(self, specific, new_entry, verbose): + '''This is the null per-plugin implementation + of bcfg2-admin pull''' + raise PluginExecutionError + class Decision(object): '''Signal decision handling capability''' def GetDecisions(self, metadata, mode): diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py index 9bf1ed4bd..85ace20bc 100644 --- a/src/lib/Server/Plugins/Cfg.py +++ b/src/lib/Server/Plugins/Cfg.py @@ -126,7 +126,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet): logger.info("Wrote file %s" % infofile.name) class Cfg(Bcfg2.Server.Plugin.GroupSpool, - Bcfg2.Server.Plugin.PullSource): + Bcfg2.Server.Plugin.PullTarget): '''This generator in the configuration file repository for bcfg2''' name = 'Cfg' __version__ = '$Id$' diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index 40f2cb721..edebd0899 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -7,7 +7,7 @@ import Bcfg2.Server.Plugin class SSHbase(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Generator, Bcfg2.Server.Plugin.DirectoryBacked, - Bcfg2.Server.Plugin.PullSource): + Bcfg2.Server.Plugin.PullTarget): '''The sshbase generator manages ssh host keys (both v1 and v2) for hosts. It also manages the ssh_known_hosts file. It can integrate host keys from other management domains and similarly -- cgit v1.2.3-1-g7c22