Add services.yaml validator (#23205)
* Add services.yaml validator * Fix path
This commit is contained in:
parent
37cd711c96
commit
33b8241d26
9 changed files with 172 additions and 71 deletions
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue