Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/feature-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ The following properties are defined:
* `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`).
If `roles/foreman/tasks/feature/{{ foreman_proxy_plugin }}.yaml` exists, it will be executed to perform any plugin-specific setup.
* `role` (_String_): The name of the Ansible role to be executed if the feature is not implemented as a Foreman Proxy plugin.
* `hammer` (_String_): The name of the Hammer plugin to be enabled.
* **FIXME**: Not implemented, right now we use the same list as Foreman plugins, but needs modification for foreman-tasks and friends
* `hammer` (_String_): The name of the Hammer plugin to be enabled (the package installed will be `hammer-cli-plugin-{{ hammer }}`).
* `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`.

Properties can be omitted.
Expand Down
4 changes: 4 additions & 0 deletions src/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ katello:
description: Content and Subscription Management plugin for Foreman
foreman:
plugin_name: katello
hammer: katello
google:
description: Google Compute Engine plugin for Foreman
hammer: foreman_google
foreman:
plugin_name: foreman_google
azure-rm:
description: Azure Resource Manager plugin for Foreman
hammer: foreman_azure_rm
foreman:
plugin_name: foreman_azure_rm
remote-execution:
Expand All @@ -23,6 +26,7 @@ remote-execution:
plugin_name: foreman_remote_execution
foreman_proxy:
plugin_name: remote_execution_ssh
hammer: foreman_remote_execution
dependencies:
- dynflow
dynflow:
Expand Down
7 changes: 7 additions & 0 deletions src/filter_plugins/foremanctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def invalid_features(features):
"""Return a list of unknown features not defined in features.yaml."""
return [feature for feature in features if feature not in FEATURE_MAP]

def hammer_plugins(value):
dependencies = list(get_dependencies(filter_features(value)))
plugins = [FEATURE_MAP.get(feature, {}).get('hammer') for feature in filter_features(value + dependencies)]
return compact_list(plugins)


def foreman_proxy_plugins(value):
dependencies = list(get_dependencies(filter_features(value)))
plugins = [FEATURE_MAP.get(feature, {}).get('foreman_proxy', {}).get('plugin_name') for feature in filter_features(value + dependencies)]
Expand All @@ -95,6 +101,7 @@ def filters(self):
return {
'features_to_foreman_plugins': foreman_plugins,
'available_foreman_plugins': available_foreman_plugins,
'features_to_hammer_plugins': hammer_plugins,
'features_to_foreman_proxy_plugins': foreman_proxy_plugins,
'available_foreman_proxy_plugins': available_foreman_proxy_plugins,
'list_all_features': list_all_features,
Expand Down
2 changes: 1 addition & 1 deletion src/vars/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ pulp_pulp_url: "https://{{ ansible_facts['fqdn'] }}"
pulp_plugins: "{{ enabled_features | select('contains', 'content/') | map('replace', 'content/', 'pulp_') | list }}"

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

foreman_proxy_plugins: "{{ enabled_features | features_to_foreman_proxy_plugins }}"