Skip to content

When a user does not exist in contributors, the script blows up #2

Open
aclark4life opened this Issue Sep 26, 2012 · 2 comments

3 participants

@aclark4life
Plone Collective member

e.g.


3163 - 1099/5000 - GET - https://api.github.com/teams/107250/repos?per_page=10000
REMOVED TEAMS:
UPDATING TEAMS:
    - --auto-collective.codemirror-owners - ADDED MEMBERS:
3164 - 1098/5000 - PUT - https://api.github.com/teams/161595/members/alex-morega?per_page=10000
{'headers': {'Authorization': 'Basic cGxvbmUtZm91bmRhdGlvbjpnYXJiYXNpc2dldHRpbmdvbGQzMA==',
             'Content-Length': '0'},
 'url': u'https://api.github.com/teams/161595/members/alex-morega?per_page=10000'}
'{"message":"Not Found"}'
Traceback (most recent call last):
  File "/opt/github-collective/bin/github-collective", line 8, in <module>
    load_entry_point('github-collective==0.1.4', 'console_scripts', 'github-collective')()
  File "/opt/github-collective/githubcollective/__init__.py", line 81, in run
    ).run(new, old)
  File "/opt/github-collective/githubcollective/sync.py", line 150, in run
    self.add_team_member(old, old_team, member)
  File "/opt/github-collective/githubcollective/sync.py", line 248, in add_team_member
    return self.github._gh_org_add_team_member(team.id, member)
  File "/opt/github-collective/githubcollective/github.py", line 148, in _gh_org_add_team_member
    return self._put_request('/teams/%s/members/%s' % (id, member))
  File "/opt/github-collective/githubcollective/github.py", line 80, in _put_request
    return self._request(requests.put, url)
  File "/opt/github-collective/githubcollective/github.py", line 61, in _request
    raise e
requests.exceptions.HTTPError: 404 Client Error


@davidjb
Plone Collective member
davidjb commented Oct 2, 2012

This could be an interesting one to attempt to fix. The obvious option would be check all user IDs mentioned in a configuration file to see if they exist, but this is going to be a long process since the GitHub API only allows 1 look up at a time. Caching is probably the best way to go, but then the same issue will happen when/if someone removes their account -- this is a lot less likely to happen compared to someone making a typo when changing the config.

Sound reasonable / other suggestions?

@gregswift

This seems very similar to the 422 error if the user is not in the org.

My general thought was to maybe just catch the exception and write a list of bad users to a log file if they dont exist at all, and another file if they aren't in the org. possibly add a switch to '--invite-missing-members' that invites them as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.