Bug #30948
closedAuto provisioning does not work across organizations
Description
Auto-provisioning does not work when Foreman core enforces taxonomy of imported host via "default_organization" (and location) global settings during import. Discovery sets taxonomy via its own mechanism, this is then overriden by the import code in Host::Base.set_taxonomies and if discovery rule and hostgroup is in a different taxonomy than the default one (Default Organization/Location), auto provisioning fails to find a rule, even when it works in as_anonymous_admin.
More info at: https://community.theforeman.org/t/discovery-auto-provisioning-not-working/20610
Reproducer:
Create an instance with Default Location and Default Lorganization, make sure these are set as default taxnonimies in Foreman core and then create the following:
Host group 00712_Server Organization: MyOrg (only) Location: MyLoc (only) Subnet: 00712_OpsNet Organization: MyOrg (only) Location: MyLoc (only) Discovery rule 00712_W10 Host group: 00712_Server Query: ip=10.59.24.175 Hostname: ods00712w10.example.com Organization(s): Default Organization, MyOrg Location(s): Default Location, MyLoc “Discovered” plugin settings: Discovery location: MyLoc Discovery organization: MyOrg