Actions
Bug #14369
closedWhen creating new organization, host selection step won't show, if the user is n context of different organization.
Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Description
Steps to reproduce:
1. Make sure you have a host without organization.
2. Pick an organization for your context (Make sure you have organization name instead of "Any context")
3. Create a new organization
Expected: Redirection to "Step 2" - hosts selector
Actual: Redirection to Edit organization screen.
The problem is in #count_nil_hosts, it uses Host.where(taxonomy_id => nil).count to check for unassigned hosts.
By default this is scoped:
Host.where(taxonomy_id => nil).to_sql #=> "SELECT \"hosts\".* FROM \"hosts\" WHERE \"hosts\".\"type\" IN ('Host::Managed') AND \"hosts\".\"location_id\" IN (12) AND \"hosts\".\"location_id\" IS NULL"
This query will always return 0.
Actions