To me, as a user, if I delete an org (or location) I'd simply want the foreman resources to be unassociated from it. It may be the case, for example, that a resource like a provisioning template is shared among multiple orgs. A host is different, I know, in that it can belong to only one org but I would still lean towards consistency by throwing it into the bucket of unassociated hosts.
On Wed, Jun 8, 2016 at 3:05 PM, Partha Aji <[email protected]> wrote: > 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. > -- 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.
