Skip to content

Commit f04a88a

Browse files
authored
adds support for generating support zips, and get_cluster_alive_nodes. (#711)
1 parent 71b2bce commit f04a88a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

atlassian/jira.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,46 @@ def set_node_to_offline(self, node_id):
278278
url = "rest/api/2/cluster/node/{}/offline".format(node_id)
279279
return self.put(url)
280280

281+
def get_cluster_alive_nodes(self):
282+
"""
283+
Get cluster nodes where alive = True
284+
:return: list of node dicts
285+
"""
286+
return [_ for _ in self.get_cluster_all_nodes() if _["alive"]]
287+
288+
"""
289+
Troubleshooting. (Available for DC) It gives the posibility to download support zips.
290+
Reference: https://confluence.atlassian.com/support/create-a-support-zip-using-the-rest-api-in-data-center-applications-952054641.html
291+
"""
292+
293+
def generate_support_zip_on_nodes(self, node_ids):
294+
"""
295+
Generate a support zip on targeted nodes of a cluster
296+
:param node_ids: list
297+
:return: dict representing cluster task created
298+
"""
299+
data = {"nodeIds": node_ids}
300+
url = "/rest/troubleshooting/latest/support-zip/cluster"
301+
return self.post(url, data=data)
302+
303+
def check_support_zip_status(self, cluster_task_id):
304+
"""
305+
Check status of support zip creation task
306+
:param cluster_task_id: str
307+
:return:
308+
"""
309+
url = "/rest/troubleshooting/latest/support-zip/status/cluster/{}".format(cluster_task_id)
310+
return self.get(url)
311+
312+
def download_support_zip(self, file_name):
313+
"""
314+
Download created support zip file
315+
:param file_name: str
316+
:return: bytes of zip file
317+
"""
318+
url = "/rest/troubleshooting/latest/support-zip/download/{}".format(file_name)
319+
return self.get(url, advanced_mode=True).content
320+
281321
"""
282322
ZDU (Zero Downtime upgrade) module. (Available for DC)
283323
Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/cluster/zdu

0 commit comments

Comments
 (0)