in sdw_updater/UpdaterApp.py [0:0]
def _is_netcheck_successful() -> bool:
"""
Helper function to assess network connectivity before launching updater.
Assess network connectivity by checking connection status (via nmcli) in
sys-net.
"""
command = b"nmcli networking connectivity check"
if not Util.get_qubes_version():
logger.error("QubesOS not detected, cannot check network.")
return False
try:
# Use of `--pass-io` is required to check on network status, since
# nmcli returns 0 for all connection states we need to report back to dom0.
result = subprocess.check_output(["qvm-run", "-p", "sys-net", command])
return result.decode("utf-8").strip() == "full"
except subprocess.CalledProcessError as e:
logger.error(
"{} (connectivity check) failed; state reported as {}".format(
command.decode("utf-8"), e.output
)
)
return False