feat: imeplement value error in service initialization
This commit is contained in:
parent
012fd8d698
commit
a58e818033
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,10 @@ from compose_viz.extends import Extends
|
||||||
class Service:
|
class Service:
|
||||||
def __init__(self, name: str, image: str = None, ports: List[str] = [], networks: List[str] = [], volumes: List[str] = [], depends_on: List[str] = [], links: List[str] = [], extends: Extends = None) -> None:
|
def __init__(self, name: str, image: str = None, ports: List[str] = [], networks: List[str] = [], volumes: List[str] = [], depends_on: List[str] = [], links: List[str] = [], extends: Extends = None) -> None:
|
||||||
self._name = name
|
self._name = name
|
||||||
|
|
||||||
|
if image is None and extends is None:
|
||||||
|
raise ValueError(f"Both image and extends are not defined in service '{name}', aborting.")
|
||||||
|
|
||||||
self._image = image
|
self._image = image
|
||||||
self._ports = ports
|
self._ports = ports
|
||||||
self._networks = networks
|
self._networks = networks
|
||||||
|
|
Loading…
Reference in a new issue