summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Server/Plugins/Metadata.py11
-rwxr-xr-xsrc/sbin/bcfg2-info21
2 files changed, 17 insertions, 15 deletions
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index 355624ccc..eacc53f4b 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -14,9 +14,10 @@ class MetadataRuntimeError(Exception):
class ClientMetadata(object):
'''This object contains client metadata'''
- def __init__(self, client, groups, bundles, categories, uuid,
+ def __init__(self, client, profile, groups, bundles, categories, uuid,
password, overall):
self.hostname = client
+ self.profile = profile
self.bundles = bundles
self.groups = groups
self.categories = categories
@@ -358,7 +359,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
if client in self.aliases:
client = self.aliases[client]
if client in self.clients:
- (bundles, groups, categories) = self.groups[self.clients[client]]
+ profile = self.clients[client]
+ (bundles, groups, categories) = self.groups[profile]
else:
if self.default == None:
self.logger.error("Cannot set group for client %s; no default group set" % (client))
@@ -388,8 +390,9 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
newcategories.update(ncategories)
groupscopy = copy.deepcopy(self.groups)
clientscopy = copy.deepcopy(self.clients)
- return ClientMetadata(client, newgroups, newbundles, newcategories,
- uuid, password, (groupscopy, clientscopy))
+ return ClientMetadata(client, profile, newgroups, newbundles,
+ newcategories, uuid, password,
+ (groupscopy, clientscopy))
def merge_additional_metadata(self, imd, source, groups, data):
for group in groups:
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 5c689489b..cd868ef0d 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -211,29 +211,28 @@ Usage: [quit|exit]"""
print "Usage:\nshowclient <client> ... <clientN>"
return
for client in args.split():
- if client not in self.metadata.clients:
+ try:
+ client_meta = self.build_metadata(client)
+ except:
print "Client %s not defined" % client
continue
- profile = self.metadata.clients[client]
- bds, gps, cgs = \
- copy.deepcopy(self.metadata.groups[profile])
- gps.remove(profile)
- numbundles = len(bds)
- numgroups = len(gps)
+
+ numbundles = len(client_meta.bundles)
+ numgroups = len(client_meta.groups)
num = max((numbundles, numgroups))
for i in range(0, num):
if i == 0:
- c = client
- p = profile
+ c = client_meta.hostname
+ p = client_meta.profile
else:
c = ""
p = ""
if i < numbundles:
- b = bds[i]
+ b = client_meta.bundles[i]
else:
b = ""
if i < numgroups:
- g = gps[i]
+ g = client_meta.groups[i]
else:
g = ""
data.append((c, p, g, b))