Bug #3255
closedforeman proxy auto-registration may fail
Description
Hi,
I just got caught with foreman 1.3 : using the installer defaults, foreman autoregisters a proxy.
Problem is when you already have a registered proxy for the host with a different name: in my case, the proxy was registered with the short hostname, while foreman attempted to register it with the long hostname.
This lead to puppet errors like this :
Error: Could not set 'present' on ensure: 422 Unprocessable Entity at 12:/etc/puppet/envs/dev/puppet/foreman_proxy/manifests/register.pp /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `transmit' /usr/lib/ruby/1.8/net/http.rb:543:in `start' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/resource.rb:71:in `post' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.6/lib/foreman_api/base.rb:77:in `send' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.6/lib/foreman_api/base.rb:77:in `http_call' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.6/lib/foreman_api/base.rb:60:in `perform_call' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.6/lib/foreman_api/resources/smart_proxy.rb:37:in `create' /etc/puppet/envs/dev/puppet/foreman/lib/puppet/provider/foreman_smartproxy/rest.rb:31:in `create' /usr/lib/ruby/site_ruby/1.8/puppet/property/ensure.rb:16:in `set_present'
And foreman logs like that :
Started POST "/api/smart_proxies" for xxxIPxxx at 2013-10-15 12:24:58 +0200 Processing by Api::V1::SmartProxiesController#create as JSON Parameters: {"smart_proxy"=>{"url"=>"https://xxx_long hostname_xxx:8443", "name"=>"xxx_long_hostname_xxx"}} Authorized user admin(Admin User) Unprocessable entity SmartProxy (id: new): URL Only one declaration of a proxy is allowed
I think the error should be at least made explicit that a proxy already exists with a different name but with the same URL, or there should be no error at all when running the installer/puppet class.
Regards
Updated by Dominic Cleal over 11 years ago
- Project changed from Foreman to Installer
- Category changed from Smart Proxy to Foreman modules
Updated by Lukas Zapletal over 11 years ago
- Status changed from New to Rejected
Hello,
this is not a bug, but feature. I explained this in the user thread. I am closing for now, please reopen if the solution does not work for you.
Updated by Lars Kellogg-Stedman over 10 years ago
For those of us finding our way here via a search engine it would be helpful if someone would paste in the relevant portions of the mailing list thread (or provide an appropriate link).
Updated by Lukas Zapletal over 10 years ago
Ok let me explain again :-)
You already have a smart proxy regitered with the same URL but different name. To fix this issue, rename the smart proxy to the same name, but without http prefix and port. Example:
Name: incorrect
URL: http://my.host.test:8443
Change to:
Name: my.host.test
URL: http://my.host.test:8443
Then re-run the installer to verify, it will not do any change then.