Пример #1
0
def check_path_search_for_qemu(parent, conn, path):
    set_error_parent(parent)

    if conn.is_remote() or not conn.is_qemu_system():
        return

    user = util.running_config.default_qemu_user

    skip_paths = util.running_config.get_perms_fix_ignore()
    broken_paths = VirtualDisk.check_path_search_for_user(conn.vmm, path, user)
    for p in broken_paths:
        if p in skip_paths:
            broken_paths.remove(p)

    if not broken_paths:
        return

    logging.debug("No search access for dirs: %s", broken_paths)
    resp, chkres = err_dial.warn_chkbox(
                    _("The emulator may not have search permissions "
                      "for the path '%s'.") % path,
                    _("Do you want to correct this now?"),
                    _("Don't ask about these directories again."),
                    buttons=gtk.BUTTONS_YES_NO)

    if chkres:
        util.running_config.add_perms_fix_ignore(broken_paths)
    if not resp:
        return

    logging.debug("Attempting to correct permission issues.")
    errors = VirtualDisk.fix_path_search_for_user(conn.vmm, path, user)
    if not errors:
        return

    errmsg = _("Errors were encountered changing permissions for the "
               "following directories:")
    details = ""
    for path, error in errors.items():
        if path not in broken_paths:
            continue
        details += "%s : %s\n" % (path, error)

    logging.debug("Permission errors:\n%s", details)

    ignore, chkres = err_dial.err_chkbox(errmsg, details,
                         _("Don't ask about these directories again."))

    if chkres:
        util.running_config.add_perms_fix_ignore(errors.keys())