Add mutually exclusive feature support via conflicts metadata - #610
Conversation
jeremylenz
left a comment
There was a problem hiding this comment.
I like the bidirectional conflict validation here better than mine. 👍
|
I wasn't a huge fan of having to declare it bidirectionally as that feels like repeating. The other option would be to keep a separate list of things that conflict with one another which didn't feel great either. |
|
I thought your PR added the bidirectionality where mine didn't have it. I guess I failed to see what the other difference is here, other than separation of concerns? |
6eeed47 to
1bfa50c
Compare
|
ACK on "we need a way to express conflicts between features" |
552061f to
c9fed20
Compare
Features can now declare conflicts in features.yaml to prevent incompatible features from being enabled together. The check_features role validates enabled_features for conflicts during deploy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c9fed20 to
0053caf
Compare
|
Now |
I had put them into the tests (https://github.com/theforeman/foremanctl/pull/610/changes#diff-9b8be14734051b33b8fe909653da4005dabc888e1e5c50e2dc58b20358130ba4R41-R56) -- did you have a different idea in mind for "development-level check" ? |
|
I can't read :) |
Why are you introducing these changes? (Problem description, related links)
Features in foremanctl can declare dependencies but have no way to declare that two features conflict with each other. When incompatible features are both enabled — whether via
--add-featureon the same command, from a previous deploy's persisted state, or from flavor defaults — the deploy proceeds silently and produces a broken deployment. For example,cloud-connectorandiopboth provide connectivity to the Red Hat Hybrid Cloud Console using different mechanisms and cannot coexist (see #569).What are the changes introduced in this pull request?
conflictsproperty to the feature metadata schema infeatures.yaml, allowing features to declare mutual exclusivity alongside existingdependenciesconflicting_featuresJinja2 filter insrc/filter_plugins/foremanctl.pythat checksenabled_featuresfor conflict violations and returns deduplicated conflict pair descriptionsasymmetric_conflictsfilter that validates all conflict declarations are bidirectional (both sides must declare the conflict)src/roles/check_features/tasks/main.yamlwith a "Validate feature conflicts" assertion that fails the deploy early with a clear error messagedocs/developer/feature-metadata.mdanddocs/developer/how-to-add-a-feature.mdwith conflicts documentation and examplesHow to test this pull request
Steps to reproduce:
src/features.yaml(e.g. whencloud-connectorlands via Add cloud-connector as a native foremanctl feature #569, addconflicts: [iop]to it andconflicts: [cloud-connector]toiop)./foremanctl deploy --add-feature <feature-a> --add-feature <feature-b>with both conflicting features — deploy should fail with "Conflicting features detected" error.venv/bin/python -m pytest tests/unit/filter_test.py -vv --noconftestcd src; ansible-lint roles/check_features/tasks/main.yamlChecklist