Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resilience if git command fails #15

Closed
mwichmann opened this issue Aug 9, 2024 · 1 comment · Fixed by #21
Closed

Resilience if git command fails #15

mwichmann opened this issue Aug 9, 2024 · 1 comment · Fixed by #21

Comments

@mwichmann
Copy link

I'm working on an experimental setup (following on from the thread in #12), and have made some fumble-finger mistakes on the local repo (typo when changing the git remote from https to git@). So the first generated git command line fails with an exception (as it should), and then the rollback/cleanup fails too. Here's part of the trace:

    return subprocess.run(list(map(str, cmd)), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'push', '-f', 'origin', 'mwichmann/stack/1:mwichmann/stack/1', 'mwichmann/stack/2:mwichmann/stack/2', 'mwichmann/stack/3:mwichmann/stack/3']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mats/.pyenv/versions/venv-system312/bin/stack-pr", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/mats/.pyenv/versions/venv-system312/lib64/python3.12/site-packages/stack_pr/cli.py", line 1222, in main
    print_cmd_failure_details(exc)
  File "/home/mats/.pyenv/versions/venv-system312/lib64/python3.12/site-packages/stack_pr/cli.py", line 568, in print_cmd_failure_details
    cmd_stdout = exc.stdout.decode("utf-8").replace("\\n", "\n").replace("\\t", "\t")
                 ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'

Seems like a check for None there might be in order.

I've got the setup working now so probably won't see this again.

@ZolotukhinM
Copy link
Collaborator

Ack, thanks for the report! I'll add an error check there, but if you'd like to contribute, we accept PRs too :)

ZolotukhinM added a commit that referenced this issue Aug 24, 2024
ZolotukhinM added a commit that referenced this issue Aug 24, 2024
Fixes #15.

stack-info: PR: #21, branch: ZolotukhinM/stack/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants