Project

General

Profile

Actions

Bug #7365

closed

Intermittent smart proxy duplicate registration error on Ubuntu 14.04

Added by Dominic Cleal over 9 years ago. Updated about 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Foreman modules
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Intermittently, our tests on Ubuntu 14.04 (trusty) are failing as they attempt to register a smart proxy that has already been created.

# [ INFO 2014-09-04 06:02:58 verbose] E, [2014-09-04T06:02:58.392155 #6554] ERROR -- : 422 Unprocessable Entity
# [ INFO 2014-09-04 06:02:58 verbose] {
# [ INFO 2014-09-04 06:02:58 verbose]     "error" => {
# [ INFO 2014-09-04 06:02:58 verbose]                    "id" => nil,
# [ INFO 2014-09-04 06:02:58 verbose]                "errors" => {
# [ INFO 2014-09-04 06:02:58 verbose]             "name" => [
# [ INFO 2014-09-04 06:02:58 verbose]                 [0] "has already been taken" 
# [ INFO 2014-09-04 06:02:58 verbose]             ],
# [ INFO 2014-09-04 06:02:58 verbose]              "url" => [
# [ INFO 2014-09-04 06:02:58 verbose]                 [0] "Only one declaration of a proxy is allowed" 
# [ INFO 2014-09-04 06:02:58 verbose]             ]
# [ INFO 2014-09-04 06:02:58 verbose]         },
# [ INFO 2014-09-04 06:02:58 verbose]         "full_messages" => [
# [ INFO 2014-09-04 06:02:58 verbose]             [0] "Name has already been taken",
# [ INFO 2014-09-04 06:02:58 verbose]             [1] "URL Only one declaration of a proxy is allowed" 
# [ INFO 2014-09-04 06:02:58 verbose]         ]
# [ INFO 2014-09-04 06:02:58 verbose]     }
# [ INFO 2014-09-04 06:02:58 verbose] }
# [ERROR 2014-09-04 06:02:58 verbose]  Could not set 'present' on ensure: 422 Unprocessable Entity at 12:/usr/share/foreman-installer/modules/foreman_proxy/manifests/register.pp
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/abstract_response.rb:48:in `return!'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/request.rb:230:in `process_result'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/request.rb:178:in `block in transmit'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/1.9.1/net/http.rb:746:in `start'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/request.rb:172:in `transmit'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/request.rb:64:in `execute'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/request.rb:33:in `execute'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/restclient/resource.rb:67:in `post'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/apipie_bindings/api.rb:195:in `http_call'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/apipie_bindings/api.rb:151:in `call'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/lib/ruby/vendor_ruby/apipie_bindings/resource.rb:14:in `call'
# [ INFO 2014-09-04 06:02:58 verbose] /usr/share/foreman-installer/modules/foreman/lib/puppet/provider/foreman_smartproxy/rest_v2.rb:44:in `create'

Logs show that the proxy was created:

Started POST "/api/smart_proxies" for 2001:4800:7812:514:be76:4eff:fe04:ad70 at 2014-09-04 05:56:32 +0000
Processing by Api::V2::SmartProxiesController#create as JSON
  Parameters: {"name"=>"foreman-trusty.example.com", "url"=>"https://foreman-trusty.example.com:8443", "apiv"=>"v2", "smart_proxy"=>{"name"=>"foreman-trusty.example.com", "url"=>"https://foreman-trusty.example.com:8443"}}
Authorized user foreman_api_admin(API Admin)
Completed 201 Created in 402.1ms (Views: 8.0ms | ActiveRecord: 0.0ms)

However subsequent re-evaluations of the resource, or even evaluating properties which look up the smart proxy ID from the API fail to see that it's already there. When they attempt to recreate it, a Rails validation correctly identifies the duplicate.

Started POST "/api/smart_proxies" for 2001:4800:7812:514:be76:4eff:fe04:ad70 at 2014-09-04 05:57:22 +0000
Processing by Api::V2::SmartProxiesController#create as JSON
  Parameters: {"name"=>"foreman-trusty.example.com", "url"=>"https://foreman-trusty.example.com:8443", "apiv"=>"v2", "smart_proxy"=>{"name"=>"foreman-trusty.example.com", "url"=>"https://foreman-trusty.example.com:8443"}}
Authorized user foreman_api_admin(API Admin)
Unprocessable entity SmartProxy (id: new):
  Name has already been taken
  URL Only one declaration of a proxy is allowed

  Rendered api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout (2.3ms)
Completed 422 Unprocessable Entity in 910.5ms (Views: 5.4ms | ActiveRecord: 1.8ms)

When refreshing the resource, you get errors such as:

# [ERROR 2014-09-04 05:56:33 verbose]  /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[foreman-trusty.example.com]: Failed to call refresh: missing param 'id' in parameters

Because the ID can't be resolved for the existing proxy.


Files

foreman-debug.tar.xz foreman-debug.tar.xz 116 KB foreman-debug from the run in the description Dominic Cleal, 09/05/2014 07:02 AM

Related issues 1 (0 open1 closed)

Blocked by Installer - Feature #5838: Add parameter to toggle debug loggingClosedDominic Cleal05/20/2014Actions
Actions

Also available in: Atom PDF