@host.methods doesn't actually return all the available methods in the safe mode jail, which is why respond_to? doesn't work as expected. Anyway, we're stuck with identifying a Realm-capable foreman version using only the features 1.4. This simply will cause the template not to render on < 1.5:
<% if @host.otp && @host.realm && @host.realm.realm_type == "FreeIPA" && os_major <= 6 -%>
The only way I see is to add something to 1.5 that lets us know we can do realms, but that still works on 1.4...so, as far as I can see, that means abusing an existing hash.
What about adding this to Host::Managed#info?
param["realm"] = realm.name if realm
Then:
<% if @host.params["realm"] && @host.otp && @host.realm.realm_type == "FreeIPA" && os_major <= 6 -%>