Skip to content

Commit fbf8f78

Browse files
authored
Merge pull request #789 from tiran/improve-network-isolation
fix: improve network isolation
2 parents b294a4a + e9bd424 commit fbf8f78

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/fromager/external_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def detect_network_isolation() -> None:
3939
cmd = network_isolation_cmd()
4040
if os.name == "posix":
4141
check = [*cmd, "true"]
42-
subprocess.check_call(check, stderr=subprocess.STDOUT)
42+
subprocess.check_output(check, stderr=subprocess.STDOUT)
4343

4444

4545
class NetworkIsolationError(subprocess.CalledProcessError):

src/fromager/run_network_isolation.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ if [ "$#" -eq 0 ]; then
2222
fi
2323

2424
# bring loopback up
25-
ip link set lo up
25+
if command -v ip 2>&1 >/dev/null; then
26+
ip link set lo up
27+
else
28+
echo "'ip' command is missing, cannot bring up loopback device for $@" >&2
29+
exit 2
30+
fi
2631

2732
# set hostname to "localhost"
2833
if command -v hostname 2>&1 >/dev/null; then
2934
hostname localhost
35+
else
36+
echo "'hostname' command is missing, cannot set host name to 'localhost' for $@" >&2
3037
fi
3138

3239
# replace with command

0 commit comments

Comments
 (0)