Skip to content

Commit

Permalink
Jira duplicated accounts checker (#1401)
Browse files Browse the repository at this point in the history
* Add duplicated account detection method

* Review import libs
  • Loading branch information
gonchik authored May 24, 2024
1 parent 928c899 commit a33822e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
31 changes: 31 additions & 0 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -5327,3 +5327,34 @@ def health_check(self):
# check as support tools
response = self.get("rest/supportHealthCheck/1.0/check/")
return response

def duplicated_account_checks_detail(self):
"""
Health check: Duplicate user accounts detail
https://confluence.atlassian.com/jirakb/health-check-duplicate-user-accounts-1063554355.html
:return:
"""
response = self.get("rest/api/2/user/duplicated/list")
return response

def duplicated_account_checks_flush(self):
"""
Health check: Duplicate user accounts by flush
The responses returned by the count and list methods are stored in the duplicate users cache for 10 minutes.
The cache is flushed automatically every time a directory
is added, deleted, enabled, disabled, reordered, or synchronized.
https://confluence.atlassian.com/jirakb/health-check-duplicate-user-accounts-1063554355.html
:return:
"""
params = {"flush": "true"}
response = self.get("rest/api/2/user/duplicated/list", params=params)
return response

def duplicated_account_checks_count(self):
"""
Health check: Duplicate user accounts count
https://confluence.atlassian.com/jirakb/health-check-duplicate-user-accounts-1063554355.html
:return:
"""
response = self.get("rest/api/2/user/duplicated/count")
return response
16 changes: 16 additions & 0 deletions docs/jira.rst
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,22 @@ Cluster methods (only for DC edition)
# Request current index from node (the request is processed asynchronously).
jira.request_current_index_from_node(node_id)
Health checks methods (only for on-prem edition)
------------------------------------------------
.. code-block:: python
# Get health status of Jira.
jira.health_check()
# Health check: Duplicate user accounts detail
jira.duplicated_account_checks_detail()
# Health check: Duplicate user accounts by flush
jira.duplicated_account_checks_flush()
# Health check: Duplicate user accounts count
jira.duplicated_account_checks_count()
TEMPO
----------------------
.. code-block:: python
Expand Down

0 comments on commit a33822e

Please sign in to comment.