foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Fixes #35835 - Hide provisioning cards for unmanaged hosts

Open ekohl opened this issue 3 years ago • 8 comments

Unmanaged hosts do not have provisioning so the cards shouldn't be shown.

In addition to this it also moves away from using the hostname in the API URL and instead uses the host ID. Host IDs are stable while a host can be renamed. Application code should never use the names in URLs.

I should mention I wasn't able to test this out yet (don't have a development environment with a compatible nodejs version).

ekohl avatar Dec 07 '22 16:12 ekohl

Issues: #35835

theforeman-bot avatar Dec 07 '22 16:12 theforeman-bot

Before I fix the lint issues: is this actually something we should filter out at the card registry level?

ekohl avatar Dec 07 '22 16:12 ekohl

is this actually something we should filter out at the card registry level?

Or at what level instead?

MariaAga avatar Dec 07 '22 20:12 MariaAga

Right now this PR filters it out at the card level. Perhaps the registry could/should be enhanced to do the filtering? Basically accept a function that takes hostDetails and returns a boolean.

ekohl avatar Dec 07 '22 20:12 ekohl

Im not sure what the benefit of that will be, and this way makes it clear on the card level why isnt it shown which is nice.

MariaAga avatar Apr 24 '23 10:04 MariaAga

I don't think it is clear. It gives the impression the fields can be set, but they can't. At a database level the fields don't exist. If anything, the whole card should be grayed out to make it clear it's not applicable.

ekohl avatar Apr 25 '23 13:04 ekohl

Why does the current state of the pr gives the impression the fields can be set?

MariaAga avatar May 08 '23 11:05 MariaAga

I'm reviving this PR. In the mean time I learned a bit more.

We have a Host::Managed object, which has a boolean managed. If managed is set to false, you are not able to provision it. Yesterday we discussed that provisionable is a better name.

We also have a way to change it between the two: https://github.com/theforeman/foreman/blob/555c3d0f4de32b72cf11aab6c7099aeee38f17ff/app/views/hosts/edit.html.erb#L5-L7

Perhaps instead of hiding the whole section, we can instead show the "Manage host" button with some instructions?

You can also see some fields are conditionally present: https://github.com/theforeman/foreman/blob/555c3d0f4de32b72cf11aab6c7099aeee38f17ff/app/views/hosts/_form.html.erb#L13-L18 https://github.com/theforeman/foreman/blob/555c3d0f4de32b72cf11aab6c7099aeee38f17ff/app/views/hosts/_form.html.erb#L106

Looking at it, that's just the compute resource and OS: https://github.com/theforeman/foreman/blob/develop/app/views/hosts/_unattended.html.erb

Looking more at it, I think you can import hosts from compute resources and they end up as unmanaged hosts. That workflow then doesn't make a lot of sense.

ekohl avatar Apr 25 '24 13:04 ekohl