Given this ressource at recipes/proxy_register.rb:
foreman_smartproxy node['foreman-proxy']['registered_name'] do
base_url node['foreman-proxy']['foreman_base_url']
consumer_key node['foreman-proxy']['oauth_consumer_key']
consumer_secret node['foreman-proxy']['oauth_consumer_secret']
effective_user node['foreman-proxy']['oauth_effective_user']
url node['foreman-proxy']['registered_proxy_url']
only_if { node['foreman-proxy']['register'] }
retries 3
retry_delay 5
action :create
This resource currently can not succeed on the first run because url is referring to a derived attribute which is changed after compile time.
Looking at attributes/foreman_proxy.rb shows that:
default['foreman-proxy']['registered_proxy_url'] = "http#{'s' if node['foreman-proxy']['ssl']}://#{node['foreman-proxy']['registered_name']}:#{registered_port}" referred by url is derived from:
default['foreman-proxy']['registered_name'] = node['fqdn']
This node attribute node[fqdn] is changed by the included hostname cookbook during the (initial) run.
I guess a possible solution could be to leverage lazy evaluation of attributes.
Given this ressource at
recipes/proxy_register.rb:This resource currently can not succeed on the first run because
urlis referring to a derived attribute which is changed after compile time.Looking at
attributes/foreman_proxy.rbshows that:default['foreman-proxy']['registered_proxy_url'] = "http#{'s' if node['foreman-proxy']['ssl']}://#{node['foreman-proxy']['registered_name']}:#{registered_port}"referred byurlis derived from:default['foreman-proxy']['registered_name'] = node['fqdn']This node attribute
node[fqdn]is changed by the includedhostnamecookbook during the (initial) run.I guess a possible solution could be to leverage lazy evaluation of attributes.