summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-06-29 18:29:36 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-06-29 18:29:36 +0000
commit8d246f5d3b63d374fed871d4520028cf3662c4d3 (patch)
treebcf62491f27b249bc4e34196ccdbea54427f2a86 /src
parente69cb66755ea0123df448387cc8b9240df5f7c32 (diff)
downloadbcfg2-8d246f5d3b63d374fed871d4520028cf3662c4d3.tar.gz
bcfg2-8d246f5d3b63d374fed871d4520028cf3662c4d3.tar.bz2
bcfg2-8d246f5d3b63d374fed871d4520028cf3662c4d3.zip
Metadata: implement get_clients/get_groups interface
Add method to get list of all group names, change all client interface to match. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5302 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/Metadata.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index 906a16fac..dc3052015 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -36,12 +36,13 @@ class ClientMetadata(object):
return group in self.groups
class MetadataQuery(object):
- def __init__(self, get_clients, by_groups, by_profiles):
+ def __init__(self, get_clients, by_groups, by_profiles, all_groups):
# resolver is set later
self.by_name = None
self.names_by_groups = by_groups
self.names_by_profiles = by_profiles
- self.all_names = get_clients
+ self.all_clients = get_clients
+ self.all_groups = all_groups
def by_groups(self, groups):
return [self.by_name(name) for name in self.names_by_groups(groups)]
@@ -95,7 +96,8 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
self.password = core.password
self.query = MetadataQuery(lambda:self.clients.keys(),
self.get_client_names_by_groups,
- self.get_client_names_by_profiles)
+ self.get_client_names_by_profiles,
+ self.get_all_group_names)
def get_groups(self):
'''return groups xml tree'''
@@ -413,6 +415,9 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
newcategories.update(ncategories)
return ClientMetadata(client, profile, newgroups, newbundles, addresses,
newcategories, uuid, password, self.query)
+
+ def get_all_group_names(self):
+ return self.groups.keys()
def get_client_names_by_profiles(self, profiles):
return [client for client, profile in self.clients.iteritems() \