Skip to content

[CM] Fix enroll under Windows #12799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
processor (or by any code utilizing `PutValue()` on a `beat.Event`).
- Fix leak in script processor when using Javascript functions in a processor chain. {pull}12600[12600]
- Add additional nil pointer checks to Docker client code to deal with vSphere Integrated Containers {pull}12628[12628]
- Fix Central Management enroll under Windows {issue}12797[12797] {pull}12799[12799]

*Auditbeat*

Expand Down
8 changes: 7 additions & 1 deletion x-pack/libbeat/management/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ func Enroll(

ts := time.Now()

// This timestamp format is a variation of RFC3339 replacing colons with
// slashes so that it can be used as part of a filename in all OSes.
// (Colon is not a valid character for filenames in Windows).
// Also removed the TZ-offset as that can cause a plus sign to be output.
const fsSafeTimestamp = "2006-01-02T15-04-05"

// backup current settings:
backConfigFile := configFile + "." + ts.Format(time.RFC3339) + ".bak"
backConfigFile := configFile + "." + ts.Format(fsSafeTimestamp) + ".bak"
fmt.Println("Saving a copy of current settings to " + backConfigFile)
err = file.SafeFileRotate(backConfigFile, configFile)
if err != nil {
Expand Down