Only upgrade configs not upgraded
authorKlaus Aehlig <aehlig@google.com>
Wed, 6 May 2015 10:16:53 +0000 (12:16 +0200)
committerKlaus Aehlig <aehlig@google.com>
Wed, 6 May 2015 12:10:25 +0000 (14:10 +0200)
Whenever we set a configuration, we also upgrade it.
In particular, there is no need for an unconditional upgrade;
so avoid upgrading the configuration over and over again
if it did not change.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

lib/config.py

index da0a007..fc5a11a 100644 (file)
@@ -2824,13 +2824,10 @@ class ConfigWriter(object):
       try:
         if dict_data is not None:
           self._SetConfigData(objects.ConfigData.FromDict(dict_data))
+          self._UpgradeConfig()
       except Exception, err:
         raise errors.ConfigurationError(err)
 
-      # Transitional fix until ConfigWriter is completely rewritten into
-      # Haskell
-      self._UpgradeConfig()
-
   def _CloseConfig(self, save):
     """Release resources relating the config data.