Commit 1f9af3ae by Guba Sándor

storage: adding delete_dump

parent 13f7ec45
import json
import os import os
import subprocess import subprocess
import re import re
...@@ -32,6 +33,9 @@ class Disk(object): ...@@ -32,6 +33,9 @@ class Disk(object):
@classmethod @classmethod
def deserialize(cls, desc): def deserialize(cls, desc):
logging.info(desc)
if isinstance(desc, basestring):
desc = json.loads(desc)
return cls(**desc) return cls(**desc)
def get_desc(self): def get_desc(self):
......
from disk import Disk from disk import Disk
from storagecelery import celery from storagecelery import celery
from os import path, unlink
@celery.task() @celery.task()
def list(dir): def list(dir):
...@@ -20,6 +20,12 @@ def delete(json_data): ...@@ -20,6 +20,12 @@ def delete(json_data):
@celery.task() @celery.task()
def delete_dump():
if path.endswith(".dump") and os.path.isfile(path):
os.unlink(path)
@celery.task()
def snapshot(json_data): def snapshot(json_data):
disk = Disk.deserialize(json_data) disk = Disk.deserialize(json_data)
disk.snapshot() disk.snapshot()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment