qontract-reconcile 0.10.1rc730__py3-none-any.whl → 0.10.1rc732__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc730
3
+ Version: 0.10.1rc732
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -46,7 +46,7 @@ reconcile/jenkins_roles.py,sha256=f8ELpZY36UjoaCpR_9LijQuIMuB6a7sVLFf_H1ct9Hc,44
46
46
  reconcile/jenkins_webhooks.py,sha256=j8vhJMWcRhOdc9XzRSm0CPj84jsF3e4Syjm7r1BIsDE,1978
47
47
  reconcile/jenkins_webhooks_cleaner.py,sha256=JsN_NVPfZJwv1JtSzZXDIHUqGiefL-DRffFnDGau9aY,1539
48
48
  reconcile/jenkins_worker_fleets.py,sha256=PMNGOX0krubFjInPiFT0za0KCiWBLEcVDuXdKRd1BrE,5378
49
- reconcile/jira_permissions_validator.py,sha256=9aLSsKKRlilk4W_jwo5hqMMzdJIYJIgXt7E7WVX3Mp4,11410
49
+ reconcile/jira_permissions_validator.py,sha256=8Nl7rSc8x_AXXVRYvRlq_arR7N5pz0YM4M7Pb60RoCg,11597
50
50
  reconcile/jira_watcher.py,sha256=eyOQ92t8TFi6gogfNTO448h_h1CUyr24E0MPHc51R-o,3617
51
51
  reconcile/ldap_users.py,sha256=uEWQ0V41tN9KCZi4ZKPamjrJ6djSpdpvDBo7yJ0e7ZI,3008
52
52
  reconcile/mr_client_gateway.py,sha256=WhjMd-sIXDFCV8-rt8CEjurJ5OYB1pOD0K3o0tZRXQg,1885
@@ -451,7 +451,7 @@ reconcile/test/test_gitlab_members.py,sha256=dP_dm-1THba9Vyzcq-EX1tdmBoX2hq8R-MY
451
451
  reconcile/test/test_instrumented_wrappers.py,sha256=CZzhnQH0c4i7-Rxjg7-0dfFMvVPegLHL46z5NHOOCwo,608
452
452
  reconcile/test/test_integrations_manager.py,sha256=l6KwSFT0NS9VSR-b_9z_ZEGXDWH3EMitUEMC_1h8Xkk,38184
453
453
  reconcile/test/test_jenkins_worker_fleets.py,sha256=o1jlT7OBBSgu0M3iI4xMdz_x6SciF7yhNBpLk5gTJfg,2361
454
- reconcile/test/test_jira_permissions_validator.py,sha256=Dlyh7hsZHeEiIqlMBGMxuCUY0fY4erYWuvuxscxVYNA,15018
454
+ reconcile/test/test_jira_permissions_validator.py,sha256=zhtAL97IkCyY9R29fDRvDCE1z9S7OVQV7gqu-7Vo5-4,16279
455
455
  reconcile/test/test_jump_host.py,sha256=yczTqvT-hNAf9zBMuFjqka9fQOA31SCNG7D-9K9MRPw,3323
456
456
  reconcile/test/test_ldap_users.py,sha256=8jjzVgoiRRylGad6-TvkugoFGXt3eko--zVVKjmZDn4,3812
457
457
  reconcile/test/test_make.py,sha256=zTdjgq-3idFlec_0qJenk9wWw0QMLvSpJfPsptXmync,677
@@ -607,7 +607,7 @@ reconcile/utils/helpers.py,sha256=k9svgFFZG7H5FvHYY0g5jJyvgvh2UDZxf0Ib221teag,11
607
607
  reconcile/utils/imap_client.py,sha256=byFAJATbITJPsGECSbvXBOcCnoeTUpDFiEjzOAxLm_U,1975
608
608
  reconcile/utils/instrumented_wrappers.py,sha256=eVwMoa6FCrYxLv3RML3WpZF9qKVfCTjMxphgVXG03OM,1073
609
609
  reconcile/utils/jenkins_api.py,sha256=MyJSB_S3uYf3sXnt9t03-gZNQ7tbdd7Wusv3MoF2fRc,7113
610
- reconcile/utils/jira_client.py,sha256=geozBG45AM_z2Fisrhqw-fSkmvikyrKIb9XARn-Q-AE,7186
610
+ reconcile/utils/jira_client.py,sha256=2m512wPgbKCq8PIXRmqsowsQ2nm7FBXoMkIzRcIYnFs,7197
611
611
  reconcile/utils/jjb_client.py,sha256=Pdy0dLCFvD6GPCaC0tZydYgkVJPOxYXIiwWECZaFJBU,14551
612
612
  reconcile/utils/jsonpath.py,sha256=NRpAEijKN4cMDjo7qivNPqpm0__GQQ1TiE0PBEBO45s,5572
613
613
  reconcile/utils/jump_host.py,sha256=AdwmCZYNhRe53VwV2iAsUdVyUdVtSd4REmdThJDkM5w,4973
@@ -765,8 +765,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
765
765
  tools/test/test_qontract_cli.py,sha256=UEwAW7PA_GIrbqzaLxpkCxbuVjEFLNvnVG-6VyoCGIc,4147
766
766
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
767
767
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
768
- qontract_reconcile-0.10.1rc730.dist-info/METADATA,sha256=qWTRMGV0QFNLswRaHu95JKig3P9sjJXkrcbUA4eDCNA,2382
769
- qontract_reconcile-0.10.1rc730.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
770
- qontract_reconcile-0.10.1rc730.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
771
- qontract_reconcile-0.10.1rc730.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
772
- qontract_reconcile-0.10.1rc730.dist-info/RECORD,,
768
+ qontract_reconcile-0.10.1rc732.dist-info/METADATA,sha256=4rmuaKPir4Lu33OJNP5bw1qkG75V2Wy6G17RbQ99SkM,2382
769
+ qontract_reconcile-0.10.1rc732.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
770
+ qontract_reconcile-0.10.1rc732.dist-info/entry_points.txt,sha256=rIxI5zWtHNlfpDeq1a7pZXAPoqf7HG32KMTN3MeWK_8,429
771
+ qontract_reconcile-0.10.1rc732.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
772
+ qontract_reconcile-0.10.1rc732.dist-info/RECORD,,
@@ -166,12 +166,16 @@ def board_is_valid(
166
166
  )
167
167
  error |= ValidationError.INVALID_PRIORITY
168
168
  except JIRAError as e:
169
- if e.status_code != 403:
169
+ if e.status_code == 401:
170
+ # sporadic 401 errors, retrying
171
+ logging.debug(f"[{board.name}] sporadic 401 error! Retry later.")
172
+ elif e.status_code == 403:
173
+ logging.error(
174
+ f"[{board.name}] AppSRE Jira Bot user does not have all necessary permissions. Try granting the user the administrator permissions. API URL: {e.url}"
175
+ )
176
+ error |= ValidationError.PERMISSION_ERROR
177
+ else:
170
178
  raise
171
- logging.error(
172
- f"[{board.name}] AppSRE Jira Bot user does not have all necessary permissions. Try granting the user the administrator permissions. API URL: {e.url}"
173
- )
174
- error |= ValidationError.PERMISSION_ERROR
175
179
 
176
180
  return error
177
181
 
@@ -430,7 +430,7 @@ def test_jira_permissions_validator_board_is_valid_exception(
430
430
  },
431
431
  )
432
432
  jira_client = mocker.create_autospec(spec=JiraClient)
433
- jira_client.can_create_issues.side_effect = JIRAError(status_code=401)
433
+ jira_client.can_create_issues.side_effect = JIRAError(status_code=500)
434
434
  with pytest.raises(JIRAError):
435
435
  board_is_valid(
436
436
  jira=jira_client,
@@ -440,3 +440,41 @@ def test_jira_permissions_validator_board_is_valid_exception(
440
440
  jira_server_priorities={"Minor": "1", "Major": "2", "Critical": "3"},
441
441
  public_projects=[],
442
442
  )
443
+
444
+
445
+ def test_jira_permissions_validator_board_is_valid_exception_401(
446
+ mocker: MockerFixture, gql_class_factory: Callable
447
+ ) -> None:
448
+ board = gql_class_factory(
449
+ JiraBoardV1,
450
+ {
451
+ "name": "jira-board-default",
452
+ "server": {
453
+ "serverUrl": "https://jira-server.com",
454
+ "token": {"path": "vault/path/token", "field": "token"},
455
+ },
456
+ "issueType": "bug",
457
+ "issueResolveState": "Closed",
458
+ "issueReopenState": "Open",
459
+ "issueSecurityId": "32168",
460
+ "severityPriorityMappings": {
461
+ "name": "major-major",
462
+ "mappings": [
463
+ {"priority": "Minor"},
464
+ {"priority": "Major"},
465
+ {"priority": "Critical"},
466
+ ],
467
+ },
468
+ },
469
+ )
470
+ jira_client = mocker.create_autospec(spec=JiraClient)
471
+ jira_client.can_create_issues.side_effect = JIRAError(status_code=401)
472
+ # no error for 401
473
+ board_is_valid(
474
+ jira=jira_client,
475
+ board=board,
476
+ default_issue_type="task",
477
+ default_reopen_state="new",
478
+ jira_server_priorities={"Minor": "1", "Major": "2", "Critical": "3"},
479
+ public_projects=[],
480
+ )
@@ -96,14 +96,11 @@ class JiraClient:
96
96
  if settings and settings["jiraWatcher"]:
97
97
  read_timeout = settings["jiraWatcher"]["readTimeout"]
98
98
  connect_timeout = settings["jiraWatcher"]["connectTimeout"]
99
+ self.timeout = (read_timeout, connect_timeout)
99
100
  if not self.server:
100
101
  raise RuntimeError("JiraClient.server is not set.")
101
102
 
102
- self.jira = JIRA(
103
- self.server,
104
- token_auth=token_auth,
105
- timeout=(read_timeout, connect_timeout),
106
- )
103
+ self.jira = JIRA(self.server, token_auth=token_auth, timeout=self.timeout)
107
104
 
108
105
  @staticmethod
109
106
  def create(
@@ -218,7 +215,7 @@ class JiraClient:
218
215
  raise RuntimeError("JiraClient.server is not set.")
219
216
 
220
217
  # use anonymous access to get public projects
221
- jira_api_anon = JIRA(server=self.server)
218
+ jira_api_anon = JIRA(server=self.server, timeout=self.timeout)
222
219
  return [project.key for project in jira_api_anon.projects()]
223
220
 
224
221
  def components(self) -> list[str]: