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

Azure Identity: AzureCliCredentials and AzureDeveloperCliCredential handle stderr may be None when executing subprocess #39176

Merged
merged 5 commits into from
Jan 16, 2025

Conversation

jenshnielsen
Copy link
Contributor

@jenshnielsen jenshnielsen commented Jan 14, 2025

Description

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

Stderr output of the child process if it was
captured by run(). Otherwise, None.

https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In AzureCliCredential._run_command (and similar in AzureDeveloperCliCredential) this is
handled when propagating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Sorry, something went wrong.

@jenshnielsen jenshnielsen requested review from pvaneck, xiangyan99 and a team as code owners January 14, 2025 09:35
@github-actions github-actions bot added Azure.Identity Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jan 14, 2025
Copy link

Thank you for your contribution @jenshnielsen! We will review the pull request and get back to you soon.

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@jenshnielsen jenshnielsen force-pushed the azure_identity_handle_stderr_none branch from fd69b67 to 92ab2e9 Compare January 14, 2025 10:07
@jenshnielsen jenshnielsen changed the title Azure Identity: AzureCliCredentials Handle stderr may be None Azure Identity: AzureCliCredentials and AzureDeveloperCliCredential handle stderr may be None when executing subprocess Jan 14, 2025
for AzureCliCredential

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

```
Stderr output of the child process if it was
captured by run(). Otherwise, None.
```
https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In AzureCliCredential._run_command this is
handled when propergating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.
add a test for error handling when
AzureDeveloperCliCredential fails to capture
stderr
for AzureDeveloperCliCredential

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

```
Stderr output of the child process if it was
captured by run(). Otherwise, None.
```
https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In _run_command this is
handled when propergating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
add a test for error handling when
AzureCliCredential execution fails to capture
stderr
@jenshnielsen jenshnielsen force-pushed the azure_identity_handle_stderr_none branch from 92ab2e9 to 9ff3a7c Compare January 14, 2025 11:51
@jenshnielsen jenshnielsen force-pushed the azure_identity_handle_stderr_none branch from c27a12c to 9568ced Compare January 14, 2025 13:44
@xiangyan99 xiangyan99 merged commit ef224ca into Azure:main Jan 16, 2025
22 checks passed
@jenshnielsen jenshnielsen deleted the azure_identity_handle_stderr_none branch January 17, 2025 06:22
allenkim0129 pushed a commit to allenkim0129/azure-sdk-for-python that referenced this pull request Jan 27, 2025
…andle stderr may be None when executing subprocess (Azure#39176)

* Azure Identity: Handle stderr may be None
for AzureCliCredential

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

```
Stderr output of the child process if it was
captured by run(). Otherwise, None.
```
https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In AzureCliCredential._run_command this is
handled when propergating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.

* AzureIdentity: AzureDeveloperCliCredential

add a test for error handling when
AzureDeveloperCliCredential fails to capture
stderr

* Azure Identity: Handle stderr may be None
for AzureDeveloperCliCredential

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

```
Stderr output of the child process if it was
captured by run(). Otherwise, None.
```
https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In _run_command this is
handled when propergating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.

* AzureIdentity: AzureCliCredential

add a test for error handling when
AzureCliCredential execution fails to capture
stderr

* Add changelog for 39176
l0lawrence pushed a commit to l0lawrence/azure-sdk-for-python that referenced this pull request Feb 19, 2025
…andle stderr may be None when executing subprocess (Azure#39176)

* Azure Identity: Handle stderr may be None
for AzureCliCredential

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

```
Stderr output of the child process if it was
captured by run(). Otherwise, None.
```
https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In AzureCliCredential._run_command this is
handled when propergating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.

* AzureIdentity: AzureDeveloperCliCredential

add a test for error handling when
AzureDeveloperCliCredential fails to capture
stderr

* Azure Identity: Handle stderr may be None
for AzureDeveloperCliCredential

According to the docs
CredentialUnavailableError.stderr may be None
if no output is captured.

```
Stderr output of the child process if it was
captured by run(). Otherwise, None.
```
https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

In _run_command this is
handled when propergating the error
but was overlooked in other parts of the code.
This pr fixes the code to ensure that the None
case is handled before checking for str content.

* AzureIdentity: AzureCliCredential

add a test for error handling when
AzureCliCredential execution fails to capture
stderr

* Add changelog for 39176
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants