#9802 retire_packagers: there is no self here
Merged 2 months ago by kevin. Opened 2 months ago by churchyard.
churchyard/releng no_self_session  into  master

@@ -174,7 +174,7 @@ 

      session.close()

  

  

- def orphan_package(namespace, name, username):

+ def orphan_package(session, namespace, name, username):

      """ Give the specified project on dist_git to the ``orphan`` user.

      """

      _log.debug("Going to orphan: %s/%s from %s", namespace, name, username)
@@ -189,7 +189,7 @@ 

          "orphan_reason_info": "Orphaned by releng",

      }

  

-     req = self.requests_session.post(url, data=data, headers=headers)

+     req = session.post(url, data=data, headers=headers)

      if not req.ok:

          print("**** REQUEST FAILED")

          print("  - Orphan package")
@@ -362,7 +362,7 @@ 

                      print(f"{username} is {level} of {namespace}/{name}")

                      if args.retire:

                          if level == "main admin":

-                             orphan_package(namespace, name, username)

+                             orphan_package(session, namespace, name, username)

                          elif level == "maintainer":

                              remove_access(namespace, name, username, "user")

  

Traceback (most recent call last):
File "retire_packagers.py", line 386, in <module>
sys.exit(main(sys.argv[1:]))
File "retire_packagers.py", line 365, in main
orphan_package(namespace, name, username)
File "retire_packagers.py", line 192, in orphan_package
req = self.requests_session.post(url, data=data, headers=headers)
NameError: name 'self' is not defined

Pull-Request has been merged by kevin

2 months ago
Metadata