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

Cherry-pick #22180 to 7.10: Add new licence status: expired #22184

Merged
merged 1 commit into from
Oct 27, 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 @@ -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