Skip to content

Commit

Permalink
Add new licence status: expired (#22180) (#22184)
Browse files Browse the repository at this point in the history
This PR adds a new licence state named `Expired`. Previously, this prevented Beats from connecting to ES.

Beats were not able to parse expired licences. This problem prevented users from using the features of the software which does not require a licence.

Closes #21112

(cherry picked from commit f0da681)
  • Loading branch information
kvch authored Oct 27, 2020
1 parent d99bbd8 commit 6afa66e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ field. You can revert this change by configuring tags for the module and omittin
- Fix `libbeat.output.write.bytes` and `libbeat.output.read.bytes` metrics of the Elasticsearch output. {issue}20752[20752] {pull}21197[21197]
- The `o365input` and `o365` module now recover from an authentication problem or other fatal errors, instead of terminating. {pull}21258[21258]
- Orderly close processors when processing pipelines are not needed anymore to release their resources. {pull}16349[16349]
- Fix parsing of expired licences. {issue}21112[21112] {pull}22180[22180]

*Auditbeat*

Expand Down
5 changes: 5 additions & 0 deletions x-pack/libbeat/licenser/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ func (l *License) IsActive() bool {
return l.Status == Active
}

// IsExpired returns true if the licence has expired.
func (l *License) IsExpired() bool {
return l.Status == Expired
}

// IsTrial returns true if the remote cluster is in trial mode.
func (l *License) IsTrial() bool {
return l.Type == Trial
Expand Down
5 changes: 5 additions & 0 deletions x-pack/libbeat/licenser/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ func TestIsActive(t *testing.T) {
l: License{Status: Inactive},
expected: false,
},
{
name: "expired",
l: License{Status: Expired},
expected: false,
},
}

for _, test := range tests {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"build": {
"hash": "053779d",
"date": "2018-07-20T05:25:16.206115Z"
},
"license": {
"uid": "hello-license",
"type": "platinum",
"mode": "platinum",
"status": "expired",
"expiry_date_in_millis": 1588261199999
}
}
2 changes: 2 additions & 0 deletions x-pack/libbeat/licenser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ type State int
const (
Inactive State = iota
Active
Expired
)

var stateLookup = map[string]State{
"inactive": Inactive,
"active": Active,
"expired": Expired,
}

var licenseLookup = map[string]LicenseType{
Expand Down

0 comments on commit 6afa66e

Please sign in to comment.