Commit ec1fa1db authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

fix takeover cgi script

if last_backup was an int, the script failed with this error:

result undefined, global datetime = <module 'datetime' from '/srv/slapgrid/
slappart6...6d33cee74/lib/python2.7/lib-dynload/datetime.so'>,
datetime.datetime = <type 'datetime.datetime'>,
datetime.datetime.fromtimestamp = <built-in method fromtimestamp of type
object>, last_backup = '1587724103'
<type 'exceptions.TypeError'>: a float is required
      args = ('a float is required',)
      message = 'a float is required'
parent b286c347
...@@ -46,7 +46,7 @@ md5sum = d21472f0e58f928fb827f2cbf22c4d4a ...@@ -46,7 +46,7 @@ md5sum = d21472f0e58f928fb827f2cbf22c4d4a
[resilient-web-takeover-cgi-script-download] [resilient-web-takeover-cgi-script-download]
filename = resilient-web-takeover-cgi-script.py.in filename = resilient-web-takeover-cgi-script.py.in
md5sum = a7d6ca463e4b6438e1d826f531533a39 md5sum = 7a0f1be7e9d05d0c68748322abe1f511
[template-wrapper] [template-wrapper]
filename = templates/wrapper.in filename = templates/wrapper.in
......
...@@ -53,7 +53,7 @@ def getLatestBackupDate(): ...@@ -53,7 +53,7 @@ def getLatestBackupDate():
timestamp = float(db[callback]) timestamp = float(db[callback])
if timestamp > last_backup: if timestamp > last_backup:
last_backup = timestamp last_backup = timestamp
result = datetime.datetime.fromtimestamp(last_backup) result = datetime.datetime.fromtimestamp(float(last_backup))
db.close() db.close()
shutil.rmtree(temporary_directory) shutil.rmtree(temporary_directory)
return result return result
......
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 to comment