Restore latest snapshot if no date is provided

This commit is contained in:
Kristóf Tóth 2018-08-06 14:55:58 +02:00
parent cbb807dfb4
commit 59dce4a848

View File

@ -4,6 +4,7 @@
from os.path import join as joinpath from os.path import join as joinpath
from os.path import basename from os.path import basename
from os import makedirs from os import makedirs
from datetime import datetime
from dateutil import parser as dateparser from dateutil import parser as dateparser
@ -55,7 +56,12 @@ class DirectorySnapshottingEventHandler(EventHandlerBase):
return data return data
def handle_restore_snapshot(self, data): def handle_restore_snapshot(self, data):
date = dateparser.parse(data['value']) date = dateparser.parse(
data.get(
'value',
datetime.now().isoformat()
)
)
LOG.debug( LOG.debug(
'Restoring snapshots (@ %s) of directories %s', 'Restoring snapshots (@ %s) of directories %s',
date, date,