Validate created resources

This commit is contained in:
Łukasz Oleś 2015-06-25 14:00:22 +00:00
parent 1d671a8f8a
commit 62b618e8e1

View File

@ -7,6 +7,7 @@ import yaml
from jinja2 import Template, Environment, meta
from solar import utils
from solar.core import validation
from solar.core import resource as resource_module
from solar.core import signals
@ -58,8 +59,17 @@ def create_virtual_resource(vr_name, template):
emitter = db[emitter]
reciver = db[reciver]
signals.connect(emitter, reciver, mapping)
return created_resources
for r in db.values():
if not isinstance(r, resource_module.Resource):
continue
print 'Validating {}'.format(r.name)
errors = validation.validate_resource(r)
if errors:
print 'ERROR: %s: %s' % (r.name, errors)
#import sys;sys.exit()
return created_resources
def create(name, path, kwargs, virtual_resource=None):
if not os.path.exists(path):