@@ -82,6 +82,11 @@ def configure(fp):
except yaml.YAMLError as e:
ConfigError("syntax mismatch in configuration file '%s': %s" %
(fp.name, e))
+ try:
+ root = config['root']
+ except KeyError as e:
+ ConfigError("missing section: %s" % e)
+
# should be replaced with schema (https://github.com/keleshev/schema)
for section in _CONFIG_FORMAT:
if section not in config:
@@ -105,8 +110,16 @@ def configure(fp):
ConfigError("repository item must be a
dictionary")
for k, v in repo.items():
- if (type(k) and type(v)) != str:
+ if type(k) != str or type(v) != str:
ConfigError("key/value types must be
strings")
+
+ fullpath = v if os.path.isabs(v) else
os.path.join(root, v)
+
+ if os.path.isdir(fullpath):
+ # overwrite with full path value
+ repo[k] = fullpath
+ else:
+ ConfigError("repository path '%s'
doesn't exist" % k)
else:
if type(item[key]) != str:
ConfigError("value for '%s' must be a string" %
key)
@@ -136,17 +149,11 @@ class ReMirror(Process):
class Repo(object):