Add services.yaml validator (#23205)

* Add services.yaml validator

* Fix path
This commit is contained in:
Paulus Schoutsen 2019-04-18 13:40:46 -07:00 committed by GitHub
parent 37cd711c96
commit 33b8241d26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 172 additions and 71 deletions

View file

@ -61,26 +61,22 @@ class Integration:
"""Integration domain."""
return self.path.name
@property
def manifest_path(self) -> pathlib.Path:
"""Integration manifest path."""
return self.path / 'manifest.json'
def add_error(self, *args, **kwargs):
"""Add an error."""
self.errors.append(Error(*args, **kwargs))
def load_manifest(self) -> None:
"""Load manifest."""
if not self.manifest_path.is_file():
manifest_path = self.path / 'manifest.json'
if not manifest_path.is_file():
self.add_error(
'model',
"Manifest file {} not found".format(self.manifest_path)
"Manifest file {} not found".format(manifest_path)
)
return
try:
manifest = json.loads(self.manifest_path.read_text())
manifest = json.loads(manifest_path.read_text())
except ValueError as err:
self.add_error(
'model',