Skip to content

Commit b8d4ab0

Browse files
author
Gonchik Tsymzhitov
committed
Add example with deindexer
1 parent 6f0dc18 commit b8d4ab0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

examples/jira/jira_index_fixer.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from atlassian import Jira
2+
3+
JIRA_NODE_URL = "JIRA_NODES_1"
4+
JIRA_LOGIN = "admin"
5+
JIRA_PASSWD = "admin"
6+
7+
8+
class IndexFixer(Jira):
9+
def deindex_issue(self, issue_id):
10+
# own end point to deindex
11+
url = "deindexIssue.jsp"
12+
params = {"issueId": issue_id}
13+
return self.get(url, params=params)
14+
15+
16+
s = IndexFixer(url=JIRA_NODE_URL, username=JIRA_LOGIN, password=JIRA_PASSWD)
17+
response = s.index_checker()
18+
print(response)
19+
fixer = False
20+
index_orphant_issues_count = response["indexOrphansCount"]
21+
if index_orphant_issues_count > 0:
22+
index_orphant_issues = response["indexOrphans"]
23+
for ticket in index_orphant_issues:
24+
ticket_id = ticket["issueId"]
25+
print("Orphan index for ticket id = {}".format(ticket_id))
26+
if fixer:
27+
s.deindex_issue(ticket_id)

0 commit comments

Comments
 (0)