class ErrptEntry

Attributes

_in_summary[RW]
_show[RW]
class[R]
data_string_raw[R]
datetime[R]
datetime_long[R]
description[R]
identifier[R]
label[R]
parent_resource[RW]
resource_name[R]
type[R]

Public Class Methods

new(string) click to toggle source
# File lib/AIX/ErrptEntry.rb, line 28
def initialize(string)
  @data_string_raw = ''
  @parent_resource = nil

  @_show = false
  @_in_summary = false

  parse(string) unless string.empty?
end

Public Instance Methods

compare_short(other) click to toggle source
# File lib/AIX/ErrptEntry.rb, line 24
def compare_short(other)
  compare_short_string == other.compare_short_string
end
compare_short_string() click to toggle source

attr_accessor :break_size

# File lib/AIX/ErrptEntry.rb, line 20
def compare_short_string
  "#{label}:#{identifier}:#{type}:" + @class + ":#{resource_name}:#{description}"
end
parse(string) click to toggle source
# File lib/AIX/ErrptEntry.rb, line 38
  def parse(string)
    @data_string_raw = string

    regexp_long = %r{
LABEL:\s+([\w\_]+)\s+
IDENTIFIER:\s+(\w+)\s+
Date\/Time:\s+(\w{3}\s\w{3}\s+\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}\s\w{3}\s\d{4})\s+
Sequence\sNumber:\s(\d+)\s+
Machine\sId:\s+(\w+)\s+
Node\sId:\s+(\w+)\s+
Class:\s+(H|I|S)\s+
Type:\s+(TEMP)\s+
Resource\sName:\s+(\w+)\s+          
Resource\sClass:\s+(\w+)\s+
Resource\sType:\s+(\w+)\s+
Location:\s+([\w\/\-]+)\s+
VPD:(.*)
Description(.*)\s+
Probable\sCauses(.*)\s+
User\sCauses(.*)\s+
Failure\sCauses(.*)\s+
Detail\sData(.*)\s+
SENSE\sDATA(.*)}mx

    if match = %r{(\w{8})\s+(\d{10})\s+(T|P|I)\s+(S|H|O|U)\s+(\w+)\s+(.*)}.match(string)

      @identifier         = match[1]
      @datetime             = match[2]
      @type                           = match[3]
      @class                        = match[4]
      @resource_name    = match[5]
      @description        = match[6]

    elsif match_long = regexp_long.match(string)

      @label                        = match_long[1]
      @identifier         = match_long[2]
      @datetime_long    = match_long[3]


      else
      # puts "can't analyze string, regexp is not working"
      # puts string
      # puts regexp
      # puts match
      puts "regexp couldn't decode string #{string}"
      raise
    end

  end