qontract-reconcile 0.10.1rc866__py3-none-any.whl → 0.10.1rc868__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.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/RECORD +11 -11
- reconcile/gitlab_permissions.py +1 -1
- reconcile/slack_usergroups.py +6 -7
- reconcile/test/test_gitlab_permissions.py +2 -2
- reconcile/test/test_slack_usergroups.py +6 -6
- reconcile/utils/gitlab_api.py +5 -3
- reconcile/utils/slack_api.py +2 -2
- {qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc868
|
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
|
{qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/RECORD
RENAMED
@@ -35,7 +35,7 @@ reconcile/gitlab_labeler.py,sha256=IxE1XM5o4rDOFuR4cM2yAHTy4Uzdg3Nyz2mp7b8Fx1g,4
|
|
35
35
|
reconcile/gitlab_members.py,sha256=M6LwFOrwgvl1NNdOJa1mrQFUon-bEVv1AyhGeLed454,8443
|
36
36
|
reconcile/gitlab_mr_sqs_consumer.py,sha256=O46mdziPgGOndbU-0_UJKJVUaiEoVzJPEgKm4_UvYoI,2571
|
37
37
|
reconcile/gitlab_owners.py,sha256=sn9njaKOtqcvnhi2qtm-faAfAR4zNqflbSuusA9RUuI,13456
|
38
|
-
reconcile/gitlab_permissions.py,sha256=
|
38
|
+
reconcile/gitlab_permissions.py,sha256=1tFZws0-prcJ7vhFF3N7BxKocc16SjJuoqCkzRFESbE,3276
|
39
39
|
reconcile/gitlab_projects.py,sha256=K3tFf_aD1W4Ijp5q-9Qek3kwFGEWPcZ1kd7tzFJ4GyQ,1781
|
40
40
|
reconcile/integrations_manager.py,sha256=J_VV-HINI7YNav2NPIolePZkll-7VBuBXWAyMNhsM_Q,9535
|
41
41
|
reconcile/jenkins_base.py,sha256=0Gocu3fU2YTltaxBlbDQOUvP-7CP2OSQV1ZRwtWeVXw,875
|
@@ -104,7 +104,7 @@ reconcile/sendgrid_teammates.py,sha256=oO8QbLb4s1o8A6CGiCagN9CmS05BSS_WLztuY0Ym9
|
|
104
104
|
reconcile/service_dependencies.py,sha256=PMKP9vc6oL-78rzyF_RE8DzLSQMSqN8vCqt9sWpBLAM,4470
|
105
105
|
reconcile/signalfx_endpoint_monitoring.py,sha256=D1m8iq0EAKie0OD59FOcVCtpWWZ7xlo6lwBS9urwMIk,2894
|
106
106
|
reconcile/slack_base.py,sha256=K3fSYx46G1djoPb07_C9j6ChhMCt5LgV5l6v2TFkNZk,3479
|
107
|
-
reconcile/slack_usergroups.py,sha256=
|
107
|
+
reconcile/slack_usergroups.py,sha256=XnSw6K9-qaYu01vaFRV9ovIxzB8HfycLFyyIzJa-TRA,29708
|
108
108
|
reconcile/sql_query.py,sha256=FAQI9EIHsokZBbGwvGU4vnjg1fHemxpYQE20UtCB1qo,25941
|
109
109
|
reconcile/status.py,sha256=cY4IJFXemhxptRJqR4qaaOWqei9e4jgLXuVSGajMsjg,544
|
110
110
|
reconcile/status_board.py,sha256=nA74_133jukxVShjPKJpkXOA3vggDTTEhYTegoXbN1M,8632
|
@@ -502,7 +502,7 @@ reconcile/test/test_github_repo_invites.py,sha256=UVaDlxSxi5iooyUbz8F11d7cvINHLK
|
|
502
502
|
reconcile/test/test_gitlab_housekeeping.py,sha256=Sn5rERCp28sMiBx5vJaQ5yy80y37GouMClejmXocsT8,10068
|
503
503
|
reconcile/test/test_gitlab_labeler.py,sha256=vFLUJXSIaCduj6wSqgw7Fg7FhlopaDnYI5SLzNHtLoY,4362
|
504
504
|
reconcile/test/test_gitlab_members.py,sha256=kaCOA02eZSrSMkzHmaLwWW3LY6Af0ciLSEP4PlMLvOU,9949
|
505
|
-
reconcile/test/test_gitlab_permissions.py,sha256=
|
505
|
+
reconcile/test/test_gitlab_permissions.py,sha256=5QFy6InIHYM7zph5dPsDPo2hobrI5-eSGRTOzHOhF74,2005
|
506
506
|
reconcile/test/test_instrumented_wrappers.py,sha256=CZzhnQH0c4i7-Rxjg7-0dfFMvVPegLHL46z5NHOOCwo,608
|
507
507
|
reconcile/test/test_integrations_manager.py,sha256=l6KwSFT0NS9VSR-b_9z_ZEGXDWH3EMitUEMC_1h8Xkk,38184
|
508
508
|
reconcile/test/test_jenkins_worker_fleets.py,sha256=o1jlT7OBBSgu0M3iI4xMdz_x6SciF7yhNBpLk5gTJfg,2361
|
@@ -539,7 +539,7 @@ reconcile/test/test_saasherder.py,sha256=QFX6JrPCpB9jS-K_VleIjTf6NaF8NDa4UwddXXo
|
|
539
539
|
reconcile/test/test_saasherder_allowed_secret_paths.py,sha256=5NHQwNJO66at6HiyMZ5sVRTQDwxdvlOQo0KmkBWCw5Q,4853
|
540
540
|
reconcile/test/test_secret_reader.py,sha256=kz7nzcPjvA08cytnvcA_PMA98AEyqJWsESkYeRn5xCk,4994
|
541
541
|
reconcile/test/test_slack_base.py,sha256=gpbWOLNxMMX6fyAbs1JakhLTnwfedb3f7WpUae4tQZE,5060
|
542
|
-
reconcile/test/test_slack_usergroups.py,sha256=
|
542
|
+
reconcile/test/test_slack_usergroups.py,sha256=16mQar9Ar0GqwpOJBZ5nc7v1UzfXDd-9WCOEgT4cBKU,24941
|
543
543
|
reconcile/test/test_sql_query.py,sha256=rC-lf1_isT9i2ZIV9W0hkUkLi2oBIjZMRMhk-6mV-34,11029
|
544
544
|
reconcile/test/test_status_board.py,sha256=go3YSWo03OLIdK95SuiDJa1Nqk-eN_9QtS7dfmu9__8,7875
|
545
545
|
reconcile/test/test_terraform_aws_route53.py,sha256=xHggb8K1P76OyCfFcogbkmyKle-NlUylcbDnuv3IqvY,771
|
@@ -654,7 +654,7 @@ reconcile/utils/filtering.py,sha256=zZnHH0u0SaTDyzuFXZ_mREURGLvjEqQIQy4z-7QBVlc,
|
|
654
654
|
reconcile/utils/git.py,sha256=BdxXFgQ1XOZpS-4qb3qMsKTCFDG8MlE26rv1jAhvCkM,1560
|
655
655
|
reconcile/utils/git_secrets.py,sha256=0wGNL5mvDtVPRuu3vEQgld1Am64gIDJHtmu1_ZKxMAI,1973
|
656
656
|
reconcile/utils/github_api.py,sha256=_bttNxYKeam_tLVe27L7O4gKqSn6CeyuFnJn8tSaUVY,2488
|
657
|
-
reconcile/utils/gitlab_api.py,sha256=
|
657
|
+
reconcile/utils/gitlab_api.py,sha256=thEdQ4AX96R4F3XhpOpugWmbueIgzDc_9b56DW-6ecY,29116
|
658
658
|
reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
|
659
659
|
reconcile/utils/gql.py,sha256=o8TLe9zW_zf_vOYC4yAy7mP5UvSR4eq3JKa4rxy1KjI,14277
|
660
660
|
reconcile/utils/grouping.py,sha256=kWKivD14eAkiDneH_VIl_XyUdcVVQgiaKA9sLsuD2dw,441
|
@@ -696,7 +696,7 @@ reconcile/utils/ruamel.py,sha256=FzL4_L0FnMOUZmgThrZSMJs5MTdXwiy-E9MZWfk8bh8,397
|
|
696
696
|
reconcile/utils/secret_reader.py,sha256=7g4TuBxkOl2NgsuZUCRcdI_hKLP3JhXlY1byBSxWU3A,10305
|
697
697
|
reconcile/utils/semver_helper.py,sha256=-WfPOMSA2v1h7hT3PwVf-Htg7wOsoKlQC1JdmDX2Ars,1268
|
698
698
|
reconcile/utils/sharding.py,sha256=gkYf0lD3IUKQPEmdRJZ70mdDT1c9qWjbdP7evRsUis4,839
|
699
|
-
reconcile/utils/slack_api.py,sha256=
|
699
|
+
reconcile/utils/slack_api.py,sha256=NT8NjhpBMBWOhqgHnvBuP2NlZKm8H_oGY_LHdVu_F_c,17423
|
700
700
|
reconcile/utils/smtp_client.py,sha256=gJNbBQJpAt5PX4t_TaeNHsXM8vt50bFgndml6yK2b5o,2800
|
701
701
|
reconcile/utils/sqs_gateway.py,sha256=gFl9DM4DmGnptuxTOe4lS3YTyE80eSAvK42ljS8h4dA,2287
|
702
702
|
reconcile/utils/state.py,sha256=DRxzuOw3Iha-b2esBMjZTZ5K-OxfrGbkyEvpTT5xHTs,16369
|
@@ -837,8 +837,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
|
|
837
837
|
tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
|
838
838
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
839
839
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
840
|
-
qontract_reconcile-0.10.
|
841
|
-
qontract_reconcile-0.10.
|
842
|
-
qontract_reconcile-0.10.
|
843
|
-
qontract_reconcile-0.10.
|
844
|
-
qontract_reconcile-0.10.
|
840
|
+
qontract_reconcile-0.10.1rc868.dist-info/METADATA,sha256=2Ic4FAzZN1tZWidUXUc0YXjGK1fFGxGkQa2rdANjHZ8,2273
|
841
|
+
qontract_reconcile-0.10.1rc868.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
842
|
+
qontract_reconcile-0.10.1rc868.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
843
|
+
qontract_reconcile-0.10.1rc868.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
844
|
+
qontract_reconcile-0.10.1rc868.dist-info/RECORD,,
|
reconcile/gitlab_permissions.py
CHANGED
@@ -80,7 +80,7 @@ def share_project_with_group(gl: GitLabApi, repos: list[str], dry_run: bool) ->
|
|
80
80
|
# get repos not owned by app-sre
|
81
81
|
non_app_sre_projects = {repo for repo in repos if "/app-sre/" not in repo}
|
82
82
|
group_id, shared_projects = gl.get_group_id_and_shared_projects(APP_SRE_GROUP_NAME)
|
83
|
-
shared_project_repos = {project
|
83
|
+
shared_project_repos = {project.web_url for project in shared_projects}
|
84
84
|
repos_to_share = non_app_sre_projects - shared_project_repos
|
85
85
|
for repo in repos_to_share:
|
86
86
|
gl.share_project_with_group(repo_url=repo, group_id=group_id, dry_run=dry_run)
|
reconcile/slack_usergroups.py
CHANGED
@@ -557,19 +557,18 @@ def _update_usergroup_users_from_state(
|
|
557
557
|
|
558
558
|
slack_user_objects = [
|
559
559
|
SlackObject(pk=pk, name=name)
|
560
|
-
for pk, name in slack_client.
|
560
|
+
for pk, name in slack_client.get_active_users_by_names(
|
561
561
|
desired_ug_state.user_names
|
562
562
|
).items()
|
563
563
|
]
|
564
|
+
active_user_names = set(s.name for s in slack_user_objects)
|
564
565
|
|
565
|
-
if len(
|
566
|
+
if len(active_user_names) != len(desired_ug_state.user_names):
|
566
567
|
logging.info(
|
567
|
-
f"Following usernames are incorrect for usergroup {desired_ug_state.usergroup} and could not be matched with slack users {desired_ug_state.user_names -
|
568
|
+
f"Following usernames are incorrect for usergroup {desired_ug_state.usergroup} and could not be matched with slack users {desired_ug_state.user_names - active_user_names}"
|
568
569
|
)
|
569
|
-
error_occurred = True
|
570
|
-
return 0
|
571
570
|
|
572
|
-
for user in
|
571
|
+
for user in active_user_names - current_ug_state.user_names:
|
573
572
|
logging.info([
|
574
573
|
"add_user_to_usergroup",
|
575
574
|
desired_ug_state.workspace,
|
@@ -577,7 +576,7 @@ def _update_usergroup_users_from_state(
|
|
577
576
|
user,
|
578
577
|
])
|
579
578
|
|
580
|
-
for user in current_ug_state.user_names -
|
579
|
+
for user in current_ug_state.user_names - active_user_names:
|
581
580
|
logging.info([
|
582
581
|
"del_user_from_usergroup",
|
583
582
|
desired_ug_state.workspace,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from unittest.mock import MagicMock, create_autospec
|
2
2
|
|
3
3
|
import pytest
|
4
|
-
from gitlab.v4.objects import CurrentUser, GroupMember
|
4
|
+
from gitlab.v4.objects import CurrentUser, GroupMember, GroupProject
|
5
5
|
from pytest_mock import MockerFixture
|
6
6
|
|
7
7
|
from reconcile import gitlab_permissions
|
@@ -51,7 +51,7 @@ def test_run_share_with_group(
|
|
51
51
|
).return_value = True
|
52
52
|
mocked_gl.get_group_id_and_shared_projects.return_value = (
|
53
53
|
1234,
|
54
|
-
[
|
54
|
+
[create_autospec(GroupProject, web_url="https://test.com")],
|
55
55
|
)
|
56
56
|
gitlab_permissions.run(False, thread_pool_size=1)
|
57
57
|
mocked_gl.share_project_with_group.assert_called_once()
|
@@ -579,7 +579,7 @@ def test_act_empty_current_state(
|
|
579
579
|
|
580
580
|
slack_client_mock.create_usergroup.return_value = "USERGA"
|
581
581
|
slack_client_mock.get_usergroup_id.return_value = "USERGA"
|
582
|
-
slack_client_mock.
|
582
|
+
slack_client_mock.get_active_users_by_names.return_value = {"USERA": "username"}
|
583
583
|
slack_client_mock.get_channels_by_names.return_value = {"CHANA": "someotherchannel"}
|
584
584
|
|
585
585
|
act(current_state, desired_state, slack_map, dry_run=False)
|
@@ -605,7 +605,7 @@ def test_act_update_usergroup_users(
|
|
605
605
|
}
|
606
606
|
|
607
607
|
slack_client_mock.get_usergroup_id.return_value = "USERGA"
|
608
|
-
slack_client_mock.
|
608
|
+
slack_client_mock.get_active_users_by_names.return_value = {
|
609
609
|
"USERB": "someotherusername",
|
610
610
|
"USERC": "anotheruser",
|
611
611
|
}
|
@@ -629,7 +629,7 @@ def test_act_update_usergroup_channels(
|
|
629
629
|
desired_state["slack-workspace"]["usergroup-1"].channel_names = {"CHANB"}
|
630
630
|
|
631
631
|
slack_client_mock.get_usergroup_id.return_value = "USERGA"
|
632
|
-
slack_client_mock.
|
632
|
+
slack_client_mock.get_active_users_by_names.return_value = {"USERA": "username"}
|
633
633
|
slack_client_mock.get_channels_by_names.return_value = {"CHANB": "channel"}
|
634
634
|
|
635
635
|
act(current_state, desired_state, slack_map, dry_run=False)
|
@@ -651,7 +651,7 @@ def test_act_update_usergroup_description(
|
|
651
651
|
].description = "A different description"
|
652
652
|
|
653
653
|
slack_client_mock.get_usergroup_id.return_value = "USERGA"
|
654
|
-
slack_client_mock.
|
654
|
+
slack_client_mock.get_active_users_by_names.return_value = {"USERA": "username"}
|
655
655
|
slack_client_mock.get_channels_by_names.return_value = {"CHANA": "channel"}
|
656
656
|
|
657
657
|
act(current_state, desired_state, slack_map, dry_run=False)
|
@@ -675,7 +675,7 @@ def test_act_update_usergroup_desc_and_channels(
|
|
675
675
|
].description = "A different description"
|
676
676
|
|
677
677
|
slack_client_mock.get_usergroup_id.return_value = "USERGA"
|
678
|
-
slack_client_mock.
|
678
|
+
slack_client_mock.get_active_users_by_names.return_value = {"USERA": "username"}
|
679
679
|
slack_client_mock.get_channels_by_names.return_value = {"CHANB": "someotherchannel"}
|
680
680
|
|
681
681
|
act(current_state, desired_state, slack_map, dry_run=False)
|
@@ -716,7 +716,7 @@ def test_act_add_new_usergroups(
|
|
716
716
|
desired_state = copy.deepcopy(base_state)
|
717
717
|
|
718
718
|
slack_client_mock.get_usergroup_id.side_effect = get_ugid
|
719
|
-
slack_client_mock.
|
719
|
+
slack_client_mock.get_active_users_by_names.side_effect = get_users
|
720
720
|
slack_client_mock.get_channels_by_names.side_effect = get_channels
|
721
721
|
|
722
722
|
desired_state["slack-workspace"]["usergroup-2"] = State(
|
reconcile/utils/gitlab_api.py
CHANGED
@@ -29,6 +29,7 @@ from gitlab.const import (
|
|
29
29
|
from gitlab.v4.objects import (
|
30
30
|
CurrentUser,
|
31
31
|
Group,
|
32
|
+
GroupProject,
|
32
33
|
Project,
|
33
34
|
ProjectIssue,
|
34
35
|
ProjectMergeRequest,
|
@@ -286,13 +287,14 @@ class GitLabApi: # pylint: disable=too-many-public-methods
|
|
286
287
|
|
287
288
|
def get_group_id_and_shared_projects(
|
288
289
|
self, group_name: str
|
289
|
-
) -> tuple[int, list[
|
290
|
+
) -> tuple[int, list[GroupProject]]:
|
290
291
|
gitlab_request.labels(integration=INTEGRATION_NAME).inc()
|
291
292
|
group = self.gl.groups.get(group_name)
|
293
|
+
shared_projects = self.get_items(group.projects.list, all=True)
|
292
294
|
return group.id, [
|
293
295
|
project
|
294
|
-
for project in
|
295
|
-
for shared_group in project
|
296
|
+
for project in shared_projects
|
297
|
+
for shared_group in project.shared_with_groups
|
296
298
|
if shared_group["group_id"] == group.id
|
297
299
|
and shared_group["group_access_level"] >= MAINTAINER_ACCESS
|
298
300
|
]
|
reconcile/utils/slack_api.py
CHANGED
@@ -417,11 +417,11 @@ class SlackApi:
|
|
417
417
|
k: v["name"] for k, v in self._get("channels").items() if k in channels_ids
|
418
418
|
}
|
419
419
|
|
420
|
-
def
|
420
|
+
def get_active_users_by_names(self, user_names: Iterable[str]) -> dict[str, str]:
|
421
421
|
return {
|
422
422
|
k: v["name"]
|
423
423
|
for k, v in self._get("users").items()
|
424
|
-
if v["name"] in user_names
|
424
|
+
if v["name"] in user_names and not v["deleted"]
|
425
425
|
}
|
426
426
|
|
427
427
|
def get_users_by_ids(self, users_ids: Iterable[str]) -> dict[str, str]:
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc866.dist-info → qontract_reconcile-0.10.1rc868.dist-info}/top_level.txt
RENAMED
File without changes
|