From a33822ea8a03ea43ba2e97881fae495cd2856124 Mon Sep 17 00:00:00 2001 From: Gonchik Tsymzhitov Date: Sat, 25 May 2024 01:00:00 +0300 Subject: [PATCH] Jira duplicated accounts checker (#1401) * Add duplicated account detection method * Review import libs --- .github/workflows/test.yml | 2 +- atlassian/jira.py | 31 +++++++++++++++++++++++++++++++ docs/jira.rst | 16 ++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5caf88865..c95f0e7c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} diff --git a/atlassian/jira.py b/atlassian/jira.py index b5df79475..377bf56d2 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -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 diff --git a/docs/jira.rst b/docs/jira.rst index 17aee4095..08ad483ad 100644 --- a/docs/jira.rst +++ b/docs/jira.rst @@ -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