Skip to content

Commit

Permalink
Fix delete snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-duponchelle committed Jul 26, 2016
1 parent cf71288 commit e3d9c3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions gns3server/controller/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def __init__(self, project, name=None, filename=None):
if name:
self._name = name
self._created_at = datetime.now().timestamp()
filename = self._name + "_" + datetime.utcfromtimestamp(self._created_at).replace(tzinfo=None).strftime(FILENAME_TIME_FORMAT) + ".gns3project"
else:
filename = filename.split(".")[0]
self._name = filename.split("_")[0]
filename = filename.replace(self._name + "_", "")
datestring = filename.replace(self._name + "_", "").split(".")[0]
try:
self._created_at = datetime.strptime(filename, FILENAME_TIME_FORMAT).replace(tzinfo=timezone.utc).timestamp()
self._created_at = datetime.strptime(datestring, FILENAME_TIME_FORMAT).replace(tzinfo=timezone.utc).timestamp()
except ValueError:
self._created_at = datetime.utcnow().timestamp()
self._path = os.path.join(project.path, "snapshots", self._name + "_" + datetime.utcfromtimestamp(self._created_at).replace(tzinfo=None).strftime(FILENAME_TIME_FORMAT) + ".gns3project")
self._path = os.path.join(project.path, "snapshots", filename)

@property
def id(self):
Expand Down
1 change: 0 additions & 1 deletion gns3server/handlers/api/controller/snapshot_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ def delete(request, response):
controller = Controller.instance()
project = controller.get_project(request.match_info["project_id"])
yield from project.delete_snapshot(request.match_info["snapshot_id"])
controller.remove_project(project)
response.set_status(204)

0 comments on commit e3d9c3b

Please sign in to comment.