Skip to content

Commit

Permalink
feat(pkger): fixup flux query normalization in exporting of task
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteenb2 committed Dec 27, 2019
1 parent f1b5e19 commit 0e4031d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions pkger/clone_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 0e4031d

Please sign in to comment.