Merge "Improving Manifest require check"

This commit is contained in:
Jenkins 2016-08-31 12:54:19 +00:00 committed by Gerrit Code Review
commit e47bfeec93
2 changed files with 10 additions and 0 deletions

View File

@ -59,6 +59,11 @@ class ManifestValidatorTests(helpers.BaseValidatorTestClass):
self.g = self.mv._valid_require([1, 2, 3])
self.assertIn('Require is not a dict type', next(self.g).message)
def test_wrong_require_fqn(self):
self.g = self.mv._valid_require({'io.murano!': '1.3.2'})
self.assertIn('Require key is not valid FQN "io.murano!"',
next(self.g).message)
def test_not_existing_file(self):
data = {'org.openstack.Flow': 'FlowClassifier.yaml',
'org.openstack.Instance': 'Instance.yaml'}

View File

@ -60,6 +60,11 @@ class ManifestValidator(base.YamlValidator):
def _valid_require(self, value):
if not isinstance(value, dict):
yield error.report.E005('Require is not a dict type', value)
return
for fqn, ver in six.iteritems(value):
if not self._check_fqn_name(fqn):
yield error.report.E005('Require key is not valid FQN "{0}"'
.format(fqn), fqn)
def _valid_type(self, value):
if value not in ('Application', 'Library'):