Fix validation of ShellCommand config type.

Fixes #432.
This commit is contained in:
Florian Bruhin 2015-01-03 21:19:43 +01:00
parent e54d3c21ee
commit 9521d253a1

View File

@ -937,13 +937,13 @@ class ShellCommand(BaseType):
return
else:
raise configexc.ValidationError(value, "may not be empty!")
if self.placeholder and '{}' not in self.transform(value):
raise configexc.ValidationError(value, "needs to contain a "
"{}-placeholder.")
try:
shlex.split(value)
except ValueError as e:
raise configexc.ValidationError(value, str(e))
if self.placeholder and '{}' not in self.transform(value):
raise configexc.ValidationError(value, "needs to contain a "
"{}-placeholder.")
def transform(self, value):
if not value: