List enabled and available features#404
List enabled and available features#404arvind4501 wants to merge 4 commits intotheforeman:masterfrom
Conversation
|
Currently This Does not list the BASE features which are hammer, foreman-proxy, foreman |
|
Is there any to make use of In the results, what does the |
|
Colors can sometimes be a pain, this would enforce colors even if Ansible is configured with no colors. I think we either should skip colors or be consistent with Ansible's configuration. |
I was not much aware about available callback plugins, but now that you mentioned it, i see that there are builtin plugins which i tried and they does not give our expected output format(if i did not missed anything), we might need to create a custom plugin for that but not sure if we should? My thought here was that what if i need a custom script to run at some point from foremanctl and i did not find a way to do so, and that made me do theforeman/obsah#105,
This was taken from https://github.com/theforeman/foremanctl/blob/master/src/filter_plugins/foremanctl.py#L7 , where we define |
I agree, colors should be consistent, thanks |
I am not sure this column of information is useful to the user, and we can omit it in the output. |
stejskalleos
left a comment
There was a problem hiding this comment.
🍏 LGTM
Tested together with the theforeman/obsah#105
Before installation:
./foremanctl features
FEATURE STATE DESCRIPTION
katello enabled Content and Subscription Management plugin for Foreman
azure_rm available Azure Resource Manager plugin for Foreman
google available Google Compute Engine plugin for Foreman
After installation
./foremanctl deploy --add-feature azure_rm --add-feature google
./foremanctl features
FEATURE STATE DESCRIPTION
azure_rm enabled Azure Resource Manager plugin for Foreman
google enabled Google Compute Engine plugin for Foreman
katello enabled Content and Subscription Management plugin for Foreman
3 features listed (3 enabled, 0 available).
|
I like the output a lot, but I totally dislike it's a standalone script 🙈 |
| params_yaml = STATE_DIR / "parameters.yaml" | ||
| params = load_yaml(params_yaml) | ||
|
|
||
| flavor = params.get('flavor', 'katello') |
There was a problem hiding this comment.
I am hesitant to have a default flavor.
There was a problem hiding this comment.
sure, i can omit that
| features_yaml = BASE_DIR / "features.yaml" | ||
| all_features = load_yaml(features_yaml) | ||
|
|
||
| # Load persisted parameters |
There was a problem hiding this comment.
Some of the comments in the file I'd avoid. The code speaks for itself and the comment becomes noise.
|
I'd be interested in seeing a contrasting implementation of this that follow the paradigms of the current design. That is, using Ansible to collect and output the list of features. Perhaps just something simple that uses the |
yes @evgeni, i just wanted that there is a way to run scripts via foremanctl rather than playbook, if there are some other use cases for it. |
I can see that there is a way for callback plugins to hook into ansible's lifecycle events and change default output behavior, so maybe we are going towards callback plugins(stdout callback plugins). |
|
With 0ee3f43 and theforeman/obsah#107 to set stdout callback for a playbook) , we have now moved from running direct script to run ansible stdout callback plugin to change how the output of a command/playbook is displayed. This is more cleaner and does not by pass running playbook, it hooks into the ansible output event and customize the display. |
|
An alternative can be seen in #408 where I wrote a custom callback, that strips all fancy output if the playbook is |
|
Personally I like the implementation from @evgeni as filter and callback much more than a standalone script. Feels much more native and suited for other usages. |
This implemets listing of available and enabled features, with old
foreman-installerthere was no good way to list all availabe features then doingforeman-installer --full-helpwhich comes up with lot of puppet module args listed.Here we have
features.ymlas source of truth for features listing. I did not like how ansible playbook outputs directly for listing features(it creates a lot of noise), i want it to be likesystemctlso i have created a PR in obsah which allows bypassing ansible playbook execution and runs scripts directly(a hack to get nice output, maybe can be better).This is how it will show the result
This PR lays out my initial thought of solving features listing.
It requires: PR