While working on one of the org deletion bugs (
http://projects.theforeman.org/issues/15336) I hit upon this inconsistency
in Foreman code base and would like  suggestions on the agreeable behavior.

So here is the user action
1) User creates an org
2) Assigns a host to that org
3) Deletes that org

There seem to be 2 different approaches taken in the foreman code
1)
https://github.com/theforeman/foreman/blob/develop/app/models/taxonomies/organization.rb#L8
seems to indicate the intention to nullify the organization-host
association if organization gets deleted. This tells me that its ok to
delete the org with hosts associated to it.
"has_many_hosts :dependent => :nullify"

2)
https://github.com/theforeman/foreman/blob/develop/test/functional/api/v2/locations_controller_test.rb#L74
seems to indicate we do Not want to delete orgs/locations if hosts are
attached to it. "should NOT destroy location if hosts use it" .

Looking at the commit dates for both, they were merged a mere month after
each other (jan - feb 2013). 2 came before 1 .

I prefer 1 over 2 .. Unassociate the Org from the Host if the org gets
deleted instead of blocking the delete.  Whats your preferred approach.
Kindly let me know.

Partha

-- 
You received this message because you are subscribed to the Google Groups 
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to