kexec-installer: check ip command exit codes

This commit is contained in:
Jörg Thalheim 2022-11-25 09:50:47 +01:00
parent efb8452b0f
commit ddaae7671a

View file

@ -37,6 +37,7 @@ def main() -> None:
subprocess.run( subprocess.run(
["ip", "--json", "addr"], ["ip", "--json", "addr"],
capture_output=True, capture_output=True,
check=True
).stdout ).stdout
) )
@ -53,7 +54,8 @@ def main() -> None:
"dev", "dev",
current_interface["ifname"], current_interface["ifname"],
f'{addr["local"]}/{addr["prefixlen"]}', f'{addr["local"]}/{addr["prefixlen"]}',
] ],
check=True
) )
for route in routes: for route in routes:
if route["dev"] == interface["ifname"]: if route["dev"] == interface["ifname"]:
@ -68,7 +70,8 @@ def main() -> None:
route["gateway"], route["gateway"],
"dev", "dev",
current_interface["ifname"], current_interface["ifname"],
] ],
check=True
) )
else: else:
subprocess.run( subprocess.run(
@ -79,7 +82,8 @@ def main() -> None:
route["dst"], route["dst"],
"dev", "dev",
current_interface["ifname"], current_interface["ifname"],
] ],
check=True
) )