Ask Your Question
3

Failed to open pull request: KeyError owner

asked 2014-09-19 13:23:20 -0500

Dave Coleman gravatar image

updated 2014-09-19 16:44:27 -0500

When I go to re-release a bloom package, I am getting a new error today:

indigo-devel] moveit_simple_grasps$ bloom-release moveit_simple_grasps -t indigo -r indigo --pull-request-only
==> Fetching 'moveit_simple_grasps' repository from 'https://github.com/davetcoleman/moveit_simple_grasps-release.git'
Cloning into '/tmp/tmp7en7KA'...
remote: Counting objects: 610, done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 610 (delta 205), reused 498 (delta 165)
Receiving objects: 100% (610/610), 364.99 KiB | 0 bytes/s, done.
Resolving deltas: 100% (205/205), done.
Checking connectivity... done.
==> Generating pull request to distro file located at 'https://raw.github.com/ros/rosdistro/master/indigo/distribution.yaml'
Unified diff for the ROS distro file located at '/tmp/tmpbnVBxY/moveit_simple_grasps-1.2.0-0.patch':
--- ../indigo/distribution.yaml
+++ ../indigo/distribution.yaml
@@ -2660,7 +2660,7 @@
       tags:
         release: release/indigo/{package}/{version}
       url: https://github.com/davetcoleman/moveit_simple_grasps-release.git
-      version: 1.1.0-0
+      version: 1.2.0-0
     source:
       type: git
       url: https://github.com/davetcoleman/moveit_simple_grasps.git
==> Checking on github for a fork to make the pull request from...
==> davetcoleman/rosdistro is not a fork, searching...
Failed to open pull request: KeyError - 'owner'

In particular,

davetcoleman/rosdistro is not a fork, searching...

But it is in fact a fork and I've done this many times before...?

Thanks!

UPDATE 1:

Bloom Log: https://gist.github.com/davetcoleman/...

UPDATE 2:

I applied your github patch. Note I got a somewhat weird message while doing so, but on visual inspection it looks like it worked:

bloom$ sudo patch < github.py.patch 
patching file github.py
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 121 with fuzz 1.

I then re-ran just the pull request only part and got the new, updated error message:

moveit_simple_grasps$ bloom-release moveit_simple_grasps -t indigo -r indigo --pull-request-only
==> Fetching 'moveit_simple_grasps' repository from 'https://github.com/davetcoleman/moveit_simple_grasps-release.git'
Cloning into '/tmp/tmpCjmYhp'...
remote: Counting objects: 610, done.
remote: Total 610 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (610/610), 365.77 KiB | 0 bytes/s, done.
Resolving deltas: 100% (204/204), done.
Checking connectivity... done.
==> Generating pull request to distro file located at 'https://raw.github.com/ros/rosdistro/master/indigo/distribution.yaml'
Unified diff for the ROS distro file located at '/tmp/tmpZTKg5o/moveit_simple_grasps-1.2.0-0.patch':
--- ../indigo/distribution.yaml
+++ ../indigo/distribution.yaml
@@ -2660,7 +2660,7 @@
       tags:
         release: release/indigo/{package}/{version}
       url: https://github.com/davetcoleman/moveit_simple_grasps-release.git
-      version: 1.1.0-0
+      version: 1.2.0-0
     source:
       type: git
       url: https://github.com/davetcoleman/moveit_simple_grasps.git
==> Checking on github for a fork to make the pull request from...
==> davetcoleman/rosdistro is not a fork, searching...
Failed to open pull request: GithubException - Failed to list repositories for user 'davetcoleman' using url '/users/davetcoleman/repos?page=1': 401 Unauthorized
edit retag flag offensive close merge delete

Comments

Please post your bloom log for this run (they are in ~/.bloom_logs)

William gravatar imageWilliam ( 2014-09-19 13:25:07 -0500 )edit

Have you exceeded your quota of github API requests or something?

ahendrix gravatar imageahendrix ( 2014-09-19 14:20:16 -0500 )edit

No, he probably put in his password wrong or the oauth token was revoked or something. bloom should never operate without authentication to prevent exactly this. AFAIK Github allows unlimited API requests for authenticated users.

William gravatar imageWilliam ( 2014-09-19 14:38:27 -0500 )edit

I changed computers this week, yes, and on the new computer Github/bloom wasn't working until I deleted the old oauth token. Now Im back on the older computer and it doesn't work. Not sure what is going on. Both computers have the same system name, also, fyi.

Dave Coleman gravatar imageDave Coleman ( 2014-09-19 16:38:30 -0500 )edit
1

You are getting 401 unauthorized which means the oauth token bloom has does not work. Remove the file ~/.config/bloom and try bloom again. It should prompt you to create a new oauth token. The identical computer name maybe a problem, you can edit them at https://github.com/settings/application .

William gravatar imageWilliam ( 2014-09-19 19:46:11 -0500 )edit

I had the same problem and removing the file ~/.config/bloom worked.

kmhallen gravatar imagekmhallen ( 2014-09-21 20:48:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

answered 2014-09-19 14:28:21 -0500

William gravatar image

updated 2014-09-22 12:35:44 -0500

EDIT: The problem is that you have two computers with the same name, bloom creates the name of the oauth token as bloom <bloom's version> on <computer name> which collides if you use the same version of bloom on the same computer. You can open a ticket on the bloom issue tracker, but manually renaming one of them would work around the issue.


The unhelpful error comes from a copy-paste error in the error handling code of that function. That should be fixed.

The root problem is that github returned a non 200 response when listing repositories. I don't know why that is occurring, especially without the actual response code.

Until I get it patched in bloom upstream, can you try modifying your github.py file with this patch and running again?

diff --git a/bloom/github.py b/bloom/github.py
index 1fc505b..b7d758d 100644
--- a/bloom/github.py
+++ b/bloom/github.py
@@ -121,10 +121,11 @@ class Github(object):
         page = start_page or 1
         repos = []
         while True:
-            resp = do_github_get_req('/users/{user}/repos?page={page}'.format(**locals()), auth=self.auth)
+            url = '/users/{user}/repos?page={page}'.format(**locals())
+            resp = do_github_get_req(url, auth=self.auth)
             if '{0}'.format(resp.status) not in ['200']:
                 raise GithubException(
-                    "Failed to get information for repository '{owner}/{repo}'".format(**locals()), resp)
+                    "Failed to list repositories for user '{user}' using url '{url}'".format(**locals()), resp)
             new_repos = json.loads(resp.read())
             if not new_repos:
                 return repos

EDIT:

Looking at the logs again I see that you have gotten a 401 unauthorized at a different step:

Received GithubException while checking for fork: Failed to get information for repository 'davetcoleman/rosdistro': 401 Unauthorized

So I guess bloom is taking this general error as a fork does not exist, so it is trying to list the repos you have to make sure there is not a name conflict, i.e. make sure you don't have a repo 'davetcoleman/rosdistro' already which is not a fork of 'ros/rosdistro' and this is where the 401 becomes fatal.

edit flag offensive delete link more

Comments

Dave Coleman gravatar imageDave Coleman ( 2014-09-19 16:39:24 -0500 )edit

I attempted your fix, above. Thanks for the support (but still no success)

Dave Coleman gravatar imageDave Coleman ( 2014-09-19 16:44:48 -0500 )edit

Is you OAuth token correct? Did you enable 2FA recently?

tfoote gravatar imagetfoote ( 2014-09-19 19:09:13 -0500 )edit

The above is not a fix, it just fixes the error reporting.

William gravatar imageWilliam ( 2014-09-19 19:39:05 -0500 )edit

I believe my OAuth token has been removed, but why doesn't bloom just make me a new one? It created my original one anyway. I don't really know much about OAuth except its what bloom needs. The new error I'm getting is still not helpful. I'm quite happy with my ssh keys :-)

Dave Coleman gravatar imageDave Coleman ( 2014-09-19 19:42:57 -0500 )edit

I just switched computers to one that has a properly configured OAuth, still not sure what was wrong

Dave Coleman gravatar imageDave Coleman ( 2014-09-19 19:47:28 -0500 )edit

bloom will make a new one if you remove the old one. You cannot use ssh keys to interact with github's web API which is required to do things like make forks and query branches remotely, etc... If you would like to learn more about OAuth... https://developer.github.com/v3/oauth/

William gravatar imageWilliam ( 2014-09-22 12:32:48 -0500 )edit

I updated my answer with, what I believe is, the actual problem and the workaround.

William gravatar imageWilliam ( 2014-09-22 12:36:48 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-09-19 13:23:20 -0500

Seen: 187 times

Last updated: Sep 22 '14