blob: b485f280e653fa83cc20b826206567727e35b70c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/sh
[ "$1" = python3-augeas ] || exit 0
python3 - <<'EOF'
import augeas
# Basic instantiation (in-memory, no files touched)
a = augeas.Augeas(root="/dev/null", loadpath=None,
flags=augeas.Augeas.NO_LOAD | augeas.Augeas.NO_MODL_AUTOLOAD)
# Set and get a value
a.set("/test/key", "value")
assert a.get("/test/key") == "value", "get after set failed"
# Match
a.set("/test/a", "1")
a.set("/test/b", "2")
matches = a.match("/test/*")
assert len(matches) == 3, f"Expected 3 matches, got {len(matches)}"
# Remove
a.remove("/test/key")
assert a.get("/test/key") is None, "Expected None after remove"
a.close()
print("python-augeas OK")
EOF
|