def system_requirements(): """ Check if all necessary packages are installed on system :return: None or raise exception if some tooling is missing """ command_exists( "systemd-run", ["systemd-run", "--help"], "Command systemd-run does not seems to be present on your system. " "Do you have system with systemd?") command_exists( "machinectl", ["machinectl", "--no-pager", "--help"], "Command machinectl does not seems to be present on your system. " "Do you have system with systemd?")
def system_requirements(): """ Check if all necessary packages are installed on system :return: None or raise exception if some tooling is missing """ command_exists("systemd-nspawn", ["systemd-nspawn", "--version"], "Command systemd-nspawn does not seems to be present on your system" "Do you have system with systemd") command_exists( "machinectl", ["machinectl", "--no-pager", "--help"], "Command machinectl does not seems to be present on your system" "Do you have system with systemd") if "Enforcing" in run_cmd(["getenforce"], return_output=True, ignore_status=True): logger.error("Please disable selinux (setenforce 0), selinux blocks some nspawn operations" "This may lead to strange behaviour")
def system_requirements(): """ Check if all necessary packages are installed on system :return: None or raise exception if some tooling is missing """ command_exists("losetup", ["losetup", "-V"], "losetup is not present on your system") command_exists("partprobe", ["partprobe", "-v"], "partprobe is not present on your system") command_exists("mount", ["mount", "-V"], "mount is not present on your system")
def test_command_exists(): m = "msg" command_exists("printf", ["printf", "--version"], m) with pytest.raises(CommandDoesNotExistException) as exc: command_exists("printof", ["printof", "--versionotron"], m) assert exc.value.msg == m