Commit 23838e2
Adding check for empty string as well as null (#102)
When using the -Credentials parameter when calling `Invoke-PSDepend` for
dependencies that don't require credentials, would result in the
erroneous warning `WARNING: No credential found for the specified name .
Was the dependency misconfigured?`
### Example
```sh
Invoke-PSDepend -Path "./depends.psd1" -Install -Import -Credentials @{
"repo1WithCredential" = (Get-Credential)
}
```
#### File `depends.psd1`
```sh
@{
"PSModule1" = @{
"Name" = "PSModule1"
"Version" = "1.0.0"
"DependencyType" = "PSGalleryModule"
"Credential" = "repo1WithCredential"
"Parameters" = @{
"Repository" = "repo1WithCredential"
}
}
"PSModule2" = @{
"Name" = "PSModule2"
"Version" = "2.1.0"
"DependencyType" = "PSGalleryModule"
"Parameters" = @{
"Repository" = "repo2WithoutCredential"
}
```
Would generate the warning when processing the `PSModule2` dependency.
```sh
WARNING: No credential found for the specified name . Was the dependency misconfigured?
```
### Fix
The -Name parameter in `Resolve-Credential` is cast from $null to an
empty string "". So now both null and an empty string are checked.
---------
Signed-off-by: Gilbert Sanchez <me@gilbertsanchez.com>
Co-authored-by: rmiller@nordex-online.com <rmiller@nordex-online.com>
Co-authored-by: Gilbert Sanchez <me@gilbertsanchez.com>1 parent 62cb759 commit 23838e2
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
0 commit comments