adds pinguinfuss contributed fix (#73)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
#### 📖 Summary - redo PR from @pinguinfuss - fix error message - fix string quotation #### 📑 Test Plan > 💡 Select your test plan for the code changes. - [x] Tested via Drone.io pipeline - [ ] Custom test - [ ] No test plan ##### Details / Justification <!-- Add your test details or justification for missing tests here. --> #### 📚 Additional Notes - just redo #72. - there was an issue caused by git config `core.autocrl` displaying / diffin the wrong line ending sequence Co-authored-by: OCram85 <marco.blessing@googlemail.com> Reviewed-on: #73
This commit is contained in:
parent
6fce8d6a8c
commit
3d4f53ddc7
@ -102,7 +102,7 @@ Describe "New-CredentialStoreItem" {
|
|||||||
It "Missing CredentialStore should throw" {
|
It "Missing CredentialStore should throw" {
|
||||||
{
|
{
|
||||||
New-CredentialStoreItem -Shared -Path '/tmp/missingStore.json' -RemoteHost 'notrelevant'
|
New-CredentialStoreItem -Shared -Path '/tmp/missingStore.json' -RemoteHost 'notrelevant'
|
||||||
} | Should -Throw "Could not add anything into the given CredentialStore."
|
} | Should -Throw "The given credential store (/tmp/missingStore.json) does not exist!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context "Testing pipeline paramter" {
|
Context "Testing pipeline paramter" {
|
||||||
|
@ -32,7 +32,7 @@ function New-CredentialStoreItem {
|
|||||||
[None]
|
[None]
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
|
New-CredentialStoreItem -Path 'C:\TMP\mystore.json' -RemoteHost esx01.myside.local'
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Private')]
|
[CmdletBinding(DefaultParameterSetName = 'Private')]
|
||||||
@ -68,7 +68,7 @@ function New-CredentialStoreItem {
|
|||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Set the CredentialStore for private, shared or custom mode.
|
# Set the CredentialStore for private, shared or custom mode.
|
||||||
Write-Debug ("ParameterSetName: {0}" -f $PSCmdlet.ParameterSetName)
|
Write-Debug ('ParameterSetName: {0}' -f $PSCmdlet.ParameterSetName)
|
||||||
if ($PSCmdlet.ParameterSetName -eq 'Private') {
|
if ($PSCmdlet.ParameterSetName -eq 'Private') {
|
||||||
$Path = Get-DefaultCredentialStorePath
|
$Path = Get-DefaultCredentialStorePath
|
||||||
}
|
}
|
||||||
@ -84,9 +84,9 @@ function New-CredentialStoreItem {
|
|||||||
if (-not(Test-CredentialStore -Shared -Path $Path)) {
|
if (-not(Test-CredentialStore -Shared -Path $Path)) {
|
||||||
$MessageParams = @{
|
$MessageParams = @{
|
||||||
Exception = [System.IO.FileNotFoundException]::new(
|
Exception = [System.IO.FileNotFoundException]::new(
|
||||||
'Could not add anything into the given CredentialStore.'
|
'The given credential store ({0}) does not exist!' -f $Path
|
||||||
)
|
)
|
||||||
ErrorAction = "Stop"
|
ErrorAction = 'Stop'
|
||||||
}
|
}
|
||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
@ -95,8 +95,8 @@ function New-CredentialStoreItem {
|
|||||||
|
|
||||||
$CurrentDate = Get-Date -Format 'u'
|
$CurrentDate = Get-Date -Format 'u'
|
||||||
|
|
||||||
if ($Identifier -ne "") {
|
if ($Identifier -ne '') {
|
||||||
$CredentialName = $RemoteHost = "{0}/{1}" -f $Identifier, $RemoteHost
|
$CredentialName = $RemoteHost = '{0}/{1}' -f $Identifier, $RemoteHost
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$CredentialName = $RemoteHost
|
$CredentialName = $RemoteHost
|
||||||
|
Loading…
Reference in New Issue
Block a user