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

If cigetcert fails for any reason, raise PermissionError #572

Merged
merged 2 commits into from
May 23, 2024

Conversation

shreyb
Copy link
Collaborator

@shreyb shreyb commented May 17, 2024

Fixes #570.

This PR also adds two new unit tests to check the new logic, as well as a minor bug fix for the existing getProxy tests themselves.

Note: According to the docs:

there are two ways to check if a subprocess.run() call fails:

  1. Pass the check=True kwarg to the function, which will make it raise a CalledProcessError if the return code of the underlying subprocess is nonzero (i.e. subprocess.run('exit 1', check=True) will raise a CalledProcessError), and
  2. If you don't want to immediately raise the error, set check=False, and then save the return value of subprocess.run() to a variable (e.g. result). Then, when you're ready, you can run result.check_returncode(), which will raise the CalledProcessError if the return code is nonzero.

We use the second method here, since we want to raise different errors based on the output of cigetcert.

@shreyb shreyb added this to the 1.8.1 milestone May 17, 2024
@shreyb shreyb requested review from goodenou and vitodb May 17, 2024 18:05
@goodenou
Copy link
Collaborator

These changes look good Shreyas. Good ahead and merge the PR.

@shreyb
Copy link
Collaborator Author

shreyb commented May 23, 2024

Merging, as Lisa gave her written approval in the comment above.

@shreyb shreyb merged commit 1f71d00 into fermitools:master May 23, 2024
2 checks passed
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 this pull request may close these issues.

Fail getting proxy if cigetcert fails for any reason
2 participants