qontract-reconcile 0.10.2.dev11__py3-none-any.whl → 0.10.2.dev12__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev11
3
+ Version: 0.10.2.dev12
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
@@ -105,7 +105,7 @@ reconcile/sendgrid_teammates.py,sha256=oO8QbLb4s1o8A6CGiCagN9CmS05BSS_WLztuY0Ym9
105
105
  reconcile/service_dependencies.py,sha256=PMKP9vc6oL-78rzyF_RE8DzLSQMSqN8vCqt9sWpBLAM,4470
106
106
  reconcile/signalfx_endpoint_monitoring.py,sha256=Nqgsg1cflSd2nNnm89y_e8c--7xLUqTrKOHkDs-qADE,2868
107
107
  reconcile/slack_base.py,sha256=8FqwMJ5SkoRyDJ9iPfZogWkC9QRoTouMCnGUevV_GME,3447
108
- reconcile/slack_usergroups.py,sha256=ebCMtgpap6i_IUFFTuXU52MdkAXxSRG1bAcDPj64OIg,30083
108
+ reconcile/slack_usergroups.py,sha256=vMifpbnrQDLeckGtUmpIg7sVvlhpaJz8HZH_loA7fpY,30221
109
109
  reconcile/sql_query.py,sha256=pH-EHkXiDknn8ZNXVqRZeqFc3sKhu2nhsaykgSytbS8,25895
110
110
  reconcile/status.py,sha256=cY4IJFXemhxptRJqR4qaaOWqei9e4jgLXuVSGajMsjg,544
111
111
  reconcile/status_board.py,sha256=YeoE7kLf1YKpOdN32u3vqhuSI46ep5N_qcVWC1CBCf8,8635
@@ -580,8 +580,8 @@ reconcile/utils/external_resource_spec.py,sha256=bhH_xneFwATdFumTPkiQmcVKYI0gcaW
580
580
  reconcile/utils/external_resources.py,sha256=y7Wz32cOAmCsUhQ6T-1N6lktnLikGkaHQ0SdDpMse1w,7585
581
581
  reconcile/utils/filtering.py,sha256=S4PbMHuFr3ED0P2Q_ea5CAaB7FimI62B-F5YTaKrphA,402
582
582
  reconcile/utils/git.py,sha256=wzVIYAeKlMGW538U1mkJWUI6h_mFRUY4lawh2AR8hw4,2345
583
- reconcile/utils/github_api.py,sha256=R8OvqyPdnRqvP-Efnv9RvIcbBlb4M0KC4RlbnJMD0Tg,2426
584
- reconcile/utils/gitlab_api.py,sha256=YokTr77DJVWl7nALjCJdJnPKgBJfUBETkE8FtrT7ckg,28455
583
+ reconcile/utils/github_api.py,sha256=oMInVIga9OITL7l5EWzs4lGXK0xAYhUznhjgXKjmmA0,2492
584
+ reconcile/utils/gitlab_api.py,sha256=3QKe2g7ZJ1vFai4f65C-0eySTgIJhmqg-o1ehX249cc,28515
585
585
  reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
586
586
  reconcile/utils/gql.py,sha256=C0thIm_k9MBldfqwHzyqtYZk9sIvMdm9IbbnXLGwjD8,14158
587
587
  reconcile/utils/grouping.py,sha256=vr9SFHZ7bqmHYrvYcEZt-Er3-yQYfAAdq5sHLZVmXPY,456
@@ -617,7 +617,7 @@ reconcile/utils/promotion_state.py,sha256=McSgGj3oog83ThJCrMR2v8q6Xb_Pxij-HEe_Rb
617
617
  reconcile/utils/promtool.py,sha256=UmBfTHgW9Ys7fZ9BfhIVJEFGLkbge9y1AgL5PNHp7iA,2831
618
618
  reconcile/utils/quay_api.py,sha256=wyPD9F1do0FsAcmIr7RejUOs4zaKs8-OUylxI3MLk8A,7860
619
619
  reconcile/utils/raw_github_api.py,sha256=O6Q4vq7bi5ZWcfquPutc9rJ4Ef8_sFqd_RLgzpIoj0w,2920
620
- reconcile/utils/repo_owners.py,sha256=gQhynzJtsmJ2b-uCfg_IFtZgHLAac-fUa1LRvWiSBs4,6523
620
+ reconcile/utils/repo_owners.py,sha256=BpzvfmhC6deO3jf3uLD73ANK6oZbdhjYNyZmAZrcfak,6586
621
621
  reconcile/utils/rest_api_base.py,sha256=jezb2MfIxf83HNSGbNNBStuEmVuVUuwFQnRmZsQaq6w,4297
622
622
  reconcile/utils/ruamel.py,sha256=FzL4_L0FnMOUZmgThrZSMJs5MTdXwiy-E9MZWfk8bh8,397
623
623
  reconcile/utils/secret_reader.py,sha256=6qzDja0Mkm1MrEdn5cTCWzQo7-aTCOLy9BqqNSPvqL4,10214
@@ -766,7 +766,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
766
766
  tools/saas_promotion_state/saas_promotion_state.py,sha256=5LJ9rygZ304vxfsIuRfuxueoYRb72EZNKKITEcJ4Mtk,3908
767
767
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
768
768
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
769
- qontract_reconcile-0.10.2.dev11.dist-info/METADATA,sha256=GaV4BaNXIgDFCvDRq8wSKzXKj0P2Sj-RxYIEQJIprds,24665
770
- qontract_reconcile-0.10.2.dev11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
771
- qontract_reconcile-0.10.2.dev11.dist-info/entry_points.txt,sha256=JniHZPadNOILPyfSl0LF2YSp3Db7K2_W2CN7i9f3Gos,540
772
- qontract_reconcile-0.10.2.dev11.dist-info/RECORD,,
769
+ qontract_reconcile-0.10.2.dev12.dist-info/METADATA,sha256=sppoHRsRgQprrh1l3piarq4tIw_UScdBX1hgO3O8n3A,24665
770
+ qontract_reconcile-0.10.2.dev12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
771
+ qontract_reconcile-0.10.2.dev12.dist-info/entry_points.txt,sha256=JniHZPadNOILPyfSl0LF2YSp3Db7K2_W2CN7i9f3Gos,540
772
+ qontract_reconcile-0.10.2.dev12.dist-info/RECORD,,
@@ -314,7 +314,12 @@ def get_slack_usernames_from_owners(
314
314
  else:
315
315
  raise TypeError(f"{type(repo_cli)} not supported")
316
316
 
317
- repo_owners = repo_owner_class(git_cli=repo_cli, ref=ref)
317
+ repo_owners = repo_owner_class(
318
+ git_cli=repo_cli,
319
+ ref=ref,
320
+ # we just need the root level OWNERS file
321
+ recursive=False,
322
+ )
318
323
 
319
324
  try:
320
325
  owners = repo_owners.get_root_owners()
@@ -50,6 +50,9 @@ class GithubRepositoryApi:
50
50
  ) -> None:
51
51
  self.cleanup()
52
52
 
53
+ def __str__(self) -> str:
54
+ return self._repo.html_url
55
+
53
56
  def cleanup(self) -> None:
54
57
  """
55
58
  Align with GitLabApi
@@ -146,6 +146,9 @@ class GitLabApi: # pylint: disable=too-many-public-methods
146
146
  def __exit__(self, *exc):
147
147
  self.cleanup()
148
148
 
149
+ def __str__(self):
150
+ return self.project.web_url
151
+
149
152
  def cleanup(self):
150
153
  """
151
154
  Close gl session.
@@ -12,10 +12,11 @@ class RepoOwners:
12
12
  Abstracts the owners of a repository with per-path granularity.
13
13
  """
14
14
 
15
- def __init__(self, git_cli, ref="master"):
15
+ def __init__(self, git_cli, ref="master", recursive=True):
16
16
  self._git_cli = git_cli
17
17
  self._ref = ref
18
18
  self._owners_map = None
19
+ self._recursive = recursive
19
20
 
20
21
  @property
21
22
  def owners_map(self):
@@ -116,33 +117,31 @@ class RepoOwners:
116
117
  :rtype: dict
117
118
  """
118
119
  owners_map = {}
120
+ aliases = self._get_aliases()
119
121
 
120
- repo_tree = self._git_cli.get_repository_tree(ref=self._ref)
121
-
122
- aliases = None
123
- owner_files = []
124
- for item in repo_tree:
125
- if item["path"] == "OWNERS_ALIASES":
126
- aliases = self._get_aliases()
127
- elif item["name"] == "OWNERS":
128
- owner_files.append(item)
122
+ if self._recursive:
123
+ repo_tree = self._git_cli.get_repository_tree(ref=self._ref)
124
+ owner_files = [item for item in repo_tree if item["name"] == "OWNERS"]
125
+ else:
126
+ owner_files = [{"path": "OWNERS"}]
129
127
 
130
128
  for owner_file in owner_files:
131
129
  raw_owners = self._git_cli.get_file(path=owner_file["path"], ref=self._ref)
130
+ if not raw_owners:
131
+ _LOG.warning(f"{self._git_cli!s}:{owner_file['path']} not found")
132
+ continue
132
133
  try:
133
134
  owners = yaml.safe_load(raw_owners.decode())
134
135
  except yaml.parser.ParserError:
135
136
  owners = None
136
137
  if owners is None:
137
138
  _LOG.warning(
138
- "Non-parsable OWNERS file "
139
- f"{self._git_cli.project.web_url}:{owner_file.get('path')}"
139
+ f"Non-parsable OWNERS file {self._git_cli!s}:{owner_file['path']}"
140
140
  )
141
141
  continue
142
142
  if not isinstance(owners, dict):
143
143
  _LOG.warning(
144
- f"owner file {self._git_cli.project.web_url}:{owner_file.get('path')} "
145
- "content is not a dictionary"
144
+ f"owner file {self._git_cli!s}:{owner_file['path']} content is not a dictionary"
146
145
  )
147
146
  continue
148
147