Skip to content

Commit

Permalink
Fix: Update github_cli call from deprecated method
Browse files Browse the repository at this point in the history
The "set_repo_permission" method has been replaced by
"update_team_repository", which has the same signature, but
uses "pull" and "push" rather than "read" and "write" as the
permission strings.

Issue: RELENG-4481
Change-Id: I5167b07f85cbc063e4a4affabbd5ccf60a7dfa42
Signed-off-by: Eric Ball <[email protected]>
  • Loading branch information
eb-oss committed Sep 28, 2023
1 parent 885a4fa commit e88d4e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lftools/cli/github_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def updaterepo(ctx, organization, repository, has_issues, has_projects, has_wiki
repo.edit(has_wiki=has_projects)

if add_team or remove_team:
teams = org.get_teams
teams = org.get_teams()

for repo in repos:
if repo.name == repository:
Expand All @@ -187,13 +187,13 @@ def updaterepo(ctx, organization, repository, has_issues, has_projects, has_wiki
log.error("repo not found")
exit(1)

for team in teams():
for team in teams:
if team.name == add_team:
log.info(team.id)
log.info("Adding team {}".format(team.id))
team.add_to_repos(repo_actual)
team.set_repo_permission(repo_actual, "write")
if team.name == remove_team:
log.info(team.id)
team.update_team_repository(repo_actual, "push")
elif team.name == remove_team:
log.info("Removing team {}".format(team.id))
team.remove_from_repos(repo_actual)


Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Replace deprecated ``set_repo_permission`` method with ``update_team_repository``.
The latter has the same signature, but uses "pull" and "push" rather than
"read" and "write" as the permission strings.

0 comments on commit e88d4e3

Please sign in to comment.