summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Metadata.py
diff options
context:
space:
mode:
authorMichael Fenn <fennm@deshawresearch.com>2013-08-05 19:15:37 -0400
committerMichael Fenn <fennm@deshawresearch.com>2013-08-05 19:15:37 -0400
commit54d86177513c26f52e4aa7947e5bbc8ba91969ff (patch)
tree57fc03f0323d97de27b325581ce06bc056fbd7c2 /src/lib/Bcfg2/Server/Plugins/Metadata.py
parent6c500a1660c8012be88638785d3befcd4564216a (diff)
downloadbcfg2-54d86177513c26f52e4aa7947e5bbc8ba91969ff.tar.gz
bcfg2-54d86177513c26f52e4aa7947e5bbc8ba91969ff.tar.bz2
bcfg2-54d86177513c26f52e4aa7947e5bbc8ba91969ff.zip
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).
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Metadata.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py5
1 files 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)