mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
fix empty policy building
This commit is contained in:
parent
59f347c135
commit
749f61aba6
@ -147,7 +147,8 @@ class ElasticSnapshot:
|
||||
def get_snapshot_stats(self):
|
||||
"""get snapshot info for frontend"""
|
||||
snapshot_info = self._build_policy_details()
|
||||
snapshot_info.update({"snapshots": self._get_all_snapshots()})
|
||||
if snapshot_info:
|
||||
snapshot_info.update({"snapshots": self._get_all_snapshots()})
|
||||
|
||||
return snapshot_info
|
||||
|
||||
@ -180,6 +181,9 @@ class ElasticSnapshot:
|
||||
def _build_policy_details(self):
|
||||
"""get additional policy details"""
|
||||
policy = self._get_policy()
|
||||
if not policy:
|
||||
return False
|
||||
|
||||
next_exec = policy["next_execution_millis"]
|
||||
next_exec_date = datetime.fromtimestamp(next_exec // 1000)
|
||||
next_exec_str = next_exec_date.strftime("%Y-%m-%d %H:%M")
|
||||
|
Loading…
Reference in New Issue
Block a user