mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:31:33 +00:00
Restore latest snapshot if no date is provided
This commit is contained in:
parent
cbb807dfb4
commit
59dce4a848
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user