Skip to content

Commit

Permalink
Merge branch 'master' into scan-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
clr2of8 authored Dec 12, 2023
2 parents affee10 + 14b7721 commit 5a9c699
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 0 additions & 4 deletions Public/Invoke-AtomicRunner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,13 @@ function Invoke-AtomicRunner {
$tr.InputArgs = ConvertFrom-StringData -StringData $theArgs
}
$sc = $tr.AtomicsFolder
if ($Cleanup) { if (Get-Command 'Invoke-AtomicRunnerPreAtomicCleanupHook' -errorAction SilentlyContinue) { Invoke-AtomicRunnerPreAtomicCleanupHook } }
elseif (-not($ShowDetails -or $CheckPrereqs -or $ShowDetailsBrief -or $GetPrereqs)) { if (Get-Command 'Invoke-AtomicRunnerPreAtomicHook' -errorAction SilentlyContinue) { Invoke-AtomicRunnerPreAtomicHook } }
#Run the Test based on if scheduleContext is 'private' or 'public'
if (($sc -eq 'public') -or ($null -eq $sc)) {
Invoke-AtomicTest $tr.Technique -TestGuids $tr.auto_generated_guid -InputArgs $tr.InputArgs -TimeoutSeconds $tr.TimeoutSeconds -ExecutionLogPath $artConfig.execLogPath -PathToAtomicsFolder $artConfig.PathToPublicAtomicsFolder @htvars -Cleanup:$Cleanup -supressPathToAtomicsFolder
}
elseif ($sc -eq 'private') {
Invoke-AtomicTest $tr.Technique -TestGuids $tr.auto_generated_guid -InputArgs $tr.InputArgs -TimeoutSeconds $tr.TimeoutSeconds -ExecutionLogPath $artConfig.execLogPath -PathToAtomicsFolder $artConfig.PathToPrivateAtomicsFolder @htvars -Cleanup:$Cleanup -supressPathToAtomicsFolder
}
if ($Cleanup) { if (Get-Command 'Invoke-AtomicRunnerPostAtomicCleanupHook' -errorAction SilentlyContinue) { Invoke-AtomicRunnerPostAtomicCleanupHook } }
elseif (-not($ShowDetails -or $CheckPrereqs -or $ShowDetailsBrief -or $GetPrereqs)) { if (Get-Command 'Invoke-AtomicRunnerPostAtomicHook' -errorAction SilentlyContinue) { Invoke-AtomicRunnerPostAtomicHook } }
if ($timeToPause -gt 0) {
Write-Host "Sleeping for $timeToPause seconds..."
Start-Sleep $timeToPause
Expand Down
6 changes: 5 additions & 1 deletion Public/Invoke-AtomicTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,10 @@ function Invoke-AtomicTest {
elseif ($Cleanup) {
Write-KeyValue "Executing cleanup for test: " $testId
$final_command = Merge-InputArgs $test.executor.cleanup_command $test $InputArgs $PathToPayloads
if (Get-Command 'Invoke-ARTPreAtomicCleanupHook' -errorAction SilentlyContinue) { Invoke-ARTPreAtomicCleanupHook $test $InputArgs}
$res = Invoke-ExecuteCommand $final_command $test.executor.name $executionPlatform $TimeoutSeconds $session -Interactive:$Interactive
Write-KeyValue "Done executing cleanup for test: " $testId
if (Get-Command 'Invoke-ARTPostAtomicCleanupHook' -errorAction SilentlyContinue) { Invoke-ARTPostAtomicCleanupHook $test $InputArgs}
if ($(Test-IncludesTerraform $AT $testCount)) {
Remove-TerraformFiles $AT $testCount
}
Expand All @@ -481,8 +483,10 @@ function Invoke-AtomicTest {
Write-KeyValue "Executing test: " $testId
$startTime = Get-Date
$final_command = Merge-InputArgs $test.executor.command $test $InputArgs $PathToPayloads
if (Get-Command 'Invoke-ARTPreAtomicHook' -errorAction SilentlyContinue) { Invoke-ARTPreAtomicHook $test $InputArgs }
$res = Invoke-ExecuteCommand $final_command $test.executor.name $executionPlatform $TimeoutSeconds $session -Interactive:$Interactive
Write-Host "Exit code: $($res.ExitCode)"
if (Get-Command 'Invoke-ARTPostAtomicHook' -errorAction SilentlyContinue) { Invoke-ARTPostAtomicHook $test $InputArgs}
$stopTime = Get-Date
if ($isLoggingModuleSet) {
&"$LoggingModule\Write-ExecutionLog" $startTime $stopTime $AT $testCount $test.name $test.auto_generated_guid $test.executor.name $test.description $final_command $ExecutionLogPath $executionHostname $executionUser $res (-Not($IsLinux -or $IsMacOS))
Expand Down Expand Up @@ -522,4 +526,4 @@ function Invoke-AtomicTest {

} # End of PROCESS block
END { } # Intentionally left blank and can be removed
}
}
2 changes: 1 addition & 1 deletion Public/Syslog-ExecutionLogger.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Write-ExecutionLog($startTime, $stopTime, $technique, $testNum, $testNa

# send syslog message if a syslog server is defined in Public/config.ps1
if ([bool]$artConfig.syslogServer -and [bool]$artConfig.syslogPort) {
$jsonMsg = $msg | ConvertTo-Json
$jsonMsg = $msg | ConvertTo-Json -Compress
Send-SyslogMessage -Server $artConfig.syslogServer -Port $artConfig.syslogPort -Message $jsonMsg -Severity "Informational" -Facility "daemon" -Transport $artConfig.syslogProtocol
}
}
Expand Down

0 comments on commit 5a9c699

Please sign in to comment.