(self, *sls_names, **kws)
| 133 | self.options.update(options) |
| 134 | |
| 135 | def include(self, *sls_names, **kws): |
| 136 | if "env" in kws: |
| 137 | # "env" is not supported; Use "saltenv". |
| 138 | kws.pop("env") |
| 139 | |
| 140 | saltenv = kws.get("saltenv", self.saltenv) |
| 141 | |
| 142 | if kws.get("delayed", False): |
| 143 | for incl in sls_names: |
| 144 | self.includes.append((saltenv, incl)) |
| 145 | return |
| 146 | |
| 147 | HIGHSTATE = HighState.get_active() |
| 148 | |
| 149 | global SLS_MATCHES |
| 150 | if SLS_MATCHES is None: |
| 151 | SLS_MATCHES = HIGHSTATE.top_matches(HIGHSTATE.get_top()) |
| 152 | |
| 153 | highstate = self.included_highstate |
| 154 | slsmods = [] # a list of pydsl sls modules rendered. |
| 155 | for sls in sls_names: |
| 156 | r_env = f"{saltenv}:{sls}" |
| 157 | if r_env not in self.rendered_sls: |
| 158 | self.rendered_sls.add( |
| 159 | sls |
| 160 | ) # needed in case the starting sls uses the pydsl renderer. |
| 161 | histates, errors = HIGHSTATE.render_state( |
| 162 | sls, saltenv, self.rendered_sls, SLS_MATCHES |
| 163 | ) |
| 164 | HIGHSTATE.merge_included_states(highstate, histates, errors) |
| 165 | if errors: |
| 166 | raise PyDslError("\n".join(errors)) |
| 167 | HIGHSTATE.clean_duplicate_extends(highstate) |
| 168 | |
| 169 | state_id = f"_slsmod_{sls}" |
| 170 | if state_id not in highstate: |
| 171 | slsmods.append(None) |
| 172 | else: |
| 173 | for arg in highstate[state_id]["stateconf"]: |
| 174 | if isinstance(arg, dict) and next(iter(arg)) == "slsmod": |
| 175 | slsmods.append(arg["slsmod"]) |
| 176 | break |
| 177 | |
| 178 | if not slsmods: |
| 179 | return None |
| 180 | return slsmods[0] if len(slsmods) == 1 else slsmods |
| 181 | |
| 182 | def extend(self, *state_funcs): |
| 183 | if self.options.ordered or self.last_func(): |
nothing calls this directly
no test coverage detected