From e88d4e3589178c7764099804535b6d5e00d90596 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Wed, 27 Sep 2023 16:59:08 -0700 Subject: [PATCH] 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 --- lftools/cli/github_cli.py | 12 ++++++------ releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml 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. -- 2.16.6