Last active
February 24, 2021 09:57
-
-
Save pkutaj/2de758d74a16a9db55337898e0956fec to your computer and use it in GitHub Desktop.
spagettiNomad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get-nomadLogs ($jobId, $featureFlag) { | |
$nomadLogs = ($featureFlag -ne "e") ? | |
(nomad alloc logs -job $jobId) : | |
(nomad alloc logs -stderr -job $jobId) | |
if ($featureFlag -eq "l") { oh -InputObject $nomadLogs } | |
if (nomad status $jobID | sls -Pattern "(?=.*\d)failed") { | |
write-host "Job Failed - see webUI - stderr below" -ForegroundColor DarkRed | |
Pause | |
$nomadLogs = nomad alloc logs -stderr -job $jobId | |
oh -InputObject $nomadLogs | |
} elseif (nomad status $jobID | sls status.*dead) { | |
if ($featureFlag -eq "p") { oh -InputObject $nomadLogs -Paging } | |
else { oh -InputObject $nomadLogs } | |
} else { nomad status $jobID | sls status.*=.* } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment