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.
Created from redmine issue http://projects.theforeman.org/issues/14369
This is part of https://bugzilla.redhat.com/show_bug.cgi?id=1317846
Upstream bug assigned to firstname.lastname@example.org
Upstream bug component is Organizations and Locations
Moving to POST since upstream bug http://projects.theforeman.org/issues/14369 has been closed
Applied in changeset commit:b597a8a5fea1e103af2d81b548b319ebdc92aa5c.
To verify this issue, there are 2 scenarios that need to be tested:
1. Creating a new organization when there's a host that is **not** associated to any existing organization
When you have an existing host (perhaps your own Satellite instance) that is not associated to any organizations, then the new Organization process/wizard should take you through all 3 steps:
1. Create Organization
2. Select Hosts
3. Edit Properties
I was able to verify this scenario using Satellite 6.2.0 SNAP 8.1
2. Creating a new organization when there's a host that **is** associated to one of the existing organization
For this scenario, if there are no existing hosts that are **not** associated to an organization, then the new Organization process/wizard should should skip the second step and the workflow should be:
1. Create Organization
2. Edit Properties
I was not able to verify this scenario and steps 2 and 3 were bypassed.
Both of these can be seen in the following video: https://omaciel.fedorapeople.org/Bug1321826.m4v
Furthermore, for the first scenario described on comment #7, if you choose to Assign all existing un-associated hosts to your new organization, then Step 3 is bypassed as well.
Once you don't have any un-associated hosts available, the new Organization process/wizard will always bypass Steps 2 and 3.
Unfortunately I was not able to test scenario #1 on a Satellite 6.1.8 system but scenario #2 and what I wrote on comment #8 can be easily reproduced on Satellite 6.1.8 system as well.
Failing this issue.
Katello overrides foreman's redirection behavior. Should be re-tested after http://projects.theforeman.org/issues/14724 is brought downstream.
Upstream bug component is Content Management
I verified both scenarios in comment #7 on Snap 12.
The issue in comment #8 remains - selecting "Assign all" or "Manually assign" causes step 3 to be skipped, but it is a separate issue - opened BZ 1338527 for it.
Marking this as verified.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.