From: Eric Ball Date: Wed, 27 Sep 2023 23:59:08 +0000 (-0700) Subject: Fix: Update github_cli call from deprecated method X-Git-Tag: v0.37.7~18 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F72181%2F1;p=releng%2Flftools.git Fix: Update github_cli call from deprecated method 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 --- diff --git a/lftools/cli/github_cli.py b/lftools/cli/github_cli.py index 0505ef90..2de9cf2e 100644 --- a/lftools/cli/github_cli.py +++ b/lftools/cli/github_cli.py @@ -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: @@ -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) diff --git a/releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml b/releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml new file mode 100644 index 00000000..c08a820f --- /dev/null +++ b/releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml @@ -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.