Skip to content

Commit

Permalink
utils_net: disable color chars
Browse files Browse the repository at this point in the history
The command might output ip address with color characters which will
break the script, like below.
Get ipv6 address of vm1: �[34m2620:52:11:1601:982f:7bff:fe94:1415�[0m

This is to disable the color characters in the outputs.

Signed-off-by: Dan Zheng <[email protected]>
  • Loading branch information
dzhengfy committed Feb 6, 2025
1 parent 731ecab commit ce24508
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virttest/utils_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ def get_net_if_addrs(if_name, runner=None):
"""
if runner is None:
runner = local_runner
cmd = "ip addr show %s" % (if_name)
cmd = "ip -color=never addr show %s" % (if_name)
result = runner(cmd)
return {
"ipv4": re.findall("inet (.+?)/..?", result, re.MULTILINE),
Expand Down

0 comments on commit ce24508

Please sign in to comment.