summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Brestick <brestick@mcs.anl.gov>2008-06-26 18:56:15 +0000
committerAndrew Brestick <brestick@mcs.anl.gov>2008-06-26 18:56:15 +0000
commitba259ca4de0b77e20c5e8e948119b2ac98bd385a (patch)
tree0fc2966f97de158d1680eee6ffcdabc565aebfd2
parenta208e0eb1b2ff91191f58eb0ffcac8cc36d3dec5 (diff)
downloadbcfg2-ba259ca4de0b77e20c5e8e948119b2ac98bd385a.tar.gz
bcfg2-ba259ca4de0b77e20c5e8e948119b2ac98bd385a.tar.bz2
bcfg2-ba259ca4de0b77e20c5e8e948119b2ac98bd385a.zip
fix alias issues in metadata plugin and in bcfg2-admin client mode
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4721 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Admin/Client.py3
-rw-r--r--src/lib/Server/Plugins/Metadata.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Server/Admin/Client.py b/src/lib/Server/Admin/Client.py
index c4f931350..618e5b826 100644
--- a/src/lib/Server/Admin/Client.py
+++ b/src/lib/Server/Admin/Client.py
@@ -72,4 +72,7 @@ class Client(Bcfg2.Server.Admin.Mode):
for node in self.root:
if node.attrib["name"] == client:
return node
+ for child in node:
+ if child.tag == "Alias" and child.attrib["name"] == client:
+ return node
return None
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index 9f8b641cc..a5084e0d3 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -246,7 +246,12 @@ class Metadata(Bcfg2.Server.Plugin.MetadataPlugin,
if profile not in self.public:
self.logger.error("Failed to set client %s to private group %s" % (client, profile))
raise MetadataConsistencyError
- if self.clients.has_key(client):
+ # resolve aliases
+ for node in self.clients:
+ for child in node:
+ if child.tag == "Alias" and child.attrib["name"] == client:
+ client = node.attrib["name"]
+ if self.clients.has_key(client):
self.logger.info("Changing %s group from %s to %s" % (client, self.clients[client], profile))
cli = self.clientdata.xpath('.//Clients/Client[@name="%s"]' % (client))
cli[0].set('profile', profile)