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

enhancement: configuration search #698

Open
sjvudp opened this issue Dec 17, 2020 · 3 comments
Open

enhancement: configuration search #698

sjvudp opened this issue Dec 17, 2020 · 3 comments

Comments

@sjvudp
Copy link

sjvudp commented Dec 17, 2020

In crm shell configure context you can

  • edit items specifying their name or a pattern that occurs in the resource name
  • show items specifying their name or a pattern that occurs in the resource name

Given a highly consistent naming pattern for resources that would be fine to easily select related resources that way.
However the real world is not perfect and sometimes one wants to select resources containing some (more or less) magic string.

Therefore I suggest an enhancement that will allow matching not only based on the resource name, but also on the resource content. While I don't want to propose a specific syntax really, I'm sketching how it could be done:

"crm(...) configure# grep pattern" could list the names of all resources where either the name matches pattern, or where the text representation matches pattern (a possible extension might be "grep xml pattern" where the XML would be considered instead).

To combine such search result with commands easily, a set of additional commands can be imagined:

  • "show [all] matching pattern": Display all resources matching (as described above) pattern. The xml extension would be possible, too (match XML and display XML)
  • "edit [all] matching pattern": Edit all resources (in a single editor) matching pattern (as described above). The xml extension would be possible, too (match XML and display XML)
  • "delete [all] matching pattern": Deleting all resources matching pattern (as described above) is probably a bad idea (thinking of order and colocation (among others))
  • filter [all] matching pattern": ...restrict resources fed into filter...
  • ... (possibly more)

(all is just some syntactic fill-word ("sugar") with no change in semantics, meaning it does not "match everything")

@sjvudp
Copy link
Author

sjvudp commented Dec 17, 2020

Another thinkable option would be combining the restriction changed with the new feature, so that the searching would be restricted to any items that were changed (directly or indirectly through dependencies). Unsure about the syntax. A new keyword matching-changed (matchingchanged)?

@liangxin1300
Copy link
Collaborator

Thanks for the suggestions!

@zzhou1
Copy link
Contributor

zzhou1 commented Dec 18, 2020

Yeah, I like crm configure show related:*foo* related:*bar*. But, it stays within "the resource name" makes the usage limited. Example, I may want to show all resources based on ocf:hearbeat:Filesystem.

I hesitate to add yet another subcommand crm configure grep, since the subcommand list under crm configure is pretty long already. With that, I incline to improve the subcommands like "show | edit | delete ..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants