Skip to content

Commit

Permalink
Fix reason not being passed when calling Set-PasswordstatePassword (#145
Browse files Browse the repository at this point in the history
)

* update gitignore

* allow for dev certs to be loaded into container for developing against a self signed passwordstate instance

* Fix issue where if using an api key and using a reason calls would fail to api due to adding the same headers twice.

* Add reason to call to get password when setting.
  • Loading branch information
dnewsholme authored Jun 30, 2021
1 parent f103794 commit e8e0575
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ RUN apt-get -y install git procps lsb-release

SHELL [ "pwsh", "-command" ]
RUN Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
COPY certs/*.pem /etc/ssl/certs/
RUN update-ca-certificates
RUN pwsh -noprofile -noninteractive -c 'Install-Module PowershellGet -Scope AllUsers -Force; Install-Module Pester -Scope AllUsers -Verbose; Install-Module PSFramework -Scope AllUsers'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ testResults.xml
cov.xml
.vscode
passwordstate.code-workspace
/.devcontainer/certs/*.pem
2 changes: 1 addition & 1 deletion functions/Set-PasswordStatePassword.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
process {
if ($PasswordID) {
try {
$result = Get-PasswordStatePassword -PasswordID $PasswordID -ErrorAction Stop
$result = Get-PasswordStatePassword -PasswordID $PasswordID @headerreason -ErrorAction Stop
}
catch {
throw "Given PasswordID '$PasswordID' not found"
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/Get-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function Get-PasswordStateResource {
$params += @{"headers" = $headers }
$skipheaders = $true
}
if ($extraparams -and $null -ne $extraparams.Headers) {
if ($extraparams -and $null -ne $extraparams.Headers -and $skipheaders -ne $true) {
Write-Verbose "[$(Get-Date -format G)] Adding extra parameter $($extraparams.keys) $($extraparams.values)"
$params += $extraparams
}
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/Remove-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Remove-PasswordStateResource {
$params += @{"headers" = $headers }
$skipheaders = $true
}
if ($extraparams -and $null -eq $extraparams.Headers) {
if ($extraparams -and $null -eq $extraparams.Headers -and $skipheaders -ne $true) {
Write-Verbose "[$(Get-Date -format G)] Adding extra parameter $($extraparams.keys) $($extraparams.values)"
$params += $extraparams
}
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/Set-PasswordStateResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Set-PasswordStateResource {
$params += @{"headers" = $headers }
$skipheaders = $true
}
if ($extraparams -and $null -eq $extraparams.Headers) {
if ($extraparams -and $null -eq $extraparams.Headers -and $skipheaders -ne $true) {
Write-Verbose "[$(Get-Date -format G)] Adding extra parameter $($extraparams.keys) $($extraparams.values)"
$params += $extraparams
}
Expand Down

0 comments on commit e8e0575

Please sign in to comment.