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

Add fuzziness to knife ssh queries #3536

Closed
wants to merge 1 commit into from

Conversation

patcon
Copy link
Contributor

@patcon patcon commented Jun 15, 2015

PR for #3526.

@@ -204,6 +207,12 @@ def search_nodes
list
end

def fuzzify_query
if @query !~ /:/
@query = "tags:*#{@query}* OR roles:*#{@query}* OR fqdn:*#{@query}* OR addresses:*#{@query}*"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be "weaker"? Possibilities:

  1. Remove asterisks for both sides.
  2. fqdn only? (would seem to align with expectation of using ssh)
  3. Keep as is, but have a confirmation prompt for what fqdn we're running on. (Can be explicitly skipped with --yes flag.)

cc: @lamont-granquist

Copy link
Contributor

Choose a reason for hiding this comment

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

It needs to be the same as knife search node.

@sawanoboly
Copy link
Contributor

👍

@patcon
Copy link
Contributor Author

patcon commented Jun 18, 2015

Also, my ruby force is weak here -- any suggestions on how I could pull #fuzzify_query from lib/chef/knife/search to be more DRY? (this is where you all probably judge me :)

@patcon
Copy link
Contributor Author

patcon commented Jun 18, 2015

Also, went searching for tests that cover this part, but doesn't seem we test this level, so given that I'm not comfortable enough with starting my own test approach from scratch, I think this is just waiting on feedback on the above, then it's good to merge as far as I'm aware.

@lamont-granquist
Copy link
Contributor

So, what I'd really like to see is knife ssh and knife search node share exactly the same code and call the same method that does fuzziness. Eliminate code duplication and eliminate the chances that we patch in one place and not the other.

@lamont-granquist
Copy link
Contributor

We can't merge this without considering the problem holistically, so 👎 for now.

@coderanger
Copy link
Contributor

Agree, and for the future the Manage code has a similar fuzzifier and should make sure that uses the same algo.

@patcon
Copy link
Contributor Author

patcon commented Sep 9, 2015

Totally fair. Closing for now, since the other issue is open

@patcon patcon closed this Sep 9, 2015
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants