Commit fd7baa38 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

Merge branch 'trac435'

parents ce14d5ca 32e9990a
......@@ -61,8 +61,6 @@ def main():
except ConfigManagerDataReadError as cmdre:
print("[b10-cfgmgr] " + str(cmdre))
return 2
if cm:
return cm.write_config()
return 0
if __name__ == "__main__":
......
......@@ -58,7 +58,8 @@ class TestConfigManagerStartup(unittest.TestCase):
self.assertTrue(b.cm.read_config_called)
self.assertTrue(b.cm.notify_boss_called)
self.assertTrue(b.cm.run_called)
self.assertTrue(b.cm.write_config_called)
# if there are no changes, config is not written
self.assertFalse(b.cm.write_config_called)
self.assertTrue(b.cm.running)
b.signal_handler(None, None)
......
......@@ -26,6 +26,7 @@ import os
import copy
import tempfile
import json
import errno
from isc.cc import data
from isc.config import ccsession, config_data
......@@ -87,7 +88,12 @@ class ConfigManagerData:
else:
raise ConfigManagerDataReadError("No version information in configuration file " + config.db_filename)
except IOError as ioe:
raise ConfigManagerDataEmpty("No configuration file found")
# if IOError is 'no such file or directory', then continue
# (raise empty), otherwise fail (raise error)
if ioe.errno == errno.ENOENT:
raise ConfigManagerDataEmpty("No configuration file found")
else:
raise ConfigManagerDataReadError("Can't read configuration file: " + str(ioe))
except ValueError:
raise ConfigManagerDataReadError("Configuration file out of date or corrupt, please update or remove " + config.db_filename)
finally:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment