Repository navigation
Add feature removal validation and removability metadata #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ variables: | |
| action: append_unique | ||
| remove_features: | ||
| parameter: --remove-feature | ||
| help: Additional features to disable in this deployment. | ||
| help: Features to remove from the persisted user feature list. | ||
| action: remove | ||
| dest: features | ||
| persist: false | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't persist it, won't it come back on next deployment? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| obsah >= 1.11.0 | ||
| obsah @ git+https://github.com/theforeman/obsah.git@refs/pull/140/head | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Detected with Advanced Tier | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: set -eu
printf '%s\n' '--- changed file ---'
cat -n src/requirements.txt
printf '%s\n' '--- exact diff ---'
git diff --no-ext-diff --unified=20 384ca52eaad1924fd07681b862d1066e58d4a846 96af1e8fe2a11b21506f007cdc7aef349c9e8077 -- src/requirements.txt
printf '%s\n' '--- direct consumers and installs ---'
rg -n --hidden -g '!node_modules' -g '!dist' -g '!build' 'src/requirements\.txt|requirements\.txt|pip(3)? install|pip-compile|obsah' . | head -n 240
printf '%s\n' '--- nearby repository guidance ---'
find . -maxdepth 2 -type f \( -iname 'README*' -o -iname 'CONTRIBUTING*' -o -iname '*policy*' -o -iname 'pyproject.toml' -o -iname 'setup.cfg' -o -iname 'tox.ini' \) -printRepository: theforeman/foremanctl Length of output: 13207 Security Misconfiguration Reachability: External Pin Obsah to a reviewed commit.
Pin the dependency revision- obsah @ git+https://github.com/theforeman/obsah.git@refs/pull/140/head
+ obsah @ git+https://github.com/theforeman/obsah.git@<reviewed-full-commit-hash>🤖 Prompt for AI Agents |
||
| requests | ||
| requests-oauthlib | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,52 @@ | ||
| --- | ||
| - name: Validate feature removal requests | ||
| ansible.builtin.assert: | ||
| that: | ||
| - check_features_removal_errors | length == 0 | ||
| fail_msg: | | ||
| ERROR: Invalid feature removal request: | ||
| {% for error in check_features_removal_errors %} | ||
| - {{ error }} | ||
| {% endfor %} | ||
| vars: | ||
| check_features_removal_errors: "{{ remove_features | validate_feature_removals(flavor_features) }}" | ||
| when: remove_features | length > 0 | ||
|
|
||
| - name: Validate feature dependencies | ||
| ansible.builtin.assert: | ||
| that: | ||
| - check_features_dependency_errors | length == 0 | ||
| fail_msg: | | ||
| ERROR: Removing features would break dependencies: | ||
| {% for error in check_features_dependency_errors %} | ||
| - {{ error }} | ||
| {% endfor %} | ||
| vars: | ||
| check_features_dependency_errors: "{{ enabled_features | unsatisfied_dependencies(remove_features) }}" | ||
| when: remove_features | length > 0 | ||
|
|
||
| - name: Validate requested features | ||
| ansible.builtin.assert: | ||
| that: | ||
| - found_invalid_features | length == 0 | ||
| - check_features_invalid | length == 0 | ||
| fail_msg: | | ||
| ERROR: Unknown feature(s) requested: {{ found_invalid_features | join(', ') }} | ||
| ERROR: Unknown feature(s) requested: {{ check_features_invalid | join(', ') }} | ||
|
|
||
| Run 'foremanctl features' to list all available features. | ||
| vars: | ||
| found_invalid_features: "{{ features | invalid_features }}" | ||
| check_features_invalid: "{{ features | invalid_features }}" | ||
| when: features | length > 0 | ||
|
|
||
| - name: Validate feature conflicts | ||
| ansible.builtin.assert: | ||
| that: | ||
| - found_conflicts | length == 0 | ||
| - check_features_conflicts | length == 0 | ||
| fail_msg: | | ||
| ERROR: Conflicting features detected: | ||
| {% for conflict in found_conflicts %} | ||
| {% for conflict in check_features_conflicts %} | ||
| - {{ conflict }} | ||
| {% endfor %} | ||
|
|
||
| These features cannot be enabled together. | ||
| vars: | ||
| found_conflicts: "{{ enabled_features | conflicting_features }}" | ||
| check_features_conflicts: "{{ enabled_features | conflicting_features }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,5 +3,6 @@ certificates_source: default | |
| database_mode: internal | ||
| tuning: default | ||
| features: [] | ||
| remove_features: [] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the idea behind this that you can run some active code to remove the features? I can see that. I've considered a generic framework in foreman, like |
||
| enabled_features: "{{ (flavor_features + features) }}" | ||
| air_gapped: false | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not reject an absent feature as a removed dependency.
If
registrationis enabled andtemplatesis absent from the persisted user list,--remove-feature templateschanges nothing. Line 172 still addstemplatestoremove_set, and the dependency check rejects the deployment.registrationdeclarestemplatesas a dependency, so this breaks the documented idempotent no-op. Track which entries the remove action actually deleted, or compare against the prior explicit feature list before checking dependencies. (github.com)🤖 Prompt for AI Agents