Feature #21635
closedExtensible commands in hammer
Description
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.:
HammerCLIForeman::Host::InfoCommand.extend(ComputeAttributesExtension.new)
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.
execute_extensions(:help, parameters)
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.
Updated by Tomáš Strachota about 7 years ago
- Related to Feature #21633: Allow modification of additional help texts added
Updated by Tomáš Strachota about 7 years ago
- Related to Feature #21634: Allow modification of output fields added
Updated by Oleh Fedorenko almost 7 years ago
- Status changed from New to Assigned
- Assignee set to Oleh Fedorenko
Updated by Shira Maximov over 6 years ago
- Related to Feature #24655: Include details about the required options in the help text added
Updated by The Foreman Bot about 6 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/hammer-cli/pull/291 added
Updated by Oleh Fedorenko over 5 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 107a5124499653d5b6e3a7d269a511425bce612e.
Updated by Martin Bacovsky over 5 years ago
- Fixed in Releases hammer-cli-0.17.0 added