summaryrefslogtreecommitdiff
path: root/src/op_mode/show_neigh.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2022-06-06 13:29:37 +0300
committerDaniil Baturin <daniil@baturin.org>2022-06-06 13:48:21 +0300
commite75ce8b7fc02c984f2d0ddaef3768d9f6431bb80 (patch)
tree6c1e2788213038fdbab677709302bc13a2f3b18c /src/op_mode/show_neigh.py
parent67b342a2c59035a5282f92e3b3d77f698dc8887c (diff)
downloadvyos-1x-e75ce8b7fc02c984f2d0ddaef3768d9f6431bb80.tar.gz
vyos-1x-e75ce8b7fc02c984f2d0ddaef3768d9f6431bb80.zip
T4446: use format strings instead of old-fasionhed format method
Diffstat (limited to 'src/op_mode/show_neigh.py')
-rwxr-xr-xsrc/op_mode/show_neigh.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/op_mode/show_neigh.py b/src/op_mode/show_neigh.py
index 4d96ee869..d874bd544 100755
--- a/src/op_mode/show_neigh.py
+++ b/src/op_mode/show_neigh.py
@@ -35,16 +35,16 @@ def get_raw_data(family, device=None, state=None):
from vyos.util import cmd
if device:
- device = "dev {0}".format(device)
+ device = f"dev {device}"
else:
device = ""
if state:
- state = "nud {0}".format(state)
+ state = f"nud {state}"
else:
state = ""
- neigh_cmd = "ip --family {0} --json neighbor list {1} {2}".format(family, device, state)
+ neigh_cmd = f"ip --family {family} --json neighbor list {device} {state}"
data = loads(cmd(neigh_cmd))
@@ -93,7 +93,7 @@ if __name__ == '__main__':
if args.state:
if args.state not in ["reachable", "failed", "stale", "permanent"]:
- raise ValueError("Incorrect state {0}! Must be one of: reachable, stale, failed, permanent".format(args.state))
+ raise ValueError(f"""Incorrect state "{args.state}"! Must be one of: reachable, stale, failed, permanent""")
try:
print(get_formatted_output(args.family, device=args.interface, state=args.state))