Skip to content
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

Allow a keystore to be send with functionbeat files #10263

Merged
merged 9 commits into from
Jan 31, 2019

Conversation

ph
Copy link
Contributor

@ph ph commented Jan 22, 2019

Add a new interface in the keystore package named Packager, this allow a
keystore to return the raw bytes of the keys and values store in it.

This is used with core.MakeZip() to create the package that will be send
to the lambda function.

Fixes: #9009

@ph ph added bug needs_backport PR is waiting to be backported to other branches. Functionbeat labels Jan 22, 2019
@ph ph requested a review from kvch January 22, 2019 20:41
@ph ph requested a review from a team as a code owner January 22, 2019 20:41

content, err := bundle.Bytes()
if err != nil {
return nil, err
}
return content, nil
}

func keystoreRaw() ([]byte, error) {
Copy link
Contributor Author

@ph ph Jan 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've wanted to decouple the starting from the reading the keystore otherwise it would require a lot of jumps to receive that information.

The more I think about it, we might need one a single global with current beat information.

defaultPathConfig, _ := cfg.String("path.config", -1)
defaultPathConfig = filepath.Join(defaultPathConfig, fmt.Sprintf("%s.keystore", b.Info.Beat))
store, err := keystore.Factory(keystoreCfg, defaultPathConfig)
store, err := LoadKeystore(cfg, b.Info.Beat)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are returning the same error message from LoadKeystore and from configuration function if LoadKeystore fails. Please either provide different messages or remove one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch.

@ph ph removed the bug label Jan 23, 2019
@ph
Copy link
Contributor Author

ph commented Jan 23, 2019

@kvch I am wrapping the error message in the MakeZip(), I have also added a missing changelog.

@kvch
Copy link
Contributor

kvch commented Jan 24, 2019

I still see the duplicate error message "could not initialize the keystore" in the diff. Is that intentional?

@ph ph force-pushed the feature/package-keystore-functionbeat branch from 287bf6c to d022fb2 Compare January 25, 2019 15:44
@ph
Copy link
Contributor Author

ph commented Jan 25, 2019

🤦‍♂️ I've just modified the LoadKeystore to just return the error and error will be wrap where it was invoked.

@ph
Copy link
Contributor Author

ph commented Jan 29, 2019

@kvch Can I get the approve on this?

@ph ph requested a review from urso January 29, 2019 17:22
Add a new interface in the keystore package named Packager, this allow a
keystore to return the raw bytes of the keys and values store in it.

This is used with core.MakeZip() to create the package that will be send
to the lambda function.

Fixes: elastic#9009
@ph ph force-pushed the feature/package-keystore-functionbeat branch from 57b16f1 to c9b9cef Compare January 30, 2019 16:49
@ph
Copy link
Contributor Author

ph commented Jan 30, 2019

@urso I have fixed the issue on my side and rebased this PR.

CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
@ph ph added the review label Jan 31, 2019
@ph ph merged commit db8a647 into elastic:master Jan 31, 2019
ph added a commit to ph/beats that referenced this pull request Feb 4, 2019
* Allow a keystore to be send with functionbeat files

Add a new interface in the keystore package named Packager, this allow a
keystore to return the raw bytes of the keys and values store in it.

This is used with core.MakeZip() to create the package that will be send
to the lambda function.

Fixes: elastic#9009

(cherry picked from commit db8a647)
@ph ph added v6.7.0 and removed needs_backport PR is waiting to be backported to other branches. labels Feb 4, 2019
ph added a commit that referenced this pull request Feb 5, 2019
* Allow a keystore to be send with functionbeat files

Add a new interface in the keystore package named Packager, this allow a
keystore to return the raw bytes of the keys and values store in it.

This is used with core.MakeZip() to create the package that will be send
to the lambda function.

Fixes: #9009

(cherry picked from commit db8a647)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants