qontract-reconcile 0.10.2.dev254__py3-none-any.whl → 0.10.2.dev256__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.
- {qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/METADATA +3 -3
- {qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/RECORD +15 -15
- reconcile/gql_definitions/common/users.py +0 -1
- reconcile/gql_definitions/fragments/user.py +0 -1
- reconcile/gql_definitions/membershipsources/roles.py +0 -2
- reconcile/gql_definitions/openshift_groups/managed_roles.py +0 -1
- reconcile/gql_definitions/slack_usergroups/permissions.py +0 -1
- reconcile/gql_definitions/slack_usergroups/users.py +0 -1
- reconcile/queries.py +0 -2
- reconcile/slack_usergroups.py +1 -1
- reconcile/utils/gql.py +36 -26
- reconcile/utils/membershipsources/models.py +0 -1
- reconcile/utils/slack_api.py +12 -3
- {qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.2.
|
3
|
+
Version: 0.10.2.dev256
|
4
4
|
Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
|
5
5
|
Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
|
6
6
|
Project-URL: repository, https://github.com/app-sre/qontract-reconcile
|
@@ -392,7 +392,7 @@ these tools for static analysis and type checking:
|
|
392
392
|
The [Makefile](Makefile) contains several targets to help with testing, linting,
|
393
393
|
formatting, and type checking:
|
394
394
|
|
395
|
-
- `make all-
|
395
|
+
- `make all-tests`: Run all available tests.
|
396
396
|
- `make linter-test`: Run the linter and formatter tests.
|
397
397
|
- `make types-test`: Run the type checker tests.
|
398
398
|
- `make qenerate-test`: Run the query classes generation tests.
|
@@ -422,7 +422,7 @@ Start the [qontract-server](https://github.com/app-sre/qontract-server) in a dif
|
|
422
422
|
Run this in the root dir of `qontract-server` repo:
|
423
423
|
|
424
424
|
```shell
|
425
|
-
make dev
|
425
|
+
make build-dev
|
426
426
|
```
|
427
427
|
|
428
428
|
### Trigger integration
|
{qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/RECORD
RENAMED
@@ -88,7 +88,7 @@ reconcile/quay_mirror.py,sha256=PBooiA0ShZpWYfO6oeKFqYYT6Syi7Q8JJD9kj0wRRLg,1403
|
|
88
88
|
reconcile/quay_mirror_org.py,sha256=I-tEqRHLL6uFqbSi7qCfPuDNoae7EAI2U68NbDOhmv8,10809
|
89
89
|
reconcile/quay_permissions.py,sha256=9KOutS1w4RFQqkvMSy54VtsKNx56-phzP6yI_rEW-B8,4244
|
90
90
|
reconcile/quay_repos.py,sha256=cuEYG0HUe0ut5yvLdEwOF5-CmccpXQHRb_wDazvDrvQ,6895
|
91
|
-
reconcile/queries.py,sha256=
|
91
|
+
reconcile/queries.py,sha256=PRlDXp-ViYjky3k4-Cvf6FptraOpzVpsZUluUEJW7II,49886
|
92
92
|
reconcile/query_validator.py,sha256=MSh5pKLBksws4AqfuvT8nrIGucIbqX-IOzYyPYTLO7k,1491
|
93
93
|
reconcile/requests_sender.py,sha256=914iluuF4UVgG3VyxxtnHOu4yf6YKS2fIy6PViSsFTQ,3875
|
94
94
|
reconcile/resource_scraper.py,sha256=znXCHrU7YwPfKuxGBiUrV7T1tYtn4vlz9qmZlfy6Flg,2307
|
@@ -99,7 +99,7 @@ reconcile/sendgrid_teammates.py,sha256=oO8QbLb4s1o8A6CGiCagN9CmS05BSS_WLztuY0Ym9
|
|
99
99
|
reconcile/service_dependencies.py,sha256=G2qCuYFc8wQLpRxkdhmibxSAl3nUM3hcan4x50W_mCA,4335
|
100
100
|
reconcile/signalfx_endpoint_monitoring.py,sha256=Nqgsg1cflSd2nNnm89y_e8c--7xLUqTrKOHkDs-qADE,2868
|
101
101
|
reconcile/slack_base.py,sha256=I-msunWxfgu5bSwXYulGbtLjxUB_tRmTCAUCU-3nabI,3484
|
102
|
-
reconcile/slack_usergroups.py,sha256=
|
102
|
+
reconcile/slack_usergroups.py,sha256=HYuzaT4P7mX1EGG9w6rocx2sgTVRbAkIgcBsxNRY2XA,30190
|
103
103
|
reconcile/sql_query.py,sha256=auZCWe6dytsDp83Imfo4zqkpMCLRXU007IUlPeUE3j4,26376
|
104
104
|
reconcile/status.py,sha256=cY4IJFXemhxptRJqR4qaaOWqei9e4jgLXuVSGajMsjg,544
|
105
105
|
reconcile/status_board.py,sha256=3AiFdG-W4sKdU_pq9sKANtpgSoOGi8JwGMEHu3KetDQ,15298
|
@@ -285,7 +285,7 @@ reconcile/gql_definitions/common/saasherder_settings.py,sha256=nqQLcMwYxLseqq0BE
|
|
285
285
|
reconcile/gql_definitions/common/slack_workspaces.py,sha256=2o0kgi4QiaRuNmZJnc_By4F6NsKIdRaXkrufRQw7Nok,1753
|
286
286
|
reconcile/gql_definitions/common/smtp_client_settings.py,sha256=JU6t6D-Qj-z1gLlgUiHKe0W7AxWQdty9jlv-ig_43tM,2248
|
287
287
|
reconcile/gql_definitions/common/state_aws_account.py,sha256=LAdpCG2-ykVpWBPO0Zu1WvG-hwKXyDC0fJQxJRpbqCk,2198
|
288
|
-
reconcile/gql_definitions/common/users.py,sha256=
|
288
|
+
reconcile/gql_definitions/common/users.py,sha256=q5Q1zTJ2SAfXTwU_j4rMT9kDr5_u0zGr7JDBN8X3vfU,1688
|
289
289
|
reconcile/gql_definitions/common/users_with_paths.py,sha256=kOYzIXKG11JI0afgRMA5WLlEwJlvElAKytE8RAeuSco,2726
|
290
290
|
reconcile/gql_definitions/cost_report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
291
291
|
reconcile/gql_definitions/cost_report/app_names.py,sha256=fzqYXyiTSll359J1F1o7qapco0MSxgs3sr_Ssb2Kbns,1786
|
@@ -340,7 +340,7 @@ reconcile/gql_definitions/fragments/saas_target_namespace.py,sha256=6f6WaerElaRi
|
|
340
340
|
reconcile/gql_definitions/fragments/serviceaccount_token.py,sha256=2pG4rxAjvT-YsFBnm4zl301i7DCYznp99HOEGA-216I,1117
|
341
341
|
reconcile/gql_definitions/fragments/terraform_state.py,sha256=S5QuTR9YlvUObiU7hevS9ybxZEssWoRGqCR9YtGwePs,1024
|
342
342
|
reconcile/gql_definitions/fragments/upgrade_policy.py,sha256=cVza8zfra1E3yBsHiS-hKbys17fvv572GFnKshJjluE,1246
|
343
|
-
reconcile/gql_definitions/fragments/user.py,sha256=
|
343
|
+
reconcile/gql_definitions/fragments/user.py,sha256=GfR82KoUSiOhXrSqKhgCtc_rBHOSL2kCSW5BVynd668,954
|
344
344
|
reconcile/gql_definitions/fragments/vault_secret.py,sha256=8xoQJNx1jKw_1yradq1iLEYWzuOHra1bEHHU7WHKxqo,833
|
345
345
|
reconcile/gql_definitions/gcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
346
346
|
reconcile/gql_definitions/gcp/gcp_docker_repos.py,sha256=HvNaJxQYNPBTDmk26cOUY5_C5oBfau4bdfuI-L1Vcps,3338
|
@@ -370,7 +370,7 @@ reconcile/gql_definitions/ldap_groups/settings.py,sha256=KR6eKqXQWVYZAUEdatL1RCA
|
|
370
370
|
reconcile/gql_definitions/maintenance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
371
371
|
reconcile/gql_definitions/maintenance/maintenances.py,sha256=ObAoOHUrTxL1l8CUhdOACc1s49Pt5j1fsErXE49fs1g,3042
|
372
372
|
reconcile/gql_definitions/membershipsources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
373
|
-
reconcile/gql_definitions/membershipsources/roles.py,sha256=
|
373
|
+
reconcile/gql_definitions/membershipsources/roles.py,sha256=xcl1kHy7i1RzXlpPtvdbfZwGH5dr4xUYfpFR9s62Bmg,3586
|
374
374
|
reconcile/gql_definitions/ocm_labels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
375
375
|
reconcile/gql_definitions/ocm_labels/clusters.py,sha256=K0DaTnOEdCZAziDbmq3Ktrxzzmzy6sdb3-9kIDk6yao,2932
|
376
376
|
reconcile/gql_definitions/ocm_labels/organizations.py,sha256=ylNna62pG3XidrLQtMwu0LIOsKh6qyC2QImCbur2tV4,2252
|
@@ -380,7 +380,7 @@ reconcile/gql_definitions/openshift_cluster_bots/__init__.py,sha256=47DEQpj8HBSa
|
|
380
380
|
reconcile/gql_definitions/openshift_cluster_bots/clusters.py,sha256=QshhCQeFRu_o0DLpD-4ltT5X_xZHjsCLc5jB3an3UXs,3688
|
381
381
|
reconcile/gql_definitions/openshift_groups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
382
382
|
reconcile/gql_definitions/openshift_groups/managed_groups.py,sha256=mBWZX9xxeW3eB1ylnAI5x_7UBacRqJf_H6um-fB_nKc,2013
|
383
|
-
reconcile/gql_definitions/openshift_groups/managed_roles.py,sha256=
|
383
|
+
reconcile/gql_definitions/openshift_groups/managed_roles.py,sha256=9gS7UtTuI2XxxE9d-NEiJ0CSlmqYcPiXfaxw3q-LIQs,2610
|
384
384
|
reconcile/gql_definitions/openshift_serviceaccount_tokens/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
385
385
|
reconcile/gql_definitions/openshift_serviceaccount_tokens/tokens.py,sha256=FeraeQThHl2UbhTuCPDwm3ltczF_jfZn5E3Squ8-znw,3313
|
386
386
|
reconcile/gql_definitions/quay_membership/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -400,8 +400,8 @@ reconcile/gql_definitions/skupper_network/site_controller_template.py,sha256=MFJ
|
|
400
400
|
reconcile/gql_definitions/skupper_network/skupper_networks.py,sha256=Gfk1YshRj8WSaXgoImBbeXOZz0KXUTKhtf1jiWYEHxY,6037
|
401
401
|
reconcile/gql_definitions/slack_usergroups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
402
402
|
reconcile/gql_definitions/slack_usergroups/clusters.py,sha256=HUTPLna1jxCSyDbxG-LNj9QQUl6smiXOsuCuFTItLzk,2119
|
403
|
-
reconcile/gql_definitions/slack_usergroups/permissions.py,sha256=
|
404
|
-
reconcile/gql_definitions/slack_usergroups/users.py,sha256
|
403
|
+
reconcile/gql_definitions/slack_usergroups/permissions.py,sha256=6XIZnWxu9j5cANunFszmkjb5uVOEGTkudgcmuXeagkA,5456
|
404
|
+
reconcile/gql_definitions/slack_usergroups/users.py,sha256=0KFLYHYXL_bGIKf5LAJSYxUnMQtwggZKVn-mh59Vk10,2880
|
405
405
|
reconcile/gql_definitions/slo_documents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
406
406
|
reconcile/gql_definitions/slo_documents/slo_documents.py,sha256=pOrm9NXAonlo6Lxq6NkD3mHkZ53ZeBnZOZMkDvOEwds,3746
|
407
407
|
reconcile/gql_definitions/status_board/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -608,7 +608,7 @@ reconcile/utils/git.py,sha256=o4p9m8jlzCJDcutl2HErvGLhL6sZ1NB4Aw3zGcQIzso,2427
|
|
608
608
|
reconcile/utils/github_api.py,sha256=S1vO-hvYPzm5BIychVIHSYibMns0HBmLgS78MkPfunE,3402
|
609
609
|
reconcile/utils/gitlab_api.py,sha256=0wJObojbXXk8Cgh8ymNWlwD1CdENmpsMo1zDSTddnoE,28335
|
610
610
|
reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
|
611
|
-
reconcile/utils/gql.py,sha256=
|
611
|
+
reconcile/utils/gql.py,sha256=a1SXvhqqfmFpf9dNwGxnp_6ryvhOwm_kIaFwzJmQQDQ,14683
|
612
612
|
reconcile/utils/grouping.py,sha256=vr9SFHZ7bqmHYrvYcEZt-Er3-yQYfAAdq5sHLZVmXPY,456
|
613
613
|
reconcile/utils/helm.py,sha256=wC1h0GylhDFeZ6hZEtYy2giAGIIQroaQhkAtURoSlI8,3893
|
614
614
|
reconcile/utils/helpers.py,sha256=koyAtYnxsUVx-HIn6GpedcUE-ekz_VtoYDkiZ0iv8ik,1795
|
@@ -650,7 +650,7 @@ reconcile/utils/ruamel.py,sha256=FzL4_L0FnMOUZmgThrZSMJs5MTdXwiy-E9MZWfk8bh8,397
|
|
650
650
|
reconcile/utils/secret_reader.py,sha256=MaP56KZaAE35EyYbgAitdm6fUSxdzWeGFSOym9qiZkw,10206
|
651
651
|
reconcile/utils/semver_helper.py,sha256=-WfPOMSA2v1h7hT3PwVf-Htg7wOsoKlQC1JdmDX2Ars,1268
|
652
652
|
reconcile/utils/sharding.py,sha256=CNyU9mkSbt7FRANEhOOZpWJl7L-YliHhaxr898gmX8c,573
|
653
|
-
reconcile/utils/slack_api.py,sha256=
|
653
|
+
reconcile/utils/slack_api.py,sha256=IrC4fSqTbXCicfvcZhty4rH-g8HZ9w7RPKSE09XfdIo,17858
|
654
654
|
reconcile/utils/slo_document_manager.py,sha256=CPgM2oH4AVzBqenakWo59R5yfwB62tnxSnSOHgir7l8,9500
|
655
655
|
reconcile/utils/smtp_client.py,sha256=0xefB4I9E5eBB-FlxFJYjvz3Kvuqi_K3Ma_Wk0NAQKM,2779
|
656
656
|
reconcile/utils/sqs_gateway.py,sha256=XNIf3PY4UCPNufP2Ul0UJj3fKlt5larBba-VTT-41Fg,2265
|
@@ -699,7 +699,7 @@ reconcile/utils/jobcontroller/controller.py,sha256=Vh08lZuCSIIceWGSDhBB00iFwTI9e
|
|
699
699
|
reconcile/utils/jobcontroller/models.py,sha256=x9YIvWfYOOvXNKToFVx1H7qDrZb0Sa1KI_4Y0gl7rMM,6336
|
700
700
|
reconcile/utils/membershipsources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
701
701
|
reconcile/utils/membershipsources/app_interface_resolver.py,sha256=MqDFvK3aXhmmMuMiIygC-onFVrrIopKHriaYJQ5jnuY,1988
|
702
|
-
reconcile/utils/membershipsources/models.py,sha256=
|
702
|
+
reconcile/utils/membershipsources/models.py,sha256=yuEbG4HJ3NOEpSS9EH7OAx1U-uiRW-QmNMAZJe1Rb-U,1898
|
703
703
|
reconcile/utils/membershipsources/resolver.py,sha256=meERrCZqeVJZR2lHdZEznaZDsCsUb194UEMOjbE4aYA,3168
|
704
704
|
reconcile/utils/merge_request_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
705
705
|
reconcile/utils/merge_request_manager/merge_request_manager.py,sha256=3EP6Yw_zB7nY0OkU8D_32nDqta1TITgtRI0cSmOlNQg,3332
|
@@ -796,7 +796,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
796
796
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
797
797
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
798
798
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
799
|
-
qontract_reconcile-0.10.2.
|
800
|
-
qontract_reconcile-0.10.2.
|
801
|
-
qontract_reconcile-0.10.2.
|
802
|
-
qontract_reconcile-0.10.2.
|
799
|
+
qontract_reconcile-0.10.2.dev256.dist-info/METADATA,sha256=DE1u8utlQNOXxQ_1eaqSb6HXHYd3jI2s1RlS-fIkQHA,23827
|
800
|
+
qontract_reconcile-0.10.2.dev256.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
801
|
+
qontract_reconcile-0.10.2.dev256.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
802
|
+
qontract_reconcile-0.10.2.dev256.dist-info/RECORD,,
|
@@ -28,6 +28,5 @@ class User(ConfiguredBaseModel):
|
|
28
28
|
name: str = Field(..., alias="name")
|
29
29
|
org_username: str = Field(..., alias="org_username")
|
30
30
|
github_username: str = Field(..., alias="github_username")
|
31
|
-
slack_username: Optional[str] = Field(..., alias="slack_username")
|
32
31
|
pagerduty_username: Optional[str] = Field(..., alias="pagerduty_username")
|
33
32
|
tag_on_merge_requests: Optional[bool] = Field(..., alias="tag_on_merge_requests")
|
@@ -29,7 +29,6 @@ query MembershipSourceRolesQuery($filter: JSON) {
|
|
29
29
|
org_username
|
30
30
|
github_username
|
31
31
|
quay_username
|
32
|
-
slack_username
|
33
32
|
pagerduty_username
|
34
33
|
aws_username
|
35
34
|
cloudflare_user
|
@@ -62,7 +61,6 @@ class UserV1(ConfiguredBaseModel):
|
|
62
61
|
org_username: str = Field(..., alias="org_username")
|
63
62
|
github_username: str = Field(..., alias="github_username")
|
64
63
|
quay_username: Optional[str] = Field(..., alias="quay_username")
|
65
|
-
slack_username: Optional[str] = Field(..., alias="slack_username")
|
66
64
|
pagerduty_username: Optional[str] = Field(..., alias="pagerduty_username")
|
67
65
|
aws_username: Optional[str] = Field(..., alias="aws_username")
|
68
66
|
cloudflare_user: Optional[str] = Field(..., alias="cloudflare_user")
|
reconcile/queries.py
CHANGED
@@ -1775,7 +1775,6 @@ USERS_QUERY = """
|
|
1775
1775
|
name
|
1776
1776
|
org_username
|
1777
1777
|
github_username
|
1778
|
-
slack_username
|
1779
1778
|
pagerduty_username
|
1780
1779
|
public_gpg_key
|
1781
1780
|
{% if refs %}
|
@@ -1806,7 +1805,6 @@ ROLES_QUERY = """
|
|
1806
1805
|
name
|
1807
1806
|
org_username
|
1808
1807
|
github_username
|
1809
|
-
slack_username
|
1810
1808
|
tag_on_cluster_updates
|
1811
1809
|
labels
|
1812
1810
|
roles {
|
reconcile/slack_usergroups.py
CHANGED
reconcile/utils/gql.py
CHANGED
@@ -7,7 +7,7 @@ from datetime import (
|
|
7
7
|
datetime,
|
8
8
|
)
|
9
9
|
from typing import Any
|
10
|
-
from urllib.parse import urlparse
|
10
|
+
from urllib.parse import ParseResult, urlparse
|
11
11
|
|
12
12
|
import requests
|
13
13
|
from gql import (
|
@@ -38,7 +38,7 @@ INTEGRATIONS_QUERY = """
|
|
38
38
|
requests_logger.setLevel(logging.WARNING)
|
39
39
|
|
40
40
|
|
41
|
-
def capture_and_forget(error):
|
41
|
+
def capture_and_forget(error: BaseException) -> None:
|
42
42
|
"""fire-and-forget an exception to sentry
|
43
43
|
|
44
44
|
:param error: exception to be captured and sent to sentry
|
@@ -54,7 +54,7 @@ class GqlApiError(Exception):
|
|
54
54
|
|
55
55
|
|
56
56
|
class GqlApiIntegrationNotFound(Exception):
|
57
|
-
def __init__(self, integration):
|
57
|
+
def __init__(self, integration: str):
|
58
58
|
msg = f"""
|
59
59
|
Integration not found: {integration}
|
60
60
|
|
@@ -65,7 +65,7 @@ class GqlApiIntegrationNotFound(Exception):
|
|
65
65
|
|
66
66
|
|
67
67
|
class GqlApiErrorForbiddenSchema(Exception):
|
68
|
-
def __init__(self, schemas):
|
68
|
+
def __init__(self, schemas: list):
|
69
69
|
msg = f"""
|
70
70
|
Forbidden schemas: {schemas}
|
71
71
|
|
@@ -76,7 +76,7 @@ class GqlApiErrorForbiddenSchema(Exception):
|
|
76
76
|
|
77
77
|
|
78
78
|
class GqlGetResourceError(Exception):
|
79
|
-
def __init__(self, path, msg):
|
79
|
+
def __init__(self, path: str, msg: str):
|
80
80
|
super().__init__(f"Error getting resource from path {path}: {msg!s}")
|
81
81
|
|
82
82
|
|
@@ -88,8 +88,8 @@ class GqlApi:
|
|
88
88
|
self,
|
89
89
|
url: str,
|
90
90
|
token: str | None = None,
|
91
|
-
int_name=None,
|
92
|
-
validate_schemas=False,
|
91
|
+
int_name: str | None = None,
|
92
|
+
validate_schemas: bool = False,
|
93
93
|
commit: str | None = None,
|
94
94
|
commit_timestamp: str | None = None,
|
95
95
|
) -> None:
|
@@ -127,14 +127,21 @@ class GqlApi:
|
|
127
127
|
)
|
128
128
|
return Client(transport=transport)
|
129
129
|
|
130
|
-
def close(self):
|
130
|
+
def close(self) -> None:
|
131
131
|
logging.debug("Closing GqlApi client")
|
132
|
-
if
|
132
|
+
if (
|
133
|
+
self.client.transport is not None
|
134
|
+
and hasattr(self.client.transport, "session")
|
135
|
+
and self.client.transport.session
|
136
|
+
):
|
133
137
|
self.client.transport.session.close()
|
134
138
|
|
135
139
|
@retry(exceptions=GqlApiError, max_attempts=5, hook=capture_and_forget)
|
136
140
|
def query(
|
137
|
-
self,
|
141
|
+
self,
|
142
|
+
query: str,
|
143
|
+
variables: dict[str, Any] | None = None,
|
144
|
+
skip_validation: bool = False,
|
138
145
|
) -> dict[str, Any] | None:
|
139
146
|
try:
|
140
147
|
result = self.client.execute(
|
@@ -237,7 +244,7 @@ class GqlApi:
|
|
237
244
|
resources = self.query(query, {"schema": schema}, skip_validation=True)
|
238
245
|
return resources["resources"]
|
239
246
|
|
240
|
-
def get_queried_schemas(self):
|
247
|
+
def get_queried_schemas(self) -> list:
|
241
248
|
return list(self._queried_schemas)
|
242
249
|
|
243
250
|
@property
|
@@ -252,7 +259,7 @@ class GqlApiSingleton:
|
|
252
259
|
gqlapi_lock = threading.Lock()
|
253
260
|
|
254
261
|
@classmethod
|
255
|
-
def create(cls, *args, **kwargs) -> GqlApi:
|
262
|
+
def create(cls, *args: Any, **kwargs: Any) -> GqlApi:
|
256
263
|
with cls.gqlapi_lock:
|
257
264
|
if cls.gql_api:
|
258
265
|
logging.debug("Resestting GqlApi instance")
|
@@ -261,8 +268,9 @@ class GqlApiSingleton:
|
|
261
268
|
return cls.gql_api
|
262
269
|
|
263
270
|
@classmethod
|
264
|
-
def close_gqlapi(cls):
|
265
|
-
cls.gql_api
|
271
|
+
def close_gqlapi(cls) -> None:
|
272
|
+
if cls.gql_api is not None:
|
273
|
+
cls.gql_api.close()
|
266
274
|
|
267
275
|
@classmethod
|
268
276
|
def instance(cls) -> GqlApi:
|
@@ -281,11 +289,11 @@ class GqlApiSingleton:
|
|
281
289
|
def init(
|
282
290
|
url: str,
|
283
291
|
token: str | None = None,
|
284
|
-
integration=None,
|
285
|
-
validate_schemas=False,
|
292
|
+
integration: str | None = None,
|
293
|
+
validate_schemas: bool = False,
|
286
294
|
commit: str | None = None,
|
287
295
|
commit_timestamp: str | None = None,
|
288
|
-
):
|
296
|
+
) -> GqlApi:
|
289
297
|
return GqlApiSingleton.create(
|
290
298
|
url,
|
291
299
|
token,
|
@@ -336,7 +344,7 @@ class PersistentRequestsHTTPTransport(RequestsHTTPTransport):
|
|
336
344
|
# can't directly assign, due to mypy type checking
|
337
345
|
self.session = session # type: ignore
|
338
346
|
|
339
|
-
def connect(self):
|
347
|
+
def connect(self) -> None:
|
340
348
|
pass
|
341
349
|
|
342
350
|
def close(self) -> None:
|
@@ -344,7 +352,7 @@ class PersistentRequestsHTTPTransport(RequestsHTTPTransport):
|
|
344
352
|
|
345
353
|
|
346
354
|
@retry(exceptions=requests.exceptions.HTTPError, max_attempts=5)
|
347
|
-
def get_sha(server, token=None):
|
355
|
+
def get_sha(server: ParseResult, token: str | None = None) -> str:
|
348
356
|
sha_endpoint = server._replace(path="/sha256")
|
349
357
|
headers = {"Authorization": token} if token else None
|
350
358
|
response = requests.get(sha_endpoint.geturl(), headers=headers, timeout=60)
|
@@ -354,7 +362,9 @@ def get_sha(server, token=None):
|
|
354
362
|
|
355
363
|
|
356
364
|
@retry(exceptions=requests.exceptions.HTTPError, max_attempts=5)
|
357
|
-
def get_git_commit_info(
|
365
|
+
def get_git_commit_info(
|
366
|
+
sha: str, server: ParseResult, token: str | None = None
|
367
|
+
) -> dict:
|
358
368
|
git_commit_info_endpoint = server._replace(path=f"/git-commit-info/{sha}")
|
359
369
|
headers = {"Authorization": token} if token else None
|
360
370
|
response = requests.get(
|
@@ -367,12 +377,12 @@ def get_git_commit_info(sha, server, token=None):
|
|
367
377
|
|
368
378
|
@retry(exceptions=requests.exceptions.ConnectionError, max_attempts=5)
|
369
379
|
def init_from_config(
|
370
|
-
autodetect_sha=True,
|
371
|
-
sha=None,
|
372
|
-
integration=None,
|
373
|
-
validate_schemas=False,
|
374
|
-
print_url=True,
|
375
|
-
):
|
380
|
+
autodetect_sha: bool = True,
|
381
|
+
sha: str | None = None,
|
382
|
+
integration: str | None = None,
|
383
|
+
validate_schemas: bool = False,
|
384
|
+
print_url: bool = True,
|
385
|
+
) -> GqlApi:
|
376
386
|
server, token, commit, timestamp = _get_gql_server_and_token(
|
377
387
|
autodetect_sha=autodetect_sha, sha=sha
|
378
388
|
)
|
reconcile/utils/slack_api.py
CHANGED
@@ -415,11 +415,19 @@ class SlackApi:
|
|
415
415
|
k: v["name"] for k, v in self._get("channels").items() if k in channels_ids
|
416
416
|
}
|
417
417
|
|
418
|
+
@staticmethod
|
419
|
+
def extract_name_from_user(user: dict[str, Any]) -> str | None:
|
420
|
+
if email := user["profile"].get("email"):
|
421
|
+
return email.split("@")[0]
|
422
|
+
return None
|
423
|
+
|
418
424
|
def get_active_users_by_names(self, user_names: Iterable[str]) -> dict[str, str]:
|
419
425
|
return {
|
420
|
-
k:
|
426
|
+
k: name
|
421
427
|
for k, v in self._get("users").items()
|
422
|
-
if
|
428
|
+
if not v["deleted"]
|
429
|
+
and (name := self.extract_name_from_user(v))
|
430
|
+
and name in user_names
|
423
431
|
}
|
424
432
|
|
425
433
|
def get_users_by_ids(self, users_ids: Iterable[str]) -> dict[str, str]:
|
@@ -428,9 +436,10 @@ class SlackApi:
|
|
428
436
|
self._translate_user_id(user_id) for user_id in users_ids
|
429
437
|
)
|
430
438
|
return {
|
431
|
-
user_id:
|
439
|
+
user_id: name
|
432
440
|
for user_id in translated_user_ids
|
433
441
|
if (user := users.get(user_id))
|
442
|
+
and (name := self.extract_name_from_user(user))
|
434
443
|
}
|
435
444
|
|
436
445
|
def _get(self, resource: str) -> dict[str, Any]:
|
{qontract_reconcile-0.10.2.dev254.dist-info → qontract_reconcile-0.10.2.dev256.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|