Warn about unrecognized smart proxy features - #554
Conversation
540d0d5 to
a2f7446
Compare
This would require a test that would intentionally break things just to check that this would then emit a warning. I'm open to idea, but at this point I'm leaning towards not having tests for this here. |
| msg: >- | ||
| Proxy {{ foreman_proxy_name }} has features not recognized by Foreman: | ||
| {{ _foreman_proxy_registration.entity.smart_proxies[0].unrecognized_features | join(', ') }}. | ||
| If these features come from a Smart Proxy plugin, make sure Foreman has the plugin installed too. |
There was a problem hiding this comment.
I don't think a user can act on this cleanly. Plugins are not a thing we expose here in foremanctl. We present the user with features. I like the general idea of where you are going with this, but it feels like a post_install check that should happen once at the end of deploy.
There was a problem hiding this comment.
Done. The only thing I'm not exactly happy about is that right now it checks all the proxies, not just those that were registered (or affected) during this installation run. Probably not a problem right now, but it could become somewhat confusing later
f234c85 to
fd35f7b
Compare
|
Generally looks good now, you'll have to deal with the variables that are not scoped to the role name. |
b04015b to
0362373
Compare
|
🍏 |
| server_url: "{{ foreman_server_url }}" | ||
| oauth1_consumer_key: "{{ foreman_oauth_consumer_key }}" | ||
| oauth1_consumer_secret: "{{ foreman_oauth_consumer_secret }}" | ||
| ca_path: "{{ foreman_ca_path }}" |
There was a problem hiding this comment.
To follow our rules, all of the variables in this role need to be role scoped (e.g. post_intsall_foreman_ca_path). Yes, I realize that creates a lot of overhead for this particular case, however, thems the rules currently.
There was a problem hiding this comment.
I was under the impression there was a lint that was enforcing this? Anyway, added
There was a problem hiding this comment.
I think it's enforcing role variables being namespaced but not the use of variables which I realize might sound like the same thing but it's not.
6d7ff5b to
04b7a6a
Compare
| - name: Check for unrecognized Smart Proxy features | ||
| ansible.builtin.include_tasks: smart_proxy_features_check.yaml | ||
| vars: | ||
| post_install_foreman_server_url: "{{ foreman_url }}" |
There was a problem hiding this comment.
This is effectively the same issue -- these are variables not scoped to the current role. These would need to be passed into post_install role when it's declared in the deploy playbook for example.
Would we benefit from global variables? Perhaps. I think that should be a broader discussion.
There was a problem hiding this comment.
So the use of foreman_url on L8 is also wrong?
0e8e74e to
4057e10
Compare
| _post_install_url_msg: "Foreman is running at {{ foreman_url }}" | ||
| _post_install_cred_msg: "Admin credentials: {{ foreman_initial_admin_username }}:{{ foreman_initial_admin_password }}" | ||
| _post_install_url_msg: "Foreman is running at {{ post_install_foreman_server_url }}" | ||
| _post_install_cred_msg: "Admin credentials: {{ post_install_foreman_initial_admin_username }}:{{ post_install_foreman_initial_admin_password }}" |
|
@adamruzicka rebase needed -- I merged a big set of changes with the |
8123cec to
cc2b8e3
Compare
617576a to
1efd7f0
Compare
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously, warnings about unrecognized Smart Proxy features were displayed inline during installation as each proxy was registered. Production deployments now check all Smart Proxies in the post_install role using resource_info to query for unrecognized_features. Development deployments check Smart Proxies in a post_task in the deploy-dev playbook. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
In production deployments, move the Smart Proxy feature check from inline (immediately after registration) to post-deployment checks. This provides a comprehensive view of all proxy features across all registered proxies. For development deployments, keep the inline checks since the Foreman server is stopped before post-deployment tasks run. The post-deployment check uses OAuth authentication to query the Foreman API, fetching all registered Smart Proxies and checking for unrecognized features in a single consolidated check.
Reword the warning to use foremanctl terminology and provide both resolution paths: enable matching features in foremanctl or disable them on the proxy. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Variables used in smart_proxy_features_check.yaml must follow the role-scoped naming convention (post_install_*) per project rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1efd7f0 to
2ea41cf
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
255023a to
07a7388
Compare
|
This now creates a rather huge skipped block at the end of every run: especially: it makes the Could Claude come up with a better solution for our users? |
How does one avoid this with Ansible?
That's fair, it was not obvious from the code that the "message" part is tied into the flavor element. We could make that code more obvious. |
|
I took a shot at both through a re-factor of the post_install role: #641 |
Companion to theforeman/foreman#11017
Why are you introducing these changes? (Problem description, related links)
Currently if the proxy offers more features than Foreman knows, those would go silently ignored (unless all of the proxy's features are unknown to Foreman), which makes it hard to spot misconfigured deployments.
What are the changes introduced in this pull request?
After registering a proxy, fctl will check if all the proxy's features are recognized by Foreman and warn if not.
How to test this pull request
Steps to reproduce:
Checklist