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

Update stale references to _xpack to refer to _license instead #18030

Merged
merged 2 commits into from
Apr 28, 2020
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 @@ -77,6 +77,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Do not rotate log files on startup when interval is configured and rotateonstartup is disabled. {pull}17613[17613]
- Fix goroutine leak and Elasticsearch output file descriptor leak when output reloading is in use. {issue}10491[10491] {pull}17381[17381]
- Fix `setup.dashboards.index` setting not working. {pull}17749[17749]
- Fix Elasticsearch license endpoint URL referenced in error message. {issue}17880[17880] {pull}18030[18030]

*Auditbeat*

Expand Down
12 changes: 6 additions & 6 deletions x-pack/libbeat/licenser/elastic_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/elastic/beats/v7/libbeat/logp"
)

const xPackURL = "/_license"
const licenseURL = "/_license"

// params defaults query parameters to send to the '_xpack' endpoint by default we only need
// params defaults query parameters to send to the '_license' endpoint by default we only need
// machine parseable data.
var params = map[string]string{
"human": "false",
Expand Down Expand Up @@ -88,12 +88,12 @@ func NewElasticFetcher(client esclient) *ElasticFetcher {
return &ElasticFetcher{client: client, log: logp.NewLogger("elasticfetcher")}
}

// Fetch retrieves the license information from an Elasticsearch Client, it will call the `_xpack`
// end point and will return a parsed license. If the `_xpack` endpoint is unreacheable we will
// Fetch retrieves the license information from an Elasticsearch Client, it will call the `_license`
// endpoint and will return a parsed license. If the `_license` endpoint is unreacheable we will
// return the OSS License otherwise we return an error.
func (f *ElasticFetcher) Fetch() (*License, error) {
status, body, err := f.client.Request("GET", xPackURL, "", params, nil)
// When we are running an OSS release of elasticsearch the _xpack endpoint will return a 405,
status, body, err := f.client.Request("GET", licenseURL, "", params, nil)
// When we are running an OSS release of elasticsearch the _license endpoint will return a 405,
// "Method Not Allowed", so we return the default OSS license.
if status == http.StatusBadRequest {
f.log.Debug("Received 'Bad request' (400) response from server, fallback to OSS license")
Expand Down
2 changes: 1 addition & 1 deletion x-pack/libbeat/licenser/es_callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Enforce(name string, checks ...CheckFunc) {
license, err := fetcher.Fetch()

if err != nil {
return errors.Wrapf(err, "cannot retrieve the elasticsearch license from the /_xpack endpoint, "+
return errors.Wrapf(err, "cannot retrieve the elasticsearch license from the /_license endpoint, "+
"%s requires the default distribution of Elasticsearch. Please make the endpoint accessible "+
"to %s so it can verify the license.", name, name)
}
Expand Down