]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Merge pull request #64086 from adk3798/wip-69514-squid
authorAdam King <47704447+adk3798@users.noreply.github.com>
Wed, 9 Jul 2025 15:48:22 +0000 (11:48 -0400)
committerGitHub <noreply@github.com>
Wed, 9 Jul 2025 15:48:22 +0000 (11:48 -0400)
squid: mgr/cephadm: mgr orchestrator module raise exception if there is trailing tab in yaml file

Reviewed-by: Redouane Kachach <rkachach@ibm.com>
1  2 
src/pybind/mgr/orchestrator/module.py

index 1fe9a5842df47d39f7584597f23645da2ee72b73,8c6150bfdb69b86e26e0f47f96d2afc288e9ac82..7746471d54a6b0f65cf1960cd073071f78045d1b
@@@ -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: