Revision 5b263ed7 lib/config.py
b/lib/config.py | ||
---|---|---|
43 | 43 |
from ganeti import rpc |
44 | 44 |
from ganeti import objects |
45 | 45 |
from ganeti import serializer |
46 |
from ganeti import ssconf |
|
47 | 46 |
|
48 | 47 |
|
49 | 48 |
_config_lock = locking.SharedLock() |
50 | 49 |
|
51 | 50 |
|
52 |
def ValidateConfig(): |
|
53 |
sstore = ssconf.SimpleStore() |
|
54 |
|
|
55 |
if sstore.GetConfigVersion() != constants.CONFIG_VERSION: |
|
51 |
def _ValidateConfig(data): |
|
52 |
if data.version != constants.CONFIG_VERSION: |
|
56 | 53 |
raise errors.ConfigurationError("Cluster configuration version" |
57 | 54 |
" mismatch, got %s instead of %s" % |
58 |
(sstore.GetConfigVersion(),
|
|
55 |
(data.version,
|
|
59 | 56 |
constants.CONFIG_VERSION)) |
60 | 57 |
|
61 | 58 |
|
... | ... | |
840 | 837 |
# data is current, so skip loading of config file |
841 | 838 |
return |
842 | 839 |
|
843 |
# Make sure the configuration has the right version |
|
844 |
ValidateConfig() |
|
845 |
|
|
846 | 840 |
f = open(self._cfg_file, 'r') |
847 | 841 |
try: |
848 | 842 |
try: |
... | ... | |
851 | 845 |
raise errors.ConfigurationError(err) |
852 | 846 |
finally: |
853 | 847 |
f.close() |
848 |
|
|
849 |
# Make sure the configuration has the right version |
|
850 |
_ValidateConfig(data) |
|
851 |
|
|
854 | 852 |
if (not hasattr(data, 'cluster') or |
855 | 853 |
not hasattr(data.cluster, 'rsahostkeypub')): |
856 | 854 |
raise errors.ConfigurationError("Incomplete configuration" |
Also available in: Unified diff