From 648e41966848d7d469165bbe1f4a26b720ec3ed0 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Sat, 30 Oct 2010 10:16:20 +0100 Subject: [PATCH] Add ConfigWriter.GetNodeGroup Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/config.py b/lib/config.py index fad978df5..c5d1a6ab0 100644 --- a/lib/config.py +++ b/lib/config.py @@ -876,6 +876,21 @@ class ConfigWriter: return nodegroup.uuid raise errors.OpPrereqError("Nodegroup '%s' not found", target) + @locking.ssynchronized(_config_lock, shared=1) + def GetNodeGroup(self, uuid): + """Lookup a node group. + + @type uuid: string + @param uuid: group UUID + @rtype: L{objects.NodeGroup} or None + @return: nodegroup object, or None if not found + + """ + if uuid not in self._config_data.nodegroups: + return None + + return self._config_data.nodegroups[uuid] + @locking.ssynchronized(_config_lock, shared=1) def GetAllNodeGroupsInfo(self): """Get the configuration of all node groups. -- GitLab