本文整理匯總了Python中virtinst.VirtualDisk.fix_path_search_for_user方法的典型用法代碼示例。如果您正苦於以下問題:Python VirtualDisk.fix_path_search_for_user方法的具體用法?Python VirtualDisk.fix_path_search_for_user怎麽用?Python VirtualDisk.fix_path_search_for_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類virtinst.VirtualDisk
的用法示例。
在下文中一共展示了VirtualDisk.fix_path_search_for_user方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_path_search_for_qemu
# 需要導入模塊: from virtinst import VirtualDisk [as 別名]
# 或者: from virtinst.VirtualDisk import fix_path_search_for_user [as 別名]
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())