Skip to content

Commit 5efa47a

Browse files
ehelmsevgeni
authored andcommitted
Implement hammer feature metadata
1 parent 65ed4e1 commit 5efa47a

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

docs/feature-metadata.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ The following properties are defined:
2929
* `plugin_name` (_String_): The name of the Foreman Proxy plugin to be enabled (by deploying `roles/foreman_proxy/templates/settings.d/{{ foreman_proxy_plugin }}.yml.j2` to `/etc/foreman-proxy/settings.d`).
3030
If `roles/foreman/tasks/feature/{{ foreman_proxy_plugin }}.yaml` exists, it will be executed to perform any plugin-specific setup.
3131
* `role` (_String_): The name of the Ansible role to be executed if the feature is not implemented as a Foreman Proxy plugin.
32-
* `hammer` (_String_): The name of the Hammer plugin to be enabled.
33-
* **FIXME**: Not implemented, right now we use the same list as Foreman plugins, but needs modification for foreman-tasks and friends
32+
* `hammer` (_String_): The name of the Hammer plugin to be enabled (the package installed will be `hammer-cli-plugin-{{ hammer }}`).
3433
* `dependencies` (_Array_ of _String_): List of features that are automatically enabled when the user requests this feature. Usually will point at features with `internal: true`.
3534

3635
Properties can be omitted.

src/features.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ katello:
99
description: Content and Subscription Management plugin for Foreman
1010
foreman:
1111
plugin_name: katello
12+
hammer: katello
1213
google:
1314
description: Google Compute Engine plugin for Foreman
15+
hammer: foreman_google
1416
foreman:
1517
plugin_name: foreman_google
1618
azure-rm:
1719
description: Azure Resource Manager plugin for Foreman
20+
hammer: foreman_azure_rm
1821
foreman:
1922
plugin_name: foreman_azure_rm
2023
remote-execution:
@@ -23,6 +26,7 @@ remote-execution:
2326
plugin_name: foreman_remote_execution
2427
foreman_proxy:
2528
plugin_name: remote_execution_ssh
29+
hammer: foreman_remote_execution
2630
dependencies:
2731
- dynflow
2832
dynflow:

src/filter_plugins/foremanctl.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ def invalid_features(features):
7777
"""Return a list of unknown features not defined in features.yaml."""
7878
return [feature for feature in features if feature not in FEATURE_MAP]
7979

80+
def hammer_plugins(value):
81+
dependencies = list(get_dependencies(filter_features(value)))
82+
plugins = [FEATURE_MAP.get(feature, {}).get('hammer') for feature in filter_features(value + dependencies)]
83+
return compact_list(plugins)
84+
85+
8086
def foreman_proxy_plugins(value):
8187
dependencies = list(get_dependencies(filter_features(value)))
8288
plugins = [FEATURE_MAP.get(feature, {}).get('foreman_proxy', {}).get('plugin_name') for feature in filter_features(value + dependencies)]
@@ -95,6 +101,7 @@ def filters(self):
95101
return {
96102
'features_to_foreman_plugins': foreman_plugins,
97103
'available_foreman_plugins': available_foreman_plugins,
104+
'features_to_hammer_plugins': hammer_plugins,
98105
'features_to_foreman_proxy_plugins': foreman_proxy_plugins,
99106
'available_foreman_proxy_plugins': available_foreman_proxy_plugins,
100107
'list_all_features': list_all_features,

src/vars/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ pulp_pulp_url: "https://{{ ansible_facts['fqdn'] }}"
3131
pulp_plugins: "{{ enabled_features | select('contains', 'content/') | map('replace', 'content/', 'pulp_') | list }}"
3232

3333
hammer_ca_certificate: "{{ server_ca_certificate }}"
34-
hammer_plugins: "{{ foreman_plugins | map('replace', 'foreman-tasks', 'foreman_tasks') | list }}"
34+
hammer_plugins: "{{ enabled_features | features_to_hammer_plugins }}"
3535

3636
foreman_proxy_plugins: "{{ enabled_features | features_to_foreman_proxy_plugins }}"

0 commit comments

Comments
 (0)