From: Adam King <47704447+adk3798@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:48:22 +0000 (-0400) Subject: Merge pull request #64086 from adk3798/wip-69514-squid X-Git-Tag: testing/wip-jcollin-testing-20250820.041311-squid~62 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e2aef77b6ae55aefc590fd10db063acc7377008e;p=ceph-ci.git Merge pull request #64086 from adk3798/wip-69514-squid squid: mgr/cephadm: mgr orchestrator module raise exception if there is trailing tab in yaml file Reviewed-by: Redouane Kachach --- e2aef77b6ae55aefc590fd10db063acc7377008e diff --cc src/pybind/mgr/orchestrator/module.py index 1fe9a5842df,8c6150bfdb6..7746471d54a --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@@ -1658,16 -1654,15 +1658,22 @@@ Usage specs: List[Union[ServiceSpec, HostSpec]] = [] # YAML '---' document separator with no content generates # None entries in the output. Let's skip them silently. - content = [o for o in yaml_objs if o is not None] + try: + content = [o for o in yaml_objs if o is not None] + except yaml.scanner.ScannerError as e: + msg = f"Invalid YAML received : {str(e)}" + self.log.exception(msg) + return HandleCommandResult(-errno.EINVAL, stderr=msg) + for s in content: - spec = json_to_generic_spec(s) + try: + spec = json_to_generic_spec(s) + except Exception as e: + if continue_on_error: + errs.append(f'Failed to convert {s} from json object: {str(e)}') + continue + else: + raise e # validate the config (we need MgrModule for that) if isinstance(spec, ServiceSpec) and spec.config: