Bug #5717
closedProvisioning template selection issue
Description
Our finish templates looked a bit like this:
Finish Bonded IF [ HostgroupA / production ]
Finish Default
A host I was provisioning was in HostgroupB, so I expected 'Finish Default' to be picked up from the operating system, but instead I got 'Finish Bonded IF'. Not good if they are on difference VLANs :)
What I believe is probably happening is when checking for an environment match it's just picking the first template in production, regardless of whether that environment is for an explicit hostgroup. The pseudo code logic should be (to my mind!):
for_each template
if template.hostgroup hostgroup and template.env env
use template
for_each template
if template.hostgroup hostgroup and ! isset(template.env)
use template
for_each template
if ! isset(template.hostgroup) and template.env env
use template
use os.template
cheers!