Skip to content

Commit 56ee629

Browse files
committed
munet: fix check for str type to use correct variable
Signed-off-by: Christian Hopps <chopps@labn.net>
1 parent 3c12b01 commit 56ee629

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

munet/native.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# pylint: disable=protected-access
99
"""A module that defines objects for standalone use."""
10+
1011
import asyncio
1112
import base64
1213
import errno
@@ -25,7 +26,6 @@
2526
from copy import deepcopy
2627
from pathlib import Path
2728

28-
2929
try:
3030
# We only want to require yaml for the gen cloud image feature
3131
import yaml
@@ -54,7 +54,6 @@
5454
from .config import merge_kind_config
5555
from .watchlog import WatchLog
5656

57-
5857
AUTO_LOOPBACK_IPV4_BASE = ipaddress.ip_interface("10.255.0.0/32")
5958
AUTO_LOOPBACK_IPV6_BASE = ipaddress.ip_interface("fcfe::0/128")
6059

@@ -75,7 +74,7 @@ def get_loopback_ips(c, nid):
7574
if ipv6 := c.get("ipv6"):
7675
if ipv6 == "auto":
7776
ips.append(AUTO_LOOPBACK_IPV6_BASE + nid)
78-
elif isinstance(ip, str):
77+
elif isinstance(ipv6, str):
7978
ips.append(ipaddress.ip_interface(ipv6))
8079
else:
8180
ips.extend([ipaddress.ip_interface(x) for x in ipv6])
@@ -833,15 +832,13 @@ def __init__(self, *args, unet=None, **kwargs):
833832
# Create a hosts file to map our name
834833
hosts_file = os.path.join(self.rundir, "hosts.txt")
835834
with open(hosts_file, "w", encoding="ascii") as hf:
836-
hf.write(
837-
f"""127.0.0.1\tlocalhost {self.name}
835+
hf.write(f"""127.0.0.1\tlocalhost {self.name}
838836
::1\tip6-localhost ip6-loopback
839837
fe00::0\tip6-localnet
840838
ff00::0\tip6-mcastprefix
841839
ff02::1\tip6-allnodes
842840
ff02::2\tip6-allrouters
843-
"""
844-
)
841+
""")
845842
if hasattr(self, "bind_mount"):
846843
self.bind_mount(hosts_file, "/etc/hosts")
847844

@@ -3046,15 +3043,13 @@ def __init__(
30463043

30473044
hosts_file = os.path.join(self.rundir, "hosts.txt")
30483045
with open(hosts_file, "w", encoding="ascii") as hf:
3049-
hf.write(
3050-
f"""127.0.0.1\tlocalhost {self.name}
3046+
hf.write(f"""127.0.0.1\tlocalhost {self.name}
30513047
::1\tip6-localhost ip6-loopback
30523048
fe00::0\tip6-localnet
30533049
ff00::0\tip6-mcastprefix
30543050
ff02::1\tip6-allnodes
30553051
ff02::2\tip6-allrouters
3056-
"""
3057-
)
3052+
""")
30583053
self.bind_mount(hosts_file, "/etc/hosts")
30593054

30603055
# Common CLI commands for any topology
@@ -3467,9 +3462,7 @@ async def coverage_finish(self):
34673462

34683463
# Create .gcno symlinks if they don't already exist, for kernel they will
34693464
self.logger.info("Creating .gcno symlinks from '%s' to '%s'", gcdadir, bdir)
3470-
commander.cmd_raises(
3471-
f'cd "{gcdadir}"; bdir="{bdir}"'
3472-
+ """
3465+
commander.cmd_raises(f'cd "{gcdadir}"; bdir="{bdir}"' + """
34733466
for f in $(find . -name '*.gcda'); do
34743467
f=${f#./};
34753468
f=${f%.gcda}.gcno;
@@ -3478,8 +3471,7 @@ async def coverage_finish(self):
34783471
touch -h -r $bdir/$f $f;
34793472
echo $f;
34803473
fi;
3481-
done"""
3482-
)
3474+
done""")
34833475

34843476
# Get the results into a summary file
34853477
data_file = rundir / "coverage.info"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "munet"
3-
version = "0.17.2"
3+
version = "0.17.3"
44
description = "A package to facilitate network simulations"
55
readme = {file = "README.org", content-type = "text/plain"}
66
requires-python = ">=3.9"

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)