Skip to content
Draft
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
1 change: 1 addition & 0 deletions development/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ host_key_checking = False
stdout_callback=debug
stderr_callback=debug
roles_path = ./roles:../src/roles
filter_plugins = ./filter_plugins:../src/filter_plugins
display_skipped_hosts = no
174 changes: 174 additions & 0 deletions development/features.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
katello:
development:
foreman:
github_repo: Katello/katello
settings_template: katello.yaml.j2
extra_gemfiles:
- gemfile.d/test.rb
hammer:
gem: hammer_cli_katello
github_repo: Katello/hammer-cli-katello
module_config: katello.yml

dynflow:
development:
foreman_proxy:
github_repo: theforeman/smart_proxy_dynflow
module_config: dynflow.yml

remote-execution:
development:
foreman:
github_repo: theforeman/foreman_remote_execution
hammer:
github_repo: theforeman/hammer_cli_foreman_remote_execution
module_config: foreman_remote_execution.yml
foreman_proxy:
github_repo: theforeman/smart_proxy_remote_execution_ssh
module_config: remote_execution_ssh.yml

ansible:
development:
foreman:
github_repo: theforeman/foreman_ansible
settings_template: foreman_ansible.yaml.j2
hammer:
gem: hammer_cli_foreman_ansible
github_repo: theforeman/hammer-cli-foreman-ansible
module_config: foreman_ansible.yml
foreman_proxy:
github_repo: theforeman/smart_proxy_ansible
module_config: ansible.yml

rh-cloud:
development:
foreman:
github_repo: theforeman/foreman_rh_cloud
hammer:
gem: hammer_cli_foreman_rh_cloud
github_repo: theforeman/hammer-cli-foreman-rh-cloud
module_config: foreman_rh_cloud.yml

# Features not yet in src/features.yaml — full definitions below.

foreman-tasks:
description: Foreman Tasks plugin
foreman:
plugin_name: foreman_tasks
hammer: foreman_tasks
dependencies:
- dynflow
development:
foreman:
github_repo: theforeman/foreman-tasks
hammer:
gem: hammer_cli_foreman_tasks
github_repo: theforeman/hammer-cli-foreman-tasks
module_config: foreman_tasks.yml

discovery:
description: Discovery plugin for Foreman
foreman:
plugin_name: foreman_discovery
hammer: foreman_discovery
development:
foreman:
github_repo: theforeman/foreman_discovery
hammer:
gem: hammer_cli_foreman_discovery
github_repo: theforeman/hammer-cli-foreman-discovery
module_config: foreman_discovery.yml
foreman_proxy:
github_repo: theforeman/smart_proxy_discovery
module_config: discovery.yml

openscap:
description: OpenSCAP plugin for Foreman
foreman:
plugin_name: foreman_openscap
hammer: foreman_openscap
development:
foreman:
github_repo: theforeman/foreman_openscap
hammer:
github_repo: theforeman/hammer_cli_foreman_openscap
module_config: foreman_openscap.yml
foreman_proxy:
github_repo: theforeman/smart_proxy_openscap
module_config: openscap.yml

bootdisk:
description: Bootdisk plugin for Foreman
foreman:
plugin_name: foreman_bootdisk
hammer: foreman_bootdisk
development:
foreman:
github_repo: theforeman/foreman_bootdisk
hammer:
github_repo: theforeman/hammer_cli_foreman_bootdisk
module_config: foreman_bootdisk.yml

theme-satellite:
description: Red Hat Satellite theme for Foreman
foreman:
plugin_name: foreman_theme_satellite
development:
foreman:
github_repo: redhatsatellite/foreman_theme_satellite

webhooks:
description: Webhooks plugin for Foreman
foreman:
plugin_name: foreman_webhooks
hammer: foreman_webhooks
development:
foreman:
github_repo: theforeman/foreman_webhooks
hammer:
gem: hammer_cli_foreman_webhooks
github_repo: theforeman/hammer-cli-foreman-webhooks
module_config: foreman_webhooks.yml
foreman_proxy:
github_repo: theforeman/smart_proxy_shellhooks
module_config: shellhooks.yml

templates:
description: Templates plugin for Foreman
foreman:
plugin_name: foreman_templates
hammer: foreman_templates
development:
foreman:
github_repo: theforeman/foreman_templates
hammer:
gem: hammer_cli_foreman_templates
github_repo: theforeman/hammer-cli-foreman-templates
module_config: foreman_templates.yml

leapp:
description: Leapp plugin for Foreman
foreman:
plugin_name: foreman_leapp
hammer: foreman_leapp
development:
foreman:
github_repo: theforeman/foreman_leapp
hammer:
gem: hammer_cli_foreman_leapp
github_repo: theforeman/hammer-cli-foreman-leapp
module_config: foreman_leapp.yml

puppet:
description: Puppet plugin for Foreman
foreman:
plugin_name: foreman_puppet
hammer: foreman_puppet
development:
foreman:
github_repo: theforeman/foreman_puppet
hammer:
gem: hammer_cli_foreman_puppet
github_repo: theforeman/hammer-cli-foreman-puppet
module_config: foreman_puppet.yml
77 changes: 77 additions & 0 deletions development/filter_plugins/foremanctl_dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import pathlib
import sys
import yaml

# Make src filter_plugins importable to reuse dependency resolution logic
# and the shared FEATURE_MAP, avoiding duplication.
_src_filter_plugins = str(pathlib.Path(__file__).parent.parent.parent / 'src' / 'filter_plugins')
if _src_filter_plugins not in sys.path:
sys.path.insert(0, _src_filter_plugins)

from foremanctl import FEATURE_MAP, filter_features, get_dependencies_for_feature # noqa: E402

_dev_features_yaml = pathlib.Path(__file__).parent.parent / 'features.yaml'


def _deep_merge(base, override):
"""Recursively merge override into base, returning the merged dict."""
merged = base.copy()
for key, value in override.items():
if key in merged and isinstance(merged[key], dict) and isinstance(value, dict):
merged[key] = _deep_merge(merged[key], value)
else:
merged[key] = value
return merged


# Deep-merge development-specific feature extensions into the shared FEATURE_MAP.
# This adds development: blocks to existing src/ features and introduces
# dev-only features with full definitions.
with _dev_features_yaml.open() as _f:
for _feature, _data in yaml.safe_load(_f).items():
if _feature in FEATURE_MAP:
FEATURE_MAP[_feature] = _deep_merge(FEATURE_MAP[_feature], _data)
else:
FEATURE_MAP[_feature] = _data


def _resolve_features(value):
"""Resolve feature list including transitive dependencies, preserving order."""
all_features = list(filter_features(value))
deps = set()
for f in all_features:
deps.update(get_dependencies_for_feature(f))
seen = set()
result = []
for f in list(filter_features(list(value) + list(deps))):
if f not in seen:
seen.add(f)
result.append(f)
return result


def dev_plugins(value):
"""Return list of development plugin configs for enabled features and their dependencies.

Each entry is the development: block from features.yaml for features that have
any development data (foreman, hammer, or foreman_proxy). The calling tasks use
conditional guards to skip entries that lack a specific component.
"""
plugins = []
for feature in _resolve_features(value):
dev_data = FEATURE_MAP.get(feature, {}).get('development', {})
if dev_data:
plugins.append(dev_data)
return plugins


class FilterModule(object):
'''foremanctl development filters'''

def filters(self):
return {
'features_to_dev_plugins': dev_plugins,
}
6 changes: 5 additions & 1 deletion development/playbooks/_flavor_features/metadata.obsah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
variables:
features:
parameter: --add-feature
help: Additional features to enable in this deployment.
help: Additional features to enable in production form.
action: append_unique
dev_features:
parameter: --add-dev-feature
help: Additional features to enable in development form (git checkout).
action: append_unique
17 changes: 0 additions & 17 deletions development/playbooks/deploy-dev/metadata.obsah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@ help: |
Deploy and manage Foreman development environment with git-based Foreman and containerized backend services.

variables:
foreman_development_enabled_plugins:
help: Plugin to enable (can be used multiple times)
action: append
parameter: --foreman-development-enabled-plugin
choices:
- foreman_remote_execution
- foreman_ansible
- foreman_rh_cloud
- foreman_discovery
- foreman_openscap
- foreman_bootdisk
- foreman_theme_satellite
- foreman_tasks
- foreman_webhooks
- foreman_templates
- foreman_leapp
- foreman_puppet
target_host:
help: Target hostname or IP address for deployment
action: store
Expand Down
Loading
Loading