theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
146 stars 163 forks source link

Add test-connection functionality to compute resource module #253

Open Fobhep opened 5 years ago

Fobhep commented 5 years ago

The compute resource module is so far not able to test whether the connection to a new resource is wokring. The foreman gui has a functionality for this. so far it seems to me this is not fully backed by the foreman api. Maybe once could "build around it" by using the api functionality to list available sub-entities of a compute-resource (pools, zones, etc, ..)

evgeni commented 4 years ago

triage: research if that is even possible and how the UI does it, open foreman issue if needed

mdellweg commented 4 years ago

Maybe it can be handled similar to scc_account

evgeni commented 4 years ago

The problem that @akofink mentioned during triage is that there is no api endpoint and the UI does some weird tricks to validate from the browser (not even the Rails backend).

evgeni commented 4 years ago

So for the UI, there is a /compute_resources/test_connection endpoint, that is defined in the controller: https://github.com/theforeman/foreman/blob/528875da4d17efc83488a2017a4286f085a6eb92/app/controllers/compute_resources_controller.rb#L126-L136

That is what the UI talks to when you click the button. It should be possible to make it work via API too, but at the moment there is no such API method.

I have opened https://projects.theforeman.org/issues/28554 against Foreman and labeling this "waiting on other project".