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

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

Merged
merged 1 commit into from
Dec 27, 2019

Conversation

jsteenb2
Copy link
Contributor

@jsteenb2 jsteenb2 commented Dec 27, 2019

Closes #16342

Right now we have this duality of making the name/offset/every stuffs both inside the flux query and as siblings on the influxdb.Task type. For pgker, it needs just the query and not the hand jammed option task stuffs, b/c of the brittleness of the current Task API. This makes the initial regex no longer greedy, it was capturing too much. The regex playground below is useful if you want to test drive some more stuffs at it:

regex playground for this fix: https://regex101.com/r/xV9wL4/30

@@ -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)*?}`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to make this not greedy

regex plagyround: https://regex101.com/r/xV9wL4/30

@jsteenb2 jsteenb2 requested a review from a team December 27, 2019 22:48
@jsteenb2 jsteenb2 merged commit 0dc5c2a into master Dec 27, 2019
@jsteenb2 jsteenb2 deleted the 16342/pkger_tasks_cleanup branch December 27, 2019 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pkger tasks model fixing
2 participants