fix empty policy building

pull/357/head
simon 2 years ago
parent 59f347c135
commit 749f61aba6
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

@ -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…
Cancel
Save