Project

General

Profile

Actions

Bug #7856

closed

Activation Key not immediately available after creation

Added by Christine Fouant about 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Difficulty:
easy
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1127335
Description of problem:
1. An HTTP 200 (OK) response is returned if one creates an activation key, waits a while, then issues a GET request for that key. This is good.
2. An HTTP 404 (NOT FOUND) response may be returned if one creates an activation key and immediately issue a GET request for that key. This is a problematic.

Version-Release number of selected component (if applicable):

This issue was manually verified on qetello01.usersys.redhat.com. Software installed:

  • apr-util-ldap-1.3.9-3.el6_0.1.x86_64
  • candlepin-0.9.21-1.el6.noarch
  • candlepin-selinux-0.9.21-1.el6.noarch
  • candlepin-tomcat6-0.9.21-1.el6.noarch
  • elasticsearch-0.90.10-4.el6.noarch
  • foreman-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-compute-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-gce-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-libvirt-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-ovirt-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-postgresql-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-proxy-1.6.0-0.develop.201407301351git0e616f1.el6.noarch
  • foreman-release-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • foreman-selinux-1.6.0-0.develop.201406261522git5532684.el6.noarch
  • foreman-vmware-1.6.0-0.develop.201408051222gitc981ec9.el6.noarch
  • katello-1.5.0-14.201408051825git898ce43.el6.noarch
  • katello-ca-1.0-1.noarch
  • katello-certs-tools-1.5.2-1.git.1.edab2c4.el6.noarch
  • katello-installer-0.0.19-1.201407311604gitca52a4f.el6.noarch
  • katello-repos-1.5.1-1.git.14.0868bd1.el6.noarch
  • openldap-2.4.23-32.el6_4.1.x86_64
  • pulp-katello-0.3-3.el6.noarch
  • pulp-nodes-common-2.4.0-0.29.beta.el6.noarch
  • pulp-nodes-parent-2.4.0-0.29.beta.el6.noarch
  • pulp-puppet-plugins-2.4.0-0.29.beta.el6.noarch
  • pulp-puppet-tools-2.4.0-0.29.beta.el6.noarch
  • pulp-rpm-plugins-2.4.0-0.29.beta.el6.noarch
  • pulp-selinux-2.4.0-0.29.beta.el6.noarch
  • pulp-server-2.4.0-0.29.beta.el6.noarch
  • python-ldap-2.3.10-1.el6.x86_64
  • ruby193-rubygem-ldap_fluff-0.3.0-1.el6.noarch
  • ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
  • ruby193-rubygem-runcible-1.1.0-1.el6.noarch

How reproducible:
Maybe one quarter of all POST-GET request pairs produces this issue.

Steps to Reproduce:
1. Issue an HTTP POST request to /katello/api/v2/activation_keys
2. Immediately issue an HTTP GET request to /katello/api/v2/activation_keys/:id

Actual results:
Either HTTP 200 (OK) or HTTP 404 (NOT FOUND).

Expected results:
HTTP 200 (OK), every single time.

Additional info:

Here's an example of a manually-verified case of the bug. An HTTP POST request was issued to https://qetello01.usersys.redhat.com/katello/api/v2/activation_keys, and this response was returned:

{
u'content_view_id': None,
u'environment_id': None,
u'user_id': 3,
u'description': None,
u'content_view': None,
u'created_at': u'2014-08-06T15:49:19Z',
u'content_overrides': [],
u'updated_at': u'2014-08-06T15:49:19Z',
u'environment': None,
u'release_version': None,
u'service_level': None,
u'products': [],
u'usage_count': 0,
u'max_content_hosts': None,
u'pools': [],
u'organization': {u'name': u'\U00023b23\U00108c3e\U0003e472\U0006325e\U0008a8a2\U000a6268\U0007ca1e\U000d9407\U0005a9c7\U000b8b10\U000c2c0e\U0005f4df\U00069f9b\U000dd6b0\U00057e23\U000e50f7\U000c5fcf\U0004c986', u'label': u'266a451d-aef6-41db-a9ae-374682d29803'},
u'host_collections': [],
u'permissions': {u'view_activation_keys': True, u'destroy_activation_keys': True, u'edit_activation_keys': True},
u'unlimited_content_hosts': True,
u'id': 51,
u'name': u'\xdf\xca\xc2\xe9\xed\xc8\xe2\xd1\xc8\xe7\xf2\xd2\xce\xf0\xc0\xdc\xc5\xd9'
}

An HTTP GET request was immediately issued to https://qetello01.usersys.redhat.com/katello/api/v2/activation_keys/51. An HTTP 404 response was returned, with this error message:

{u'displayMessage': u"Couldn't find activation key", u'errors': [u"Couldn't find
activation key"]}

Issuing an HTTP GET request to that same URL at a later point in time succeeds with this response:

{
u'content_view_id': None,
u'environment_id': None,
u'user_id': 3,
u'description': None,
u'content_view': None,
u'created_at': u'2014-08-06T15:49:19Z',
u'content_overrides': [],
u'updated_at': u'2014-08-06T15:49:19Z',
u'environment': None,
u'release_version': None,
u'service_level': None,
u'products': [],
u'usage_count': 0,
u'max_content_hosts': None,
u'pools': [],
u'organization': {u'name': u'\U00023b23\U00108c3e\U0003e472\U0006325e\U0008a8a2\U000a6268\U0007ca1e\U000d9407\U0005a9c7\U000b8b10\U000c2c0e\U0005f4df\U00069f9b\U000dd6b0\U00057e23\U000e50f7\U000c5fcf\U0004c986', u'label': u'266a451d-aef6-41db-a9ae-374682d29803'},
u'host_collections': [],
u'permissions': {u'view_activation_keys': True, u'destroy_activation_keys': True, u'edit_activation_keys': True},
u'unlimited_content_hosts': True,
u'id': 51,
u'name': u'\xdf\xca\xc2\xe9\xed\xc8\xe2\xd1\xc8\xe7\xf2\xd2\xce\xf0\xc0\xdc\xc5\xd9'
}

The server-side production log for the initial POST-GET cycle is as follows:

Processing by Katello::Api::V2::ActivationKeysController#create as /*
Parameters: {"organization_id"=>149, "name"=>"ßÊÂéíÈâÑÈçòÒÎðÀÜÅÙ", "api_version"=>"v2", "activation_key"=>{"name"=>"ßÊÂéíÈâÑÈçòÒÎðÀÜÅÙ", "organization_id"=>149}}
Expire fragment views/tabs_and_title_records-3 (0.1ms)
Authorized user admin(Admin User)
Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/views/katello/api/v2/common/create.json.rabl within katello/api/v2/layouts/resource (145.0ms)
Completed 200 OK in 727ms (Views: 144.7ms | ActiveRecord: 1.1ms)
Processing by Katello::Api::V2::ActivationKeysController#show as */

Parameters: {"api_version"=>"v2", "id"=>"51", "activation_key"=>{}}
Expire fragment views/tabs_and_title_records-3 (0.1ms)
Authorized user admin(Admin User)
Katello::HttpErrors::NotFound: Couldn't find activation key
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/controllers/katello/api/v2/activation_keys_controller.rb:166:in `search_for_activation_key'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:553:in `block (3 levels) in run_2091583399410398825__process_action__1732730459607026219__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in `block in conditional_callback_around_9895'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:in `around'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in `_callback_around_3325'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_9895'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:471:in `block (2 levels) in _run
_2091583399410398825__process_action__1732730459607026219__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in `block in conditional_callback_around_9894'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_9894'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:426:in `block in _run
_2091583399410398825__process_action__1732730459607026219__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in `block in conditional_callback_around_9893'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:in `around'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in `_callback_around_13'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_9893'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run
_2091583399410398825__process_action__1732730459607026219__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/app/controllers/katello/api/api_controller.rb:61:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal.rb:203:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal.rb:246:in `block in action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:36:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/mapper.rb:42:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/apipie-rails-0.2.2/lib/apipie/static_dispatcher.rb:65:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/apipie-rails-0.2.2/lib/apipie/extractor/recorder.rb:97:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/apipie-rails-0.2.2/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:9:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__463410837166006432__call__169715690807833388__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/lib/katello/middleware/silenced_logger.rb:30:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/urlmap.rb:64:in `block in call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `call'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
Completed 404 Not Found in 70ms (Views: 0.4ms | ActiveRecord: 5.6ms)

Actions

Also available in: Atom PDF