// Package redfishwalk is a vendor-agnostic fallback for archives that carry // a captured Redfish directory-tree walk (see vendors/redfishtree for the // detection rule) but aren't claimed by a dedicated vendor parser. Dell TSR // bundles from iDRAC10-generation firmware are the first known source of // this format, and are handled directly by vendors/dell (which also carries // other Dell-specific markers and merges the walk into DCIM-XML-derived // data). This parser exists so any other vendor that starts shipping the // same kind of raw Redfish walk is picked up automatically, without needing // a dedicated parser first. package redfishwalk import ( "fmt" "git.mchus.pro/mchus/logpile/internal/collector" "git.mchus.pro/mchus/logpile/internal/models" "git.mchus.pro/mchus/logpile/internal/parser" "git.mchus.pro/mchus/logpile/internal/parser/vendors/redfishtree" ) const parserVersion = "1.0" func init() { parser.Register(&Parser{}) } // Parser implements VendorParser for archives containing a raw Redfish // directory-tree walk with no other recognizable vendor markers. type Parser struct{} func (p *Parser) Name() string { return "Generic Redfish Walk Parser" } func (p *Parser) Vendor() string { return "redfish_walk" } func (p *Parser) Version() string { return parserVersion } // Detect returns a confidence deliberately placed above the generic text // fallback (15) but below any dedicated vendor parser, so a vendor-specific // parser always wins when both recognize the same archive. func (p *Parser) Detect(files []parser.ExtractedFile) int { for _, f := range redfishtree.FindCandidateArchives(files) { if redfishtree.Build(f.Content) != nil { return 35 } } return 0 } func (p *Parser) Parse(files []parser.ExtractedFile) (*models.AnalysisResult, error) { for _, f := range redfishtree.FindCandidateArchives(files) { tree := redfishtree.Build(f.Content) if tree == nil { continue } result, err := collector.ReplayRedfishFromRawPayloads(map[string]any{"redfish_tree": tree}, nil) if err != nil { continue } return result, nil } return nil, fmt.Errorf("redfish_walk: no Redfish tree snapshot found") }