From 0121e4e7ab9b3fdb1bb01c52da8630246159af93 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Sat, 30 Dec 2023 19:17:46 -0500 Subject: [PATCH] Handle None/empty and numeric SLS modules listed in include declarations --- changelog/56253.fixed.md | 1 + salt/state.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelog/56253.fixed.md diff --git a/changelog/56253.fixed.md b/changelog/56253.fixed.md new file mode 100644 index 000000000000..475b40c5e1e2 --- /dev/null +++ b/changelog/56253.fixed.md @@ -0,0 +1 @@ +Handle None/empty and numeric SLS modules listed in include declarations diff --git a/salt/state.py b/salt/state.py index 45caa26b8d90..31a54afd22a1 100644 --- a/salt/state.py +++ b/salt/state.py @@ -4422,6 +4422,18 @@ def render_state(self, sls, saltenv, mods, matches, local=False, context=None): errors.append(msg) continue + if not hasattr(inc_sls, "startswith"): + if inc_sls is None: + msg = ( + "Empty include found in include " + "in SLS '{}:{}'".format(saltenv, sls) + ) + log.error(msg) + errors.append(msg) + continue + else: + inc_sls = str(inc_sls) + if inc_sls.startswith("."): match = re.match(r"^(\.+)(.*)$", inc_sls) if match: