Skip to content

Registering Smart-Proxy fails on initial run by using an outdated value as URL #8

@frzb

Description

@frzb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workinghacktoberfestAn issue highlighted for the digital ocean Hacktoberfest Event

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions