summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-07-02 16:04:17 +0200
committerGitHub <noreply@github.com>2024-07-02 16:04:17 +0200
commitb1d74fe8e21e2a9725eefb517e7da63f8cd952f9 (patch)
tree1a77ced47217ee863f87ff224b54c5e00938e5e7 /src/op_mode
parentefe4e60f5b5620ad7ea342fc9ca1d069e8b9cc21 (diff)
parent72a704d2e2b06bfedc4f1ee841814f983fc34baa (diff)
downloadvyos-1x-b1d74fe8e21e2a9725eefb517e7da63f8cd952f9.tar.gz
vyos-1x-b1d74fe8e21e2a9725eefb517e7da63f8cd952f9.zip
Merge pull request #3745 from c-po/no-legacy
T6527: add legacy Vyatta interpreter files still in use
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/connect_disconnect.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/op_mode/connect_disconnect.py b/src/op_mode/connect_disconnect.py
index 373f9e953..379890c54 100755
--- a/src/op_mode/connect_disconnect.py
+++ b/src/op_mode/connect_disconnect.py
@@ -95,17 +95,21 @@ def disconnect(interface):
def main():
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
- group.add_argument("--connect", help="Bring up a connection-oriented network interface", action="store")
- group.add_argument("--disconnect", help="Take down connection-oriented network interface", action="store")
+ group.add_argument("--connect", help="Bring up a connection-oriented network interface", action="store_true")
+ group.add_argument("--disconnect", help="Take down connection-oriented network interface", action="store_true")
+ group.add_argument("--interface", help="Interface name", action="store", required=True)
args = parser.parse_args()
- if args.connect:
- if commit_in_progress():
- print('Cannot connect while a commit is in progress')
- exit(1)
- connect(args.connect)
- elif args.disconnect:
- disconnect(args.disconnect)
+ if args.connect or args.disconnect:
+ if args.disconnect:
+ disconnect(args.interface)
+
+ if args.connect:
+ if commit_in_progress():
+ print('Cannot connect while a commit is in progress')
+ exit(1)
+ connect(args.interface)
+
else:
parser.print_help()