mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-13 04:48:22 +00:00
Merge branch '1.5' into 2.0
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import stat
|
||||
import logging
|
||||
import aiohttp
|
||||
import shutil
|
||||
@ -230,11 +231,13 @@ class BaseNode:
|
||||
"""
|
||||
Delete the node (including all its files).
|
||||
"""
|
||||
def set_rw(operation, name, exc):
|
||||
os.chmod(name, stat.S_IWRITE)
|
||||
|
||||
directory = self.project.node_working_directory(self)
|
||||
if os.path.exists(directory):
|
||||
try:
|
||||
yield from wait_run_in_executor(shutil.rmtree, directory)
|
||||
yield from wait_run_in_executor(shutil.rmtree, directory, onerror=set_rw)
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="Could not delete the node working directory: {}".format(e))
|
||||
|
||||
|
Reference in New Issue
Block a user