diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-03-15 22:08:17 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-03-15 22:08:17 +0000 |
commit | 8bff8d27a04a6556155195dadc97952eb36f5104 (patch) | |
tree | b0a0a6bbdbfe04f6d08cc888d714b756a61a1c15 /src/lib/Server/Plugins/Metadata.py | |
parent | 335fc58ef962575103af2bb5a98610be1e3f501f (diff) | |
download | bcfg2-8bff8d27a04a6556155195dadc97952eb36f5104.tar.gz bcfg2-8bff8d27a04a6556155195dadc97952eb36f5104.tar.bz2 bcfg2-8bff8d27a04a6556155195dadc97952eb36f5104.zip |
Implement client profile remapping (May resolve Ticket #392)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2943 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/Metadata.py')
-rw-r--r-- | src/lib/Server/Plugins/Metadata.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py index 6f4581daa..81fcba223 100644 --- a/src/lib/Server/Plugins/Metadata.py +++ b/src/lib/Server/Plugins/Metadata.py @@ -47,6 +47,7 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): self.profiles = [] self.toolsets = {} self.categories = {} + self.bad_clients = {} self.clientdata = None self.default = None try: @@ -90,6 +91,7 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): if dest == 'clients.xml': self.clients = {} self.aliases = {} + self.bad_clients = {} self.clientdata = xdata for client in xdata.findall('.//Client'): if 'address' in client.attrib: @@ -145,11 +147,17 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): # check that all client groups are real and complete real = self.groups.keys() for client in self.clients.keys(): - if self.clients[client] not in real or self.clients[client] not in self.profiles: + if self.clients[client] not in self.profiles: self.logger.error("Client %s set as nonexistant or incomplete group %s" \ % (client, self.clients[client])) self.logger.error("Removing client mapping for %s" % (client)) + self.bad_clients[client] = self.clients[client] del self.clients[client] + for bclient in self.bad_clients.keys(): + if self.bad_clients[bclient] in self.profiles: + self.logger.info("Restored profile mapping for client %s" % bclient) + self.clients[bclient] = self.bad_clients[bclient] + del self.bad_clients[bclient] def set_profile(self, client, profile): '''Set group parameter for provided client''' |