Commit ef224ca
authored
Azure Identity: AzureCliCredentials and AzureDeveloperCliCredential handle 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 391761 parent cebf572 commit ef224ca
File tree
5 files changed
+33
-4
lines changed- sdk/identity/azure-identity
- azure/identity/_credentials
- tests
5 files changed
+33
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
267 | 269 | | |
268 | 270 | | |
269 | 271 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
150 | 161 | | |
151 | 162 | | |
152 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
233 | 245 | | |
234 | 246 | | |
235 | 247 | | |
| |||
0 commit comments