Project

General

Profile

Actions

Bug #6240

open

When a feature is removed from a proxy, the relevant models still keep the association

Added by Stephen Benjamin almost 10 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Smart Proxy
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

For example, when the DNS feature is removed from the proxy, the association on the domain stays in place in the database, however a user can't view it in the UI. Foreman will also still try to talk to the DNS proxy, even though the proxy doesn't support the feature anymore.

To reproduce:
1. Create a new DNS proxy
2. Assign the proxy to a Domain
3. Remove the DNS feature from the proxy
4. Create a new host in that domain


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #6241: Models allow invalid proxy associationsClosedOndřej Pražák06/16/2014Actions
Actions #1

Updated by Stephen Benjamin almost 10 years ago

  • Related to Bug #6241: Models allow invalid proxy associations added
Actions #2

Updated by Stephen Benjamin almost 10 years ago

We can't really fail when refreshing the features of a proxy, we just have to take what the proxy offers, so I see two ways to fix this:

(1) When a feature is removed, go to the models and disassociate the proxy.

(2) In the select for the proxy, find all proxies with Feature AND include the current proxy id even if it doesn't have that feature, so at least we're not hiding the association anymore. So like this for DNS proxy on Domains:

SmartProxy.joins(:features).where("features.name = ? OR smart_proxies.id = ?", "DNS", @domain.dns_id)

Now at this point if the user tries to save the model with the invalid proxy, then we can fail by saying that the selected proxy doesn't have that feature anymore (add validations as per #6241).

Does that make sense?

Actions #3

Updated by Dominic Cleal almost 10 years ago

I'd err towards disassociating it, as it'll probably be clearer without needing to re-save every related model.

Actions #4

Updated by Stephen Benjamin over 9 years ago

  • Bugzilla link set to 1170097
Actions

Also available in: Atom PDF