Skip to content

Commit c19685d

Browse files
author
Arvind Jangir
committed
List enabled features only when passed --list-enabled
1 parent a8d918d commit c19685d

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/filter_plugins/foremanctl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def available_foreman_plugins(_value):
5555
plugins = [FEATURE_MAP.get(feature).get('foreman', {}).get('plugin_name') for feature in FEATURE_MAP.keys()]
5656
return compact_list(plugins)
5757

58-
def list_all_features(enabled_features):
58+
def list_all_features(enabled_features, only_enabled=False):
5959
enabled_list = []
6060
available_list = []
6161
for name, meta in FEATURE_MAP.items():
@@ -64,7 +64,7 @@ def list_all_features(enabled_features):
6464
description = meta.get('description', '')
6565
if name in enabled_features:
6666
enabled_list.append((name, 'enabled', description))
67-
else:
67+
elif not only_enabled:
6868
available_list.append((name, 'available', description))
6969

7070
output = [f"{'FEATURE':<25} {'STATE':<12} DESCRIPTION"]

src/playbooks/features/features.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
gather_facts: false
55
tags:
66
- foremanctl_suppress_default_output
7+
vars:
8+
list_enabled: false
79
vars_files:
810
- "../../vars/defaults.yml"
911
- "../../vars/flavors/{{ flavor }}.yml"
1012
- "../../vars/base.yaml"
1113
tasks:
1214
- name: Print features
1315
ansible.builtin.debug:
14-
msg: "{{ enabled_features | list_all_features }}"
16+
msg: "{{ enabled_features | list_all_features(list_enabled) }}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
---
22
help: List all enabled and available features
3+
4+
variables:
5+
list_enabled:
6+
parameter: --list-enabled
7+
help: List only enabled features
8+
action: store_true
9+
persist: false

0 commit comments

Comments
 (0)