creativecommons / ccos-scripts

Scripts used to maintain various pieces of CC's open source presence.
MIT License
14 stars 19 forks source link

[Bug] sync_community_teams.py file handling is too fragile #164

Closed TimidRobot closed 1 year ago

TimidRobot commented 1 year ago

Description

Traceback (most recent call last):
  File "/Users/timidrobot/CreativeCommons/git/ccos-scripts/./sync_community_teams.py", line 36, in <module>
    main()
  File "/Users/timidrobot/CreativeCommons/git/ccos-scripts/./sync_community_teams.py", line 30, in main
    create_codeowners_for_data(get_community_team_data())
  File "/Users/timidrobot/CreativeCommons/git/ccos-scripts/ccos/teams/set_codeowners.py", line 63, in create_codeowners_for_data
    check_and_fix_repo(organization, repo, teams)
  File "/Users/timidrobot/CreativeCommons/git/ccos-scripts/ccos/teams/set_codeowners.py", line 109, in check_and_fix_repo
    set_up_repo(repo)
  File "/Users/timidrobot/CreativeCommons/git/ccos-scripts/ccos/teams/set_codeowners.py", line 210, in set_up_repo
    origin.pull()
  File "/Users/timidrobot/.local/share/virtualenvs/ccos-scripts-8EVzyQrj/lib/python3.10/site-packages/git/remote.py", line 1045, in pull
    res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout)
  File "/Users/timidrobot/.local/share/virtualenvs/ccos-scripts-8EVzyQrj/lib/python3.10/site-packages/git/remote.py", line 848, in _get_fetch_info_from_stderr
    proc.wait(stderr=stderr_text)
  File "/Users/timidrobot/.local/share/virtualenvs/ccos-scripts-8EVzyQrj/lib/python3.10/site-packages/git/cmd.py", line 604, in wait
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git pull -v -- origin

Expectation

The use of tempfile.TemporaryDirectory() would make this more robust/less fragile

Additional context

Resolution