Bug #14479
closed
Function foreman_url check for tokens
Added by Lukas Zapletal over 8 years ago.
Updated over 6 years ago.
Description
In function foreman_url we explicitly check for tokens and I can't find a reason why we do that:
url = if @template_url && @host.try(:token).present?
@template_url
elsif proxy.present? && proxy.has_feature?('Templates') && @host.try(:token).present?
temp_url = ProxyAPI::Template.new(:url => proxy.url).template_url
if temp_url.nil?
logger.warn("unable to obtain template url set by proxy #{proxy.url}. falling back on proxy url.")
temp_url = proxy.url
end
temp_url
end
This simply blocks provisioning when using Templating Smart Proxy plugin. Not sure about the check on the first line, if that's appropriate or not.
With the token checks, you won't see the proxied url in templates when the host isn't in build mode, or at all when tokens are disabled. Surprised we didn't notice until now.
Anyway, that first one is used to pull the proxy url from params to avoid requesting it multiple times from the Proxy, I think the check can be removed there too. Here's where it's set: https://github.com/theforeman/foreman/blob/develop/lib/foreman/renderer.rb#L141-L144
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3404 added
- Category set to Templates
- Translation missing: en.field_release set to 136
This simply blocks provisioning when using Templating Smart Proxy plugin
What does this mean precisely? Tokens are enabled by default, it should typically evaluate to true.
With the token checks, you won't see the proxied url in templates when the host isn't in build mode, or at all when tokens are disabled. Surprised we didn't notice until now.
Indeed, I see the point about previewing when not in build mode. The template support always required tokens to identify the client, which I believe is why the check was there. (If there's no token, the feature won't work.)
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
This simply blocks provisioning when using Templating Smart Proxy plugin
What does this mean precisely? Tokens are enabled by default, it should typically evaluate to true.
I mean when you disable tokens and enable template proxying, it will never work.
Indeed, I see the point about previewing when not in build mode. The template support always required tokens to identify the client, which I believe is why the check was there. (If there's no token, the feature won't work.)
Yes, sure, I see that too, but we should either check only for appropriate cases, or remove the check. Kickstarts work without tokens just fine (MAC address by Anaconda via headers) and there is the client IP address fallback which should work for others.
- Related to Bug #10259: Template proxy does not lookup by MAC address added
- Bugzilla link set to 1292421
- Related to Bug #17636: Template preview requires token to be present for template proxying added
Also available in: Atom
PDF