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

Allow to configure enabled query endpoints #477

Merged
merged 1 commit into from
May 28, 2019

Conversation

volans-
Copy link
Contributor

@volans- volans- commented Jul 18, 2018

Allow to configure which PuppetDB endpoints are allowed in the /query
page, adding the ENABLED_QUERY_ENDPOINTS configuration variable, that
if set restricts the allowed endpoints to query. If not set the previous
behaviour is kept, allowing all PuppetDB endpoints to be queried, if the
ENABLE_QUERY configuration is True.

Closes: #475

@coveralls
Copy link

coveralls commented Jul 18, 2018

Coverage Status

Coverage decreased (-0.2%) to 81.658% when pulling 5aed355 on volans-:query into 9e6aea5 on voxpupuli:master.

@volans-
Copy link
Contributor Author

volans- commented Apr 15, 2019

@alexjfisher Hi, so nice to see some activity in Puppetboard, thanks a lot!
I was wondering if this PR could be evaluated and, in that case, before rebasing and resolving the conflicts, I'd like to know if I should drop the Python 2.6 fix present in the second commit given that 2.6 was dropped from the test matrix.

@volans- volans- mentioned this pull request May 25, 2019
Allow to configure which PuppetDB endpoints are allowed in the /query
page, adding the ENABLED_QUERY_ENDPOINTS configuration variable, that
if set restricts the allowed endpoints to query. If not set the previous
behaviour is kept, allowing all PuppetDB endpoints to be queried, if the
ENABLE_QUERY configuration is True.

Closes: voxpupuli#475
@volans-
Copy link
Contributor Author

volans- commented May 27, 2019

I've rebased the branch to the current HEAD of master resolving the conflicts (was just he README migration from rst to md format).
I've also took the liberty to remove the second commit that was fixing the compatibility with Python 2.6 given that its support was dropped in the meanwhile.
Already squashed in a single commit, ready for final review.

Copy link
Contributor

@runejuhl runejuhl left a comment

Choose a reason for hiding this comment

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

👍 LGTM -- just a single comment 😄


if form.endpoints.data == 'pql':
query = form.query.data
elif form.query.data[0] == '[':
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this perhaps be form.query.data.strip[0] instead to correctly handle a query with a leading newline/space? I imagine that could happen pretty easily with a textarea field and copy-paste.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@runejuhl thanks for the review. This was pre-existing code (see line 771 on current code), but I'm happy pass it through strip() if there is an agreement.

Copy link
Contributor

Choose a reason for hiding this comment

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

/me toggles the unified diff setting

Sorry about that, you're right of course.

Copy link
Member

Choose a reason for hiding this comment

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

I think this can stay as it is. But another PR that makes the existing code more beautiful is always highly appreciated.

Copy link
Contributor

@runejuhl runejuhl left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bastelfreak bastelfreak merged commit 7782646 into voxpupuli:master May 28, 2019
@alexjfisher
Copy link
Member

@volans- Thanks for the PR!
@runejuhl Thanks for the review!

@alexjfisher
Copy link
Member

oh and @bastelfreak, thanks for merging and sorting out all the travis related stuff over the weekend! :)

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.

Allow to configure which PuppetDB endpoints are allowed in the /query page
5 participants