diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-10-21 19:14:12 -0500 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-11-05 09:47:55 -0600 |
| commit | 4c391ed39c51172cbb8f2de6732d6fe4e3a8b125 (patch) | |
| tree | 089366567965f7116c83e8e735b1bc34c7a99f22 /src | |
| parent | 2a574f7e146a82beb04661d85d7fd83553b2c160 (diff) | |
| download | vyos-1x-4c391ed39c51172cbb8f2de6732d6fe4e3a8b125.tar.gz vyos-1x-4c391ed39c51172cbb8f2de6732d6fe4e3a8b125.zip | |
T7910: add keyword extant, for use by teardown script
The standalone script teardown-config-session.py is called on CLI
config-mode exit, to close the persistent vyconf config session. Instead
of injecting the config-mode env var into the external script to
indicate a non-ephemeral session, add keyword 'extant' to find existing
session.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/helpers/teardown-config-session.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/helpers/teardown-config-session.py b/src/helpers/teardown-config-session.py index c30303c99..49a3f5bc5 100755 --- a/src/helpers/teardown-config-session.py +++ b/src/helpers/teardown-config-session.py @@ -23,5 +23,10 @@ if len(sys.argv) < 2: pid = sys.argv[1] -vc = VyconfSession(pid=pid) -vc.teardown() +try: + vc = VyconfSession(pid=int(pid), extant=True) +except ValueError: + # as this script is called on any config session exit, ignore non-existent + pass +else: + vc.teardown() |
