added autoskip for consecutive fails, corrected hash map addressing for pairs, should solve issue #1
This commit is contained in:
parent
a71cf2f949
commit
f09e904fe3
@ -49,6 +49,14 @@ function ProduceHashMap {
|
||||
$timeStamp
|
||||
if($HashTable.ContainsKey($vmName)){
|
||||
$array = $HashTable[$vmName]
|
||||
$lastState=($array[$array.Count-1]).state
|
||||
Write-Host $lastState
|
||||
Write-Host $backUpState
|
||||
if (($lastState -eq 'Failed') -and ($backUpState -eq 'Failed')) {
|
||||
Write-Host "skipping"
|
||||
continue
|
||||
}
|
||||
Write-Host "continuing"
|
||||
try {
|
||||
$timeStamp = ConvertDate($date)
|
||||
$array += New-Object psobject -Property @{
|
||||
@ -58,10 +66,10 @@ function ProduceHashMap {
|
||||
}
|
||||
catch {
|
||||
foreach ($i in (($array.Count-1)..0)){
|
||||
Write-Host $array[$i]
|
||||
#Write-Host $array[$i]
|
||||
if ($array[$i]["state"] -eq 'Started') {
|
||||
Write-Host "found started"
|
||||
$timeStamp = $array[$i]['ts']
|
||||
#Write-Host "found started"
|
||||
$timeStamp = ($array[$i]).ts
|
||||
}
|
||||
}
|
||||
$array += New-Object psobject -Property @{
|
||||
@ -100,35 +108,4 @@ function ProcessLogToHash {
|
||||
$Path
|
||||
)
|
||||
ProduceHashMap -Elements $(getElems -Path $Path)
|
||||
}
|
||||
|
||||
<#$lines = Get-Content -Path .\log.txt | ForEach-Object {$_.SubString($_.IndexOf(":")+1)}
|
||||
$elems = $lines | Out-String -Stream | Select-String -Pattern "VMware-Maschine" | Out-String -Stream
|
||||
ProduceHashMap($elems)#>
|
||||
<#$HashTable =@{}
|
||||
foreach ($elem in $Elems){
|
||||
$indexOfFirst = $elem.IndexOf(" ")
|
||||
if($indexOfFirst -le 0){
|
||||
continue
|
||||
}
|
||||
$date = $elem.SubString(0,$elem.IndexOf(" ",($indexOfFirst + 1)))
|
||||
$timeStamp = ConvertDate($date)
|
||||
$rest = $elem.Substring($elem.IndexOf(" ",($indexOfFirst + 1))+1)
|
||||
$vmName = GetVMName($rest)
|
||||
$backUpState = DeterminState($rest)
|
||||
|
||||
if($HashTable.ContainsKey($vmName)){
|
||||
$array = $HashTable[$vmName]
|
||||
$array += New-Object psobject -Property @{
|
||||
state = $backUpState
|
||||
ts = $timeStamp
|
||||
}
|
||||
$HashTable[$vmName]=$array
|
||||
} else{
|
||||
$HashTable += @{$vmName=@(New-Object psobject -Property @{
|
||||
state = $backUpState
|
||||
ts = $timeStamp
|
||||
})}
|
||||
}
|
||||
}
|
||||
$HashTable#>
|
||||
}
|
Loading…
Reference in New Issue
Block a user