Add validate_generate_args method

Improve argument validation

Change-Id: I3dade53263ed3405d1f2a195749140ba3d74c2f1
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
This commit is contained in:
Artem Goncharov
2026-07-10 16:21:35 +00:00
parent c42c69f5d3
commit aa6d286fed
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -154,6 +154,18 @@ class OpenStackServerSourceBase:
def generate(self, target_dir, args) -> Path:
pass
def _validate_generate_args(self, target_dir, args):
"""Validate common arguments for generate() methods."""
if target_dir is None:
raise RuntimeError("Missing required argument: target_dir")
if args is None:
raise RuntimeError("Missing required argument: args")
if not hasattr(args, "validate"):
raise RuntimeError("Missing required args attribute: validate")
if not hasattr(args, "service_type"):
raise RuntimeError("Missing required args attribute: service_type")
return Path(target_dir)
def load_openapi(self, path):
"""Load existing OpenAPI spec from the file"""
if not path.exists():
+1 -1
View File
@@ -49,7 +49,7 @@ test = [
# pip is necessary since siblings installation job uses it
"pip", # Apache-2.0
"flake8-import-order~=0.19.2", # LGPLv3
"stestr>=1.0.0" # Apache-2.0]
"stestr>=1.0.0", # Apache-2.0
]
block-storage = ["cinder>=23.0"]
compute = ["nova>=28.0"]