Skip to content

[Agent] Allow CLI paths override#17781

Merged
michalpristas merged 11 commits intoelastic:masterfrom
michalpristas:agent-override-e
Apr 28, 2020
Merged

[Agent] Allow CLI paths override#17781
michalpristas merged 11 commits intoelastic:masterfrom
michalpristas:agent-override-e

Conversation

@michalpristas
Copy link
Copy Markdown
Contributor

@michalpristas michalpristas commented Apr 17, 2020

What does this PR do?

Allowing override of configuration using -E flag of two specific cases --path.data --path.home

Why is it important?

Allows having data (download, install) outside of agent directory without manually changing configuration file

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ingest-management (Project:fleet)

@michalpristas michalpristas changed the title Agent override e [Agent] Allow CLI paths override Apr 17, 2020
@michalpristas
Copy link
Copy Markdown
Contributor Author

not ready for review, libbeat is bugging me with global use of flags

@ph ph marked this pull request as draft April 17, 2020 12:58
@michalpristas michalpristas marked this pull request as ready for review April 17, 2020 14:18
Copy link
Copy Markdown
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

Changes for Data and home looks good to me but I don't think we have support for -E?

dataPath = retrieveDataPath()
overwrites = common.SettingFlag(nil, "E", "Configuration overwrite")
common.ConfigOverwriteFlag(nil, overwrites, "path.home", "path.home", "", "Agent root path")
common.ConfigOverwriteFlag(nil, overwrites, "path.data", "path.data", "", "Data path, agent usually look for beats here")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename Data path, agent usually look for beats here to Data path contains Agent managed binary")


flags := &globalFlags{}

cmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("E"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see code to make this work?

@ph
Copy link
Copy Markdown
Contributor

ph commented Apr 24, 2020

@michalpristas for -E lets make it a followup issue, Is there anything that could prevent us to support it ?

@ph
Copy link
Copy Markdown
Contributor

ph commented Apr 24, 2020

@michalpristas I have testes this locally with --path.config and this doesn't appear to work it cannot find the configuration?

Copy link
Copy Markdown
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

LGTM, can you create an issue to make sure the fleet.yml and the action_store respect theses path?

@michalpristas
Copy link
Copy Markdown
Contributor Author

Linked #17967

@michalpristas michalpristas merged commit 0df53d3 into elastic:master Apr 28, 2020
v1v added a commit to v1v/beats that referenced this pull request Apr 28, 2020
…unbld

* upstream/master:
  ci: comment PRs with the build status (elastic#17971)
  Add domain state metricset to kvm module (elastic#17673)
  [Agent] Allow CLI paths override (elastic#17781)
  Fix generated metricbeat so create-metricset works. (elastic#18020)
  LIBBEAT: Enhancement replace_string processor for replacing strings values of fields. (elastic#17342)
  Update stale references to _xpack to refer to _license instead (elastic#18030)
  Review dependency patterns collection in Jenkins (elastic#18004)
michalpristas added a commit to michalpristas/beats that referenced this pull request May 4, 2020
Copy link
Copy Markdown
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

LGTM

michalpristas added a commit that referenced this pull request May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants