Add services.yaml validator (#23205)

* Add services.yaml validator

* Fix path
This commit is contained in:
Paulus Schoutsen committed 2019-04-19 17:05:39 -07:00
1 parent 2bb772bbdc
commit 1a4a9532dd
9 files changed
+172 -71

No files matched your search

+4 -8
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',