Project

General

Profile

Actions

Bug #8860

closed

clean_backend_objects rake task seems broken

Added by Justin Sherrill over 9 years ago. Updated almost 6 years ago.

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

Description

  1. 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)>'
Actions #1

Updated by Justin Sherrill over 9 years ago

a number of changes i had to make to make it work:
https://gist.github.com/jlsherrill/66842924e4248900ef77

Actions #2

Updated by The Foreman Bot over 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/4917 added
  • Pull request deleted ()
Actions #3

Updated by Justin Sherrill over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #4

Updated by Anonymous about 9 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

Actions #5

Updated by Eric Helms about 9 years ago

  • translation missing: en.field_release changed from 14 to 23
Actions

Also available in: Atom PDF