diff options
-rw-r--r-- | lorrycontroller/confparser.py | 12 | ||||
-rw-r--r-- | lorrycontroller/workingstate.py | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lorrycontroller/confparser.py b/lorrycontroller/confparser.py index 34b4eda..9c4e4b4 100644 --- a/lorrycontroller/confparser.py +++ b/lorrycontroller/confparser.py @@ -14,10 +14,10 @@ default_values = [ ( u'destroy', u'never' ), ( u'interval', u'1m' ), ( u'stagger', False ), + ( u'tarball', u'never' ), ( u'type', u'invalid_type' ), ] -valid_whens = set(["always", "never", "unchanged"]) valid_interval = re.compile(r"^([1-9][0-9]*)([mhd])?$") interval_mults = { None: 1, @@ -78,16 +78,16 @@ class LorryControllerConfig(object): for key, defval in default_values: if type(defval) != type(entry[key]): self._give_up("Invalid type for '%s': %r" % (key, entry[key])) - self._validate__when(entry, 'create') - if entry['create'] == "unchanged": - self._give_up("Invalid value for create: unchanged") - self._validate__when(entry, 'destroy') + self._validate__when(entry, 'create', ["always", "never"]) + self._validate__when(entry, 'destroy', + ["always", "never", "unchanged"]) + self._validate__when(entry, 'tarball', ["always", "never", "first"]) entry['interval-parsed'] = self._parse_interval(entry['interval']) if 'ls-interval' in entry: entry['ls-interval-parsed'] = \ self._parse_interval(entry['ls-interval']) - def _validate__when(self, entry, key): + def _validate__when(self, entry, key, valid_whens): if entry[key] not in valid_whens: self._give_up("Invalid value for %s: %s" % (key, entry[key])) diff --git a/lorrycontroller/workingstate.py b/lorrycontroller/workingstate.py index 1812ad5..9a99004 100644 --- a/lorrycontroller/workingstate.py +++ b/lorrycontroller/workingstate.py @@ -32,6 +32,9 @@ class LorryFileRunner(object): def run_lorry(self, *args): cmdargs = list(args) cmdargs.append(self.lorryfile) + conf_uuid = self.mgr.lorry_state[self.lorryname]['conf'] + conf = self.mgr.app.conf.configs[conf_uuid] + cmdargs.append("--tarball=%s" % conf['tarball']) exit, out, err = self.mgr.app.maybe_runcmd(cmdargs) if exit == 0: logging.debug("Lorry of %s succeeded: %s" % (self.lorryname, out)) |