本文整理汇总了Python中cuckoo.common.files.Folders.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Folders.delete方法的具体用法?Python Folders.delete怎么用?Python Folders.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cuckoo.common.files.Folders
的用法示例。
在下文中一共展示了Folders.delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_invld
# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
def test_delete_invld(self):
"""Test deletion of a folder we can't access."""
dirpath = tempfile.mkdtemp()
os.chmod(dirpath, 0)
with pytest.raises(CuckooOperationalError):
Folders.delete(dirpath)
os.chmod(dirpath, 0775)
Folders.delete(dirpath)
示例2: tasks_delete
# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
def tasks_delete(task_id):
response = {}
task = db.view_task(task_id)
if not task:
return json_error(404, "Task not found")
if task.status == TASK_RUNNING:
return json_error(
500, "The task is currently being processed, cannot delete"
)
if not db.delete_task(task_id):
return json_error(
500, "An error occurred while trying to delete the task"
)
Folders.delete(cwd("storage", "analyses", "%d" % task_id))
response["status"] = "OK"
return jsonify(response)
示例3: task_delete
# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
def task_delete(request, task_id):
"""
Deletes a task
:param body: required: task_id
:return:
"""
task = db.view_task(task_id)
if task:
if task.status == TASK_RUNNING:
return json_fatal_response("The task is currently being "
"processed, cannot delete")
if db.delete_task(task_id):
Folders.delete(os.path.join(cwd(), "storage",
"analyses", "%d" % task_id))
else:
return json_fatal_response("An error occurred while trying to "
"delete the task")
else:
return json_error_response("Task not found")
return JsonResponse({"status": True})
示例4: test_delete_folder2
# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
def test_delete_folder2(self):
"""Tests folder deletion #2."""
Folders.create(self.tmp_dir, "foo")
assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
Folders.delete(self.tmp_dir, "foo")
assert not os.path.exists(os.path.join(self.tmp_dir, "foo"))