Skip to content

Commit cbe4186

Browse files
authored
add example for creating support zips (#712)
* adds support for generating support zips, and get_cluster_alive_nodes. * add example for creating support zips
1 parent f04a88a commit cbe4186

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# coding=utf-8
2+
from atlassian import Jira
3+
4+
jira = Jira(url="https://jira.example.com", username="mskymoore", password="admin")
5+
6+
alive_node_ids = [_["nodeId"] for _ in jira.get_cluster_alive_nodes()]
7+
8+
zips_creation_task_id = jira.generate_support_zip_on_nodes(alive_node_ids)["clusterTaskId"]
9+
10+
in_progress_zips = list()
11+
12+
while True:
13+
14+
for task in jira.check_support_zip_status(zips_creation_task_id)["tasks"]:
15+
16+
if task["status"] == "IN_PROGRESS":
17+
print(f"file {task['fileName']} {task['progressMessage']}")
18+
19+
if task["fileName"] not in in_progress_zips:
20+
in_progress_zips.append(task["fileName"])
21+
22+
else:
23+
support_zip = jira.download_support_zip(task["fileName"])
24+
25+
with open(task["fileName"], "wb") as fp:
26+
fp.write(support_zip)
27+
28+
print(f"{task['fileName']} written.")
29+
30+
if task["fileName"] in in_progress_zips:
31+
in_progress_zips.remove(task["fileName"])
32+
33+
if len(in_progress_zips) == 0:
34+
break

0 commit comments

Comments
 (0)