summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-07-04 13:40:18 +0200
committerGitHub <noreply@github.com>2024-07-04 13:40:18 +0200
commitec889a74217d8132874e571934866e08aaf11ba4 (patch)
tree4cb93a0bfdb2f5a810b2018e69fb73182e8ba251 /src/op_mode
parent18f6159536d67c8fdabf02fe1aa8b4e0e94986d8 (diff)
parent7aa420e5a5509793030350acb9c108eaef6c79ea (diff)
downloadvyos-1x-ec889a74217d8132874e571934866e08aaf11ba4.tar.gz
vyos-1x-ec889a74217d8132874e571934866e08aaf11ba4.zip
Merge pull request #3766 from vyos/mergify/bp/circinus/pr-3745
T6527: add legacy Vyatta interpreter files still in use (backport #3745)
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()