summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav <v.gletenko@vyos.io>2022-01-13 19:10:38 +0000
committerViacheslav <v.gletenko@vyos.io>2022-01-13 21:17:00 +0000
commitd63cabb18649149084bc3d385feaa20ddbb2f870 (patch)
treecedd582b82cbca692ab944caa9bf6bd268edbc5e /src
parentb34c9664ba69cd4876a0c7c552b466035583e505 (diff)
downloadvyos-1x-d63cabb18649149084bc3d385feaa20ddbb2f870.tar.gz
vyos-1x-d63cabb18649149084bc3d385feaa20ddbb2f870.zip
op-mode: T4179: Add op-mode CLI show virtual-server
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/show_virtual_server.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/op_mode/show_virtual_server.py b/src/op_mode/show_virtual_server.py
new file mode 100755
index 000000000..377180dec
--- /dev/null
+++ b/src/op_mode/show_virtual_server.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2022 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/>.
+
+from vyos.configquery import ConfigTreeQuery
+from vyos.util import call
+
+def is_configured():
+ """ Check if high-availability virtual-server is configured """
+ config = ConfigTreeQuery()
+ if not config.exists(['high-availability', 'virtual-server']):
+ return False
+ return True
+
+if __name__ == '__main__':
+
+ if is_configured() == False:
+ print('Virtual server not configured!')
+ exit(0)
+
+ call('sudo ipvsadm --list --numeric')