Project

General

Profile

Bug #14369

When creating new organization, host selection step won't show, if the user is n context of different organization.

Added by Shimon Shtein almost 5 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

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.


Related issues

Related to Foreman - Bug #14252: Creating a new organization redirects to list rather than host assignment and edit propertiesClosed2016-03-17

Associated revisions

Revision b597a8a5 (diff)
Added by Shimon Shtein almost 5 years ago

Fixes #14369 - Removed default scope from host counter in taxonomies

History

#2 Updated by Shimon Shtein almost 5 years ago

  • Related to Bug #14252: Creating a new organization redirects to list rather than host assignment and edit properties added

#3 Updated by The Foreman Bot almost 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3371 added

#4 Updated by Shimon Shtein almost 5 years ago

  • Bugzilla link set to 1321826

#5 Updated by Ivan Necas almost 5 years ago

  • Legacy Backlogs Release (now unused) set to 136

#6 Updated by Shimon Shtein almost 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF