Skip to content

Commit

Permalink
Extract system info to its own method
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal committed Dec 24, 2024
1 parent 2efa3fc commit 3a0103e
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions client/server/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,7 @@ func (s *Server) createArchive(bundlePath *os.File, req *proto.DebugBundleReques
}

if req.GetSystemInfo() {
if err := s.addRoutes(req, anonymizer, archive); err != nil {
log.Errorf("Failed to add routes to debug bundle: %v", err)
}

if err := s.addInterfaces(req, anonymizer, archive); err != nil {
log.Errorf("Failed to add interfaces to debug bundle: %v", err)
}

if err := s.addFirewallRules(req, anonymizer, archive); err != nil {
log.Errorf("Failed to add firewall rules to debug bundle: %v", err)
}
s.addSystemInfo(req, anonymizer, archive)
}

if err := s.addNetworkMap(req, anonymizer, archive); err != nil {
Expand All @@ -214,6 +204,20 @@ func (s *Server) createArchive(bundlePath *os.File, req *proto.DebugBundleReques
return nil
}

func (s *Server) addSystemInfo(req *proto.DebugBundleRequest, anonymizer *anonymize.Anonymizer, archive *zip.Writer) {
if err := s.addRoutes(req, anonymizer, archive); err != nil {
log.Errorf("Failed to add routes to debug bundle: %v", err)
}

if err := s.addInterfaces(req, anonymizer, archive); err != nil {
log.Errorf("Failed to add interfaces to debug bundle: %v", err)
}

if err := s.addFirewallRules(req, anonymizer, archive); err != nil {
log.Errorf("Failed to add firewall rules to debug bundle: %v", err)
}
}

func (s *Server) addReadme(req *proto.DebugBundleRequest, archive *zip.Writer) error {
if req.GetAnonymize() {
readmeReader := strings.NewReader(readmeContent)
Expand Down

0 comments on commit 3a0103e

Please sign in to comment.