From 54d86177513c26f52e4aa7947e5bbc8ba91969ff Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Mon, 5 Aug 2013 19:15:37 -0400 Subject: Metadata: Don't update XML on gratuitous profile update Check to see if the profile that is being set by set_profile exactly matches the existing profile list. If it does, then avoid writing out a new clients.xml. This simple optimization reduces the amount of clients.xml rewriting that occurs if you have a bunch of clients running bcfg2 -p at the same time (for example, during a cluster rebuild). --- src/lib/Bcfg2/Server/Plugins/Metadata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py index e8962d707..973acb89a 100644 --- a/src/lib/Bcfg2/Server/Plugins/Metadata.py +++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py @@ -980,9 +980,10 @@ class Metadata(Bcfg2.Server.Plugin.Metadata, profiles = [g for g in self.clientgroups[client] if g in self.groups and self.groups[g].is_profile] - self.logger.info("Changing %s profile from %s to %s" % + if profiles != [profile]: + self.logger.info("Changing %s profile from %s to %s" % (client, profiles, profile)) - self.update_client(client, dict(profile=profile)) + self.update_client(client, dict(profile=profile)) if client in self.clientgroups: for prof in profiles: self.clientgroups[client].remove(prof) -- cgit v1.2.3-1-g7c22