mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-07 20:45:40 +00:00
fix: remove defunct DELETE /access/ticket call and gain -Session parameter
Disconnect-PveServer was calling DELETE /access/ticket, an endpoint that does not exist in the PVE API spec. The call always failed but errors were swallowed, so the cmdlet succeeded while claiming server-side invalidation occurred. Rebase on PveCmdletBase to gain the -Session parameter, making explicit session disconnection possible (the cmdlet previously only worked with the active session). Update help text to clarify that PVE tickets expire server-side after two hours and cannot be revoked. Remove the DELETE call entirely — tickets are stateless and expire on their own. Clear ModuleState.ActiveSession only when disconnecting the active session (no -Session given) or when explicitly disconnecting the active session.
This commit is contained in:
committed by
GitHub
parent
68f953075d
commit
e4a667e7fc
@@ -38,6 +38,10 @@ Describe 'Disconnect-PveServer' {
|
||||
# attribute is present by confirming ShouldProcess support is enabled.
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should expose -Session parameter' {
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Behaviour when no session is active' {
|
||||
@@ -53,4 +57,12 @@ Describe 'Disconnect-PveServer' {
|
||||
{ Disconnect-PveServer -WhatIf -ErrorAction Stop } | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Active session lifecycle' {
|
||||
It 'Should clear active session when disconnected without explicit -Session' {
|
||||
Disconnect-PveServer -Confirm:$false -ErrorAction SilentlyContinue
|
||||
$Module = Get-Module PSProxmoxVE
|
||||
$Module.PrivateData.ModuleState.ActiveSession | Should -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user