You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a page for adding my PXE deployments in the queue and everything works fine. Now I need to create a log file with new deployment but for some reason when I add
and click the button to add the deployment in the queue I get a warning in the console:
WARNING: Resulting JSON is truncated as serialization has exceeded the set depth of 10
The page hangs, file gets created but button animation is in the loop and modal windows doesn't popup. Commenting out "New-Item", everything works fine. Here is a page snippet. Some data is redacted.
New-PodeWebCard-Name "Add deployment"-Content @(
New-PodeWebForm-Name "Add PXE Deployment"-SubmitText "Add Deployment"-ShowReset -ResetText "Reset Form"-Content @(
New-PodeWebTextbox-Name "Hostname"-DisplayName "Host Name"-Required -Width 500px -PrependIcon "desktop-classic"-HelpText "Hostname must follow REDACTED naming convention"New-PodeWebTextbox-Name "MACAddress"-DisplayName "MAC Address"-Required -Width 500px -PrependIcon "lan"-HelpText "MAC address needs to be in hypen format: aa-bb-cc-11-22-33"New-PodeWebLine
) -ScriptBlock {
$DBPath= (Get-PodeConfig).DBPath
$DBQuery="SELECT MACAddress, IPAddress, Hostname FROM Deployments"$DBData=Invoke-SqliteQuery-Query $DBQuery-DataSource $DBPath$Hostname=$WebEvent.Data.Hostname.ToUpper()
$MACAddress=$WebEvent.Data.MACAddress.ToUpper()
$invalid=$falseif ($Hostname-notmatch"^(REDACTED-|READECTED-)[A-Z]{4}-[0-9]{2}$") {
Out-PodeWebValidation-Name "Hostname"-Message "Invalid Hostname format."$invalid=$true
}
if ($MACAddress-notmatch"^(([A-F0-9]{2}[-]){5}[A-F0-9]{2})$") {
Out-PodeWebValidation-Name "MACAddress"-Message "Invalid MAC address or format. MAC address must be entered in hyphen format."$invalid=$true
}
if ($MACAddress-eq$DBData.MACAddress) {
Out-PodeWebValidation-Name "MACAddress"-Message "MAC address already exists in deployment."$invalid=$true
}
if ($Hostname-eq$DBData.Hostname) {
Out-PodeWebValidation-Name "Hostname"-Message "Hostname already exists in deployment."$invalid=$true
}
if ($invalid) {
return
}
$DBPath= (Get-PodeConfig).DBPath
$DBQuery="SELECT AESKey, AESIV FROM Security"$DBData=Invoke-SqliteQuery-Query $DBQuery-DataSource $DBPath$EncryptUsername=Invoke-AESStringEncrypt-PlainTextString "$($WebEvent.Auth.User.Domain)\$($WebEvent.Auth.User.Username)"-Key $DBData.AESKey-InitVector $DBData.AESIV$PlainPassword=ConvertFrom-SecureString-SecureString $WebEvent.Auth.User.Credential.Password-AsPlainText
$EncryptPassword=Invoke-AESStringEncrypt-PlainTextString $PlainPassword-Key $DBData.AESKey-InitVector $DBData.AESIVClear-Variable-Name "PlainPassword"$DBPath= (Get-PodeConfig).DBPath
$DBQuery="INSERT INTO Deployments (MACAddress, Hostname, IPAddress, Username, Password, DeployStatus, VNCStatus) VALUES ('$MACAddress', '$Hostname', 'Waiting on PE', '$EncryptUsername', '$EncryptPassword', 'Waiting on PE', 'Waiting on PE')"Invoke-SqliteQuery-Query $DBQuery-DataSource $DBPathShow-PodeWebModal-Name "Add PXE Deployment"Sync-PodeWebTable-Name "PXE Deployment Status"Reset-PodeWebForm-Name "Add PXE Deployment"New-LogEntry-LogLevel '[INFO]'-LogLine "Deployment added to the queue by $($WebEvent.Auth.User.Username)"-Hostname "$Hostname"-MACAddress "$MACAddress"-LogFile "deployment.log"New-Item-ItemType File -Force -Path "$PSScriptRoot\public\logs\deployment\$($WebEvent.Data.MACAddress).log"
}
)
New-PodeWebModal-Name "Add PXE Deployment"-DisplayName "Add PXE Deployment"-Icon "server-plus"-Content @(
New-PodeWebAlert-Type Success -Content @(
New-PodeWebText-Value "Deployment successfully added."
)
)
EDIT
Tried with piping empty string to Out-FiIe, empty string with redirect operator and finally Set-Content with empty string as a -Value, they all worked. Bug maybe?
The text was updated successfully, but these errors were encountered:
I have created a page for adding my PXE deployments in the queue and everything works fine. Now I need to create a log file with new deployment but for some reason when I add
and click the button to add the deployment in the queue I get a warning in the console:
The page hangs, file gets created but button animation is in the loop and modal windows doesn't popup. Commenting out "New-Item", everything works fine. Here is a page snippet. Some data is redacted.
EDIT
Tried with piping empty string to Out-FiIe, empty string with redirect operator and finally Set-Content with empty string as a -Value, they all worked. Bug maybe?
The text was updated successfully, but these errors were encountered: