mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 01:19:29 +00:00
fix empty policy building
This commit is contained in:
@@ -147,7 +147,8 @@ class ElasticSnapshot:
|
|||||||
def get_snapshot_stats(self):
|
def get_snapshot_stats(self):
|
||||||
"""get snapshot info for frontend"""
|
"""get snapshot info for frontend"""
|
||||||
snapshot_info = self._build_policy_details()
|
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
|
return snapshot_info
|
||||||
|
|
||||||
@@ -180,6 +181,9 @@ class ElasticSnapshot:
|
|||||||
def _build_policy_details(self):
|
def _build_policy_details(self):
|
||||||
"""get additional policy details"""
|
"""get additional policy details"""
|
||||||
policy = self._get_policy()
|
policy = self._get_policy()
|
||||||
|
if not policy:
|
||||||
|
return False
|
||||||
|
|
||||||
next_exec = policy["next_execution_millis"]
|
next_exec = policy["next_execution_millis"]
|
||||||
next_exec_date = datetime.fromtimestamp(next_exec // 1000)
|
next_exec_date = datetime.fromtimestamp(next_exec // 1000)
|
||||||
next_exec_str = next_exec_date.strftime("%Y-%m-%d %H:%M")
|
next_exec_str = next_exec_date.strftime("%Y-%m-%d %H:%M")
|
||||||
|
|||||||
Reference in New Issue
Block a user