.. in order to get the size of config/__init__ under 3600 lines again.
Signed-off-by: Petr Pudlak <[email protected]>
---
lib/config/__init__.py | 25 ++++---------------------
lib/config/verify.py | 14 ++++++++++++++
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/lib/config/__init__.py b/lib/config/__init__.py
index 257ff48..0e9c0c8 100644
--- a/lib/config/__init__.py
+++ b/lib/config/__init__.py
@@ -40,13 +40,9 @@ much memory.
"""
-# pylint: disable=R0904,C0302
+# pylint: disable=R0904
# R0904: Too many public methods
-# C0302: This module has become too big and should be split up
-# FIXME: This has been added only temporarily as a merge introduced enough
lines
-# to hit the threshold. This will be fixed in a follow-up patch.
-
import copy
import os
import random
@@ -57,7 +53,8 @@ import itertools
from ganeti.config.temporary_reservations import TemporaryReservationManager
from ganeti.config.utils import ConfigSync, ConfigManager
-from ganeti.config.verify import VerifyType, VerifyNic, VerifyIpolicy
+from ganeti.config.verify import (VerifyType, VerifyNic, VerifyIpolicy,
+ ValidateConfig)
from ganeti import errors
from ganeti import utils
@@ -123,20 +120,6 @@ def GetConfig(ec_id, livelock, **kwargs):
_UPGRADE_CONFIG_JID = "jid-cfg-upgrade"
-def _ValidateConfig(data):
- """Verifies that a configuration dict looks valid.
-
- This only verifies the version of the configuration.
-
- @raise errors.ConfigurationError: if the version differs from what
- we expect
-
- """
- if data['version'] != constants.CONFIG_VERSION:
- raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION,
- data['version'])
-
-
def _MatchNameComponentIgnoreCase(short_name, names):
"""Wrapper around L{utils.text.MatchNameComponent}.
@@ -2839,7 +2822,7 @@ class ConfigWriter(object):
raw_data = utils.ReadFile(self._cfg_file)
data_dict = serializer.Load(raw_data)
# Make sure the configuration has the right version
- _ValidateConfig(data_dict)
+ ValidateConfig(data_dict)
data = objects.ConfigData.FromDict(data_dict)
except errors.ConfigVersionMismatch:
raise
diff --git a/lib/config/verify.py b/lib/config/verify.py
index a18b0e0..e53b384 100644
--- a/lib/config/verify.py
+++ b/lib/config/verify.py
@@ -36,6 +36,20 @@ from ganeti import objects
from ganeti import utils
+def ValidateConfig(data):
+ """Verifies that a configuration dict looks valid.
+
+ This only verifies the version of the configuration.
+
+ @raise errors.ConfigurationError: if the version differs from what
+ we expect
+
+ """
+ if data['version'] != constants.CONFIG_VERSION:
+ raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION,
+ data['version'])
+
+
def VerifyType(owner, attr, value, template, callback):
"""Checks if an attribute has correct form.
--
2.4.3.573.g4eafbef