Extensible commands in hammer
Hammer doesn't provide any interface for extending commands. Currently all the extensions are done via including module, which is a dirty solution witout any clear boundaries.
There are several usecases already where hammer commands need to be dynamically extended:
- adding options and fields to host commands from katello
- adding per-provider fields in compute-resource info command
- adding help for per-provider options in host update and create
There are also some features not implemented yet that could take advantage of extension system in future:
- adding per-provider fields to compute profile commands
- adding extensions to ping command from plugins
All these cases could be refactorred to use a single extension solution that would make the implementation more flexible.
Extensions need to be able to modify the following:
- add options to commands
- extend data from server responses before it's printed
- extend and modify additional texts in help
- modify parameters of api requests
- modify output fields
The interface for extending should accept instances of extensions. E.g.:
Since some of the extension points are in hammer-cli and some in hammer-cli-foreman and there's potential for other plugins to add extension points in future, hammer should provide a helper function for invoking the extensions. E.g.
In the first phase it's fine to limit extension of options, help and print fields to allow only addition.
Full modification in this cases can be implemented later as it requires additional changes in hammer core.
#1 Updated by Tomáš Strachota over 5 years ago
- Related to Feature #21633: Allow modification of additional help texts added
#2 Updated by Tomáš Strachota over 5 years ago
- Related to Feature #21634: Allow modification of output fields added
#3 Updated by Oleh Fedorenko about 5 years ago
- Assignee set to Oleh Fedorenko
- Status changed from New to Assigned
#4 Updated by Shira Maximov over 4 years ago
- Related to Feature #24655: Include details about the required options in the help text added
#5 Updated by The Foreman Bot over 4 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/hammer-cli/pull/291 added
#6 Updated by Oleh Fedorenko almost 4 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 107a5124499653d5b6e3a7d269a511425bce612e.
#7 Updated by Martin Bacovsky over 3 years ago
- Fixed in Releases hammer-cli-0.17.0 added
Fixes #21635 - Extensible commands in hammer