This commit is contained in:
bigeagle 2014-10-24 19:49:51 +08:00
parent 2a609f6eb7
commit 45b2046dfb
2 changed files with 6 additions and 10 deletions

1
.gitignore vendored
View File

@ -55,3 +55,4 @@ target/
*.swp
*~
/examples/tunasync.json

View File

@ -233,13 +233,13 @@ class TUNASync(object):
def _reload_mirrors(self, signum, frame, force=False):
print("reload mirror configs, force restart: {}".format(force))
self._settings.read(self._config_file)
for section in filter(lambda s: s.startswith("mirror:"),
self._settings.sections()):
with open(self._config_file) as f:
self._settings = toml.loads(f.read())
_, name = section.split(":")
newMirCfg = MirrorConfig(self, name, self._settings, section)
for mirror_opt in self._settings["mirrors"]:
name = mirror_opt["name"]
newMirCfg = MirrorConfig(self, mirror_opt)
if name in self._mirrors:
if newMirCfg.compare(self._mirrors[name]):
@ -265,10 +265,5 @@ class TUNASync(object):
print("New mirror: {}".format(name))
self.run_provider(name)
# def config(self, option):
# if self._settings is None:
# raise TUNASyncException("Config not inited")
#
# vim: ts=4 sw=4 sts=4 expandtab