Updated Connect-GraylogService to import the ConvertFrom-GraylogSession function before it calls is

This commit is contained in:
Nathan Windisch 2024-07-26 13:57:45 +01:00
parent 3511d98e62
commit 63bfd2bc40

View File

@ -30,7 +30,6 @@ function Connect-GraylogService {
[PSCredential] [PSCredential]
$Credential $Credential
) )
if ((Test-GraylogSession -SkipSecretCheck)) { return } # If the session is still valid, don't create a new one
if (-NOT $Credential) { if (-NOT $Credential) {
try { try {
$Credential = Get-Secret Graylog_Credential -Vault Graylog -ErrorAction Stop $Credential = Get-Secret Graylog_Credential -Vault Graylog -ErrorAction Stop
@ -61,6 +60,7 @@ function Connect-GraylogService {
try { $null = Invoke-RestMethod @Request } try { $null = Invoke-RestMethod @Request }
catch { throw $_.Exception.Message } catch { throw $_.Exception.Message }
Import-Module "$PSScriptRoot\..\Private\ConvertFrom-GraylogSession.ps1"
$GraylogSession | ConvertFrom-GraylogSession | Set-Secret Graylog_Session $GraylogSession | ConvertFrom-GraylogSession | Set-Secret Graylog_Session
} }
# Export-ModuleMember -Function Connect-Graylog # Export-ModuleMember -Function Connect-Graylog