Skip to content

Commit

Permalink
Adds installation information to Agent's flare (#5474)
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi authored May 12, 2020
1 parent 37924d8 commit 207bc7e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pkg/flare/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ func createArchive(zipFilePath string, local bool, confSearchPaths SearchPaths,
log.Errorf("Could not zip logs: %s", err)
}

err = zipInstallInfo(tempDir, hostname)
if err != nil {
log.Errorf("Could not zip install_info: %s", err)
}

// gets files infos and write the permissions.log file
if err := permsInfos.commit(tempDir, hostname, os.ModePerm); err != nil {
log.Errorf("Could not write permissions.log file: %s", err)
Expand Down Expand Up @@ -542,6 +547,30 @@ func zipHealth(tempDir, hostname string) error {
return err
}

func zipInstallInfo(tempDir, hostname string) error {
originalPath := filepath.Join(config.FileUsedDir(), "install_info")
original, err := os.Open(originalPath)
if err != nil {
return err
}
defer original.Close()

zippedPath := filepath.Join(tempDir, hostname, "install_info")
err = ensureParentDirsExist(zippedPath)
if err != nil {
return err
}

zipped, err := os.OpenFile(zippedPath, os.O_RDWR|os.O_CREATE, os.ModePerm)
if err != nil {
return err
}
defer zipped.Close()

_, err = io.Copy(zipped, original)
return err
}

func zipTelemetry(tempDir, hostname string) error {
return zipHTTPCallContent(tempDir, hostname, "telemetry.log", telemetryURL)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Each section from every releasenote are combined when the
# CHANGELOG.rst is rendered. So the text needs to be worded so that
# it does not depend on any information only available in another
# section. This may mean repeating some details, but each section
# must be readable independently of the other.
#
# Each section note must be formatted as reStructuredText.
---
enhancements:
- |
The Agent's flare now includes information about the method used
to install the Agent.

0 comments on commit 207bc7e

Please sign in to comment.