summaryrefslogtreecommitdiff
path: root/src/helpers/teardown-config-session.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-04-17 23:48:49 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-05-22 13:26:48 -0500
commit0686808c07e758bb3aa6d82d2482d4d972d83d71 (patch)
tree104a3d0680ddfdc4876f26a51ba8fd3faa9ede99 /src/helpers/teardown-config-session.py
parent553450438afedd12b6c44fe21eb4372c62d1a5a2 (diff)
downloadvyos-1x-0686808c07e758bb3aa6d82d2482d4d972d83d71.tar.gz
vyos-1x-0686808c07e758bb3aa6d82d2482d4d972d83d71.zip
T7374: add teardown session util to be called on CLI config session exit
Diffstat (limited to 'src/helpers/teardown-config-session.py')
-rwxr-xr-xsrc/helpers/teardown-config-session.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/helpers/teardown-config-session.py b/src/helpers/teardown-config-session.py
new file mode 100755
index 000000000..c94876924
--- /dev/null
+++ b/src/helpers/teardown-config-session.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2025 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#
+
+import sys
+import os
+
+from vyos.vyconf_session import VyconfSession
+
+if len(sys.argv) < 2:
+ sys.exit('session pid is required')
+
+pid = sys.argv[1]
+
+vc = VyconfSession(pid=pid)
+vc.teardown()