feat(pkger): fixup flux query normalization in exporting of task

pull/16349/head
Johnny Steenbergen 2019-12-27 14:41:00 -08:00 committed by Johnny Steenbergen
parent f1b5e19776
commit 0dc5c2af92
2 changed files with 3 additions and 6 deletions

View File

@ -32,6 +32,7 @@
1. [16249](https://github.com/influxdata/influxdb/pull/16249): Prevent potential infinite loop when finding tasks by organization.
1. [16255](https://github.com/influxdata/influxdb/pull/16255): Retain user input when parsing invalid JSON during import
1. [16268](https://github.com/influxdata/influxdb/pull/16268): Fixed test flakiness that stemmed from multiple flush/signins being called in the same test suite
1. [16346](https://github.com/influxdata/influxdb/pull/16346): Update pkger task export to only trim out option task and not all vars provided
### UI Improvements

View File

@ -502,18 +502,14 @@ func ruleToResource(iRule influxdb.NotificationRule, endpointName, name string)
}
// regex used to rip out the hard coded task option stuffs
var taskFluxRegex = regexp.MustCompile(`option task = {(.|\n)*}`)
var taskFluxRegex = regexp.MustCompile(`option task = {(.|\n)*?}`)
func taskToResource(t influxdb.Task, name string) Resource {
if name == "" {
name = t.Name
}
var query = t.Flux
groups := taskFluxRegex.Split(t.Flux, 2)
if len(groups) > 1 {
query = strings.TrimSpace(groups[1])
}
query := strings.TrimSpace(taskFluxRegex.ReplaceAllString(t.Flux, ""))
r := Resource{
fieldKind: KindTask.title(),