Bug #8860
closedclean_backend_objects rake task seems broken
Description
- foreman-rake katello:clean_backend_objects --trace
- Invoke katello:clean_backend_objects (first_time)
- Invoke environment (first_time)
- Execute environment
- Execute katello:clean_backend_objects
rake aborted!
Expect initializer to return hash if a group of attributes is defined by lazy_accessor
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.0.0/app/lib/katello/lazy_accessor.rb:178:in `run_initializer'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.0.0/app/lib/katello/lazy_accessor.rb:155:in `lazy_attribute_get'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.0.0/app/lib/katello/lazy_accessor.rb:75:in `block (2 levels) in lazy_accessor'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.0.0/lib/katello/tasks/clean_backend_objects.rake:9:in `block (3 levels) in <top (required)>'
Updated by Justin Sherrill about 10 years ago
a number of changes i had to make to make it work:
https://gist.github.com/jlsherrill/66842924e4248900ef77
Updated by The Foreman Bot almost 10 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/4917 added
- Pull request deleted (
)
Updated by Justin Sherrill almost 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset katello|afe38fe0f0b195804a52a1079e3a86beeb3bb2f5.
Updated by Anonymous almost 10 years ago
this still can fail if pulp is missing consumers the task is trying to delete:
[root@satp1 ~]# foreman-rake katello:clean_backend_objects --trace- Invoke katello:clean_backend_objects (first_time)
- Invoke environment (first_time)
- Execute environment
- Execute katello:clean_backend_objects
rake aborted!
404 Resource Not Found
/opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
/opt/rh/ruby193/root/usr/share/gems/gems/runcible-1.1.0/lib/runcible/base.rb:97:in `block in get_response'
/opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
/opt/rh/ruby193/root/usr/share/gems/gems/rbovirt-0.0.29/lib/restclient_ext/request.rb:50:in `block in transmit'
/opt/rh/ruby193/root/usr/share/ruby/net/http.rb:746:in `start'
/opt/rh/ruby193/root/usr/share/gems/gems/rbovirt-0.0.29/lib/restclient_ext/request.rb:44:in `transmit'
/opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/opt/rh/ruby193/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:94:in `delete'
/opt/rh/ruby193/root/usr/share/gems/gems/runcible-1.1.0/lib/runcible/base.rb:96:in `get_response'
/opt/rh/ruby193/root/usr/share/gems/gems/runcible-1.1.0/lib/runcible/base.rb:87:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/runcible-1.1.0/lib/runcible/resources/consumer.rb:70:in `delete'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/lib/katello/tasks/clean_backend_objects.rake:51:in `block in cleanup_host_delete_artifacts'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/lib/katello/tasks/clean_backend_objects.rake:49:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/lib/katello/tasks/clean_backend_objects.rake:49:in `cleanup_host_delete_artifacts'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-1.5.0/lib/katello/tasks/clean_backend_objects.rake:57:in `block (2 levels) in <top (required)>'
This change in the rake task did the trick:
def cleanup_host_delete_artifacts
# clean up dirty consumer data in candleplin,
# that did not get cleared by host delete.
# look at https://bugzilla.redhat.com/show_bug.cgi?id=1140653
# for more information
cp_consumers = ::Katello::Resources::Candlepin::Consumer.get({})
cp_consumer_ids = cp_consumers.map {|cons| cons["uuid"]}
katello_consumer_ids = ::Katello::System.pluck(:uuid)
deletable_ids = cp_consumer_ids - katello_consumer_ids
deletable_ids.each do |consumer_id|
begin
Katello::Resources::Candlepin::Consumer.destroy(consumer_id)
rescue RestClient::Exception => e
p "exception when destroying candlepin consumer #{consumer_id}:#{e.inspect}"
end
begin
Katello.pulp_server.extensions.consumer.delete(consumer_id)
rescue RestClient::Exception => e
p "exception when destroying pulp consumer #{consumer_id}:#{e.inspect}"
end
end
end
Updated by Eric Helms almost 10 years ago
- Translation missing: en.field_release changed from 14 to 23