diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-03-05 16:21:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-05 16:21:13 +0100 |
| commit | 5ea47f5c7dab6cee38aef355fd78d434a10dd463 (patch) | |
| tree | 938a3bed44be5b451178c22e87364be2e592da50 /python | |
| parent | fcf57444ab7150e06082627fe196de3c9a87d9e1 (diff) | |
| parent | 1359f690af841ea7c28028e907b1d5f15f3d90b8 (diff) | |
| download | vyos-1x-5ea47f5c7dab6cee38aef355fd78d434a10dd463.tar.gz vyos-1x-5ea47f5c7dab6cee38aef355fd78d434a10dd463.zip | |
Merge pull request #4967 from alexandr-san4ez/T8215-current
tech-support: T8215: Extend tech-support archive and report generation
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/utils/file.py | 15 | ||||
| -rw-r--r-- | python/vyos/utils/process.py | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/python/vyos/utils/file.py b/python/vyos/utils/file.py index 6708ade2d..f230977a7 100644 --- a/python/vyos/utils/file.py +++ b/python/vyos/utils/file.py @@ -339,3 +339,18 @@ def file_compare(file1: str, file2: str) -> bool: return False return True + + +def get_name_from_path(path) -> str: + """ + Extracts the base name (without extension) from a file path. + + Args: + path (str | pathlib.Path): The file path to extract the name from. + + Returns: + str: The base name without file extension. + """ + base = os.path.basename(path) + name, _ = base.split('.', maxsplit=1) + return name diff --git a/python/vyos/utils/process.py b/python/vyos/utils/process.py index 158371024..74546a172 100644 --- a/python/vyos/utils/process.py +++ b/python/vyos/utils/process.py @@ -321,3 +321,9 @@ def ip_cmd(args, json=True): else: res = cmd(f"ip {args}") return res + + +def wrap_op(cmd: str) -> str: + """Returns a command with the VyOS operational mode wrapper.""" + + return f'/opt/vyatta/bin/vyatta-op-cmd-wrapper {cmd}' |
