Execute the salt call!
(self)
| 15 | """ |
| 16 | |
| 17 | def run(self): |
| 18 | """ |
| 19 | Execute the salt call! |
| 20 | """ |
| 21 | self.parse_args() |
| 22 | |
| 23 | if self.options.file_root: |
| 24 | file_roots = [] |
| 25 | for file_root in self.options.file_root: |
| 26 | # check if the argument is pointing to a file on disk |
| 27 | file_roots.append(os.path.abspath(file_root)) |
| 28 | self.config["file_roots"] = {"base": _expand_glob_path(file_roots)} |
| 29 | |
| 30 | if self.options.pillar_root: |
| 31 | pillar_roots = [] |
| 32 | for pillar_root in self.options.pillar_root: |
| 33 | # check if the argument is pointing to a file on disk |
| 34 | pillar_roots.append(os.path.abspath(pillar_root)) |
| 35 | self.config["pillar_roots"] = {"base": _expand_glob_path(pillar_roots)} |
| 36 | |
| 37 | if self.options.states_dir: |
| 38 | states_dirs = [] |
| 39 | for states_dir in self.options.states_dir: |
| 40 | # check if the argument is pointing to a file on disk |
| 41 | states_dirs.append(os.path.abspath(states_dir)) |
| 42 | self.config["states_dirs"] = states_dirs |
| 43 | |
| 44 | # Warn when the user passed local-roots overrides without --local. |
| 45 | # Without --local the remote file client retrieves state/pillar data |
| 46 | # from the master, which silently overwrites the local file_roots / |
| 47 | # pillar_roots / states_dirs configured above (see #68137). |
| 48 | if not self.options.local: |
| 49 | ignored = [] |
| 50 | if self.options.file_root: |
| 51 | ignored.append("--file-root") |
| 52 | if self.options.pillar_root: |
| 53 | ignored.append("--pillar-root") |
| 54 | if self.options.states_dir: |
| 55 | ignored.append("--states-dir") |
| 56 | if ignored: |
| 57 | sys.stderr.write( |
| 58 | "Warning: {} {} ignored because --local was not " |
| 59 | "specified; the remote file client retrieves these " |
| 60 | "from the master. Re-run with --local to use the " |
| 61 | "local override.\n".format( |
| 62 | ", ".join(ignored), |
| 63 | "is" if len(ignored) == 1 else "are", |
| 64 | ) |
| 65 | ) |
| 66 | |
| 67 | if self.options.local: |
| 68 | self.config["file_client"] = "local" |
| 69 | if self.options.master: |
| 70 | self.config["master"] = self.options.master |
| 71 | |
| 72 | if self.options.cachedir and self.config.get( |
| 73 | "extension_modules" |
| 74 | ) == os.path.join(self.config.get("__cachedir"), "extmods"): |