salt-api-cli 1.4.4__tar.gz → 1.4.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {salt_api_cli-1.4.4/salt_api_cli.egg-info → salt_api_cli-1.4.5}/PKG-INFO +1 -1
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli/highlevel.py +32 -20
- salt_api_cli-1.4.5/salt_api_cli/version.py +1 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5/salt_api_cli.egg-info}/PKG-INFO +1 -1
- salt_api_cli-1.4.4/salt_api_cli/version.py +0 -1
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/MANIFEST.in +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/README.md +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/pyproject.toml +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli/__init__.py +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli/__main__.py +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli/cli.py +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli/lowlevel.py +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli/py.typed +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli.egg-info/SOURCES.txt +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli.egg-info/dependency_links.txt +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli.egg-info/entry_points.txt +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli.egg-info/requires.txt +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/salt_api_cli.egg-info/top_level.txt +0 -0
- {salt_api_cli-1.4.4 → salt_api_cli-1.4.5}/setup.cfg +0 -0
|
@@ -100,10 +100,13 @@ def _state_function(key: str) -> str:
|
|
|
100
100
|
return parts[0]
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
def
|
|
104
|
-
"""Collapse whitespace
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
def _oneline(text: str) -> str:
|
|
104
|
+
"""Collapse all whitespace runs to single spaces, on one line.
|
|
105
|
+
|
|
106
|
+
Used for compact details (e.g. the list of changed keys) where the
|
|
107
|
+
structure doesn't matter. Nothing is truncated — long values are folded
|
|
108
|
+
across lines by the table's detail column, never cut off."""
|
|
109
|
+
return " ".join(str(text).split())
|
|
107
110
|
|
|
108
111
|
|
|
109
112
|
def _fmt_duration(ms: float) -> str:
|
|
@@ -185,26 +188,23 @@ def _print_state_return(minion: str, states: dict[str, Any]) -> None:
|
|
|
185
188
|
str(changes.get("stdout") or "").strip()
|
|
186
189
|
or str(changes.get("stderr") or "").strip()
|
|
187
190
|
)
|
|
188
|
-
|
|
189
|
-
detail = (
|
|
190
|
-
Text(out, no_wrap=False, overflow="fold")
|
|
191
|
-
if out
|
|
192
|
-
else "changed: (no output)"
|
|
193
|
-
)
|
|
191
|
+
detail = Text(out) if out else "changed: (no output)"
|
|
194
192
|
else:
|
|
195
193
|
changed = ", ".join(changes) or "(changes)"
|
|
196
|
-
detail = f"changed: {
|
|
194
|
+
detail = f"changed: {_oneline(changed)}"
|
|
197
195
|
elif status == "fail":
|
|
198
|
-
detail = Text(
|
|
196
|
+
detail = Text(str(state.get("comment", "")).strip(), style="red")
|
|
199
197
|
else: # diff / skip
|
|
200
|
-
detail =
|
|
198
|
+
detail = Text(str(state.get("comment", "")).strip())
|
|
201
199
|
rows.append((Text(marker, style=style), _state_function(key), ref, detail))
|
|
202
200
|
|
|
203
|
-
# Pin the detail column to whatever width is left so rich
|
|
204
|
-
# (
|
|
205
|
-
# to nothing on a narrow terminal.
|
|
206
|
-
#
|
|
207
|
-
#
|
|
201
|
+
# Pin the detail column to whatever width is left so rich folds *it*
|
|
202
|
+
# (wraps onto extra lines) rather than collapsing the short
|
|
203
|
+
# marker/function/ref columns to nothing on a narrow terminal. Full
|
|
204
|
+
# content is always shown — long details just span more rows. Width
|
|
205
|
+
# budget: 2-space left Padding + 1-char marker + the natural function/ref
|
|
206
|
+
# widths + three 2-space column gaps (pad_edge=False). Floor at 20 so
|
|
207
|
+
# detail never gets squeezed to a sliver.
|
|
208
208
|
fn_w = max((len(fn) for _, fn, _, _ in rows), default=8)
|
|
209
209
|
ref_w = max((len(ref) for _, _, ref, _ in rows), default=8)
|
|
210
210
|
nat_w = max(
|
|
@@ -221,7 +221,7 @@ def _print_state_return(minion: str, states: dict[str, Any]) -> None:
|
|
|
221
221
|
table.add_column("marker", no_wrap=True)
|
|
222
222
|
table.add_column("function", style="cyan", no_wrap=True)
|
|
223
223
|
table.add_column("ref", style="dim", no_wrap=True)
|
|
224
|
-
table.add_column("detail",
|
|
224
|
+
table.add_column("detail", overflow="fold", width=detail_w)
|
|
225
225
|
|
|
226
226
|
for row in rows:
|
|
227
227
|
table.add_row(*row)
|
|
@@ -741,11 +741,23 @@ def run_keys(args: argparse.Namespace, call: Callable[..., dict[str, Any]]) -> N
|
|
|
741
741
|
"delete": "key.delete",
|
|
742
742
|
}
|
|
743
743
|
match: str = "*" if action == "accept-all" else args.match
|
|
744
|
+
|
|
745
|
+
# salt's key.delete returns an empty payload on success: it evaluates the
|
|
746
|
+
# name match *after* removing the key files, so nothing matches and the
|
|
747
|
+
# `return` comes back `{}` even when keys were deleted (accept/reject don't
|
|
748
|
+
# hit this — their keys still exist when the return is built). Resolve the
|
|
749
|
+
# affected ids up front so we can report what was actually deleted instead
|
|
750
|
+
# of misprinting "(no keys changed)".
|
|
751
|
+
pre_match: dict[str, list[str]] = {}
|
|
752
|
+
if action == "delete":
|
|
753
|
+
nm = call(fun="key.name_match", match=match)
|
|
754
|
+
pre_match = nm["return"][0]["data"].get("return", {}) or {}
|
|
755
|
+
|
|
744
756
|
result = call(fun=fun_map[action], match=match)
|
|
745
757
|
data = result["return"][0]["data"]
|
|
746
758
|
if not data.get("success"):
|
|
747
759
|
sys.exit(f"failed: {data}")
|
|
748
|
-
changed: dict[str, list[str]] = data.get("return", {})
|
|
760
|
+
changed: dict[str, list[str]] = data.get("return", {}) or pre_match
|
|
749
761
|
if not changed:
|
|
750
762
|
console.print("(no keys changed)")
|
|
751
763
|
return
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.4.5"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.4.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|