Fix: Update github_cli call from deprecated method 81/72181/1
authorEric Ball <eball@linuxfoundation.org>
Wed, 27 Sep 2023 23:59:08 +0000 (16:59 -0700)
committerEric Ball <eball@linuxfoundation.org>
Thu, 28 Sep 2023 18:17:05 +0000 (11:17 -0700)
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 <eball@linuxfoundation.org>
lftools/cli/github_cli.py
releasenotes/notes/fix-gh-perms-627760cb915af7e3.yaml [new file with mode: 0644]

index 0505ef9..2de9cf2 100644 (file)
@@ -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 (file)
index 0000000..c08a820
--- /dev/null
@@ -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.