@@ -331,6 +331,20 @@ def validate(data):
331
331
if (bool ('version' in my or 'version' in defaults )
332
332
!= bool ('install' in my or 'install' in defaults )):
333
333
raise ValueError ("'version' and 'install' are both required" )
334
+
335
+ # Check $-based substitutions
336
+ config = my .get ('config' , defaults .get ('config' , '' ))
337
+ template = my .get ('template' , defaults .get ('template' , '' ))
338
+ try :
339
+ with open (config ) as infile :
340
+ template += infile .read ()
341
+ except :
342
+ pass
343
+ subst = my .get ('subst' , defaults .get ('subst' , OrderedDict ()))
344
+ names = set (re .findall (r'\${?(\w+)}?' , template ))
345
+ for name in names - set (subst .keys ()):
346
+ raise ValueError ("'%s' not found in all 'subst' objects" % name )
347
+
334
348
else :
335
349
if defaults :
336
350
raise ValueError ("Only one object without 'stack' is allowed" )
@@ -345,8 +359,11 @@ def validate(data):
345
359
346
360
if 'base_url' in my :
347
361
result = urlparse (my ['base_url' ])
348
- if result .scheme != 'http' or result .path != '/file/' :
349
- raise ValueError ("'base_url' format is 'http://change.me:8080/file/'" )
362
+ if not all ((result .scheme , result .netloc )):
363
+ raise ValueError ("'base_url' is not valid" )
364
+
365
+ if not result .path .endswith ('/' ):
366
+ raise ValueError ("'base_url' should end with /" )
350
367
351
368
# Check local path existence only
352
369
for key in ('install' , 'config' ):
0 commit comments