app/models/katello/glue/pulp/consumer.rb in katello-2.4.5 vs app/models/katello/glue/pulp/consumer.rb in katello-3.0.0.rc1
- old
+ new
@@ -7,11 +7,11 @@
base.class_eval do
lazy_accessor :pulp_facts, :initializer => lambda { |_s| Katello.pulp_server.extensions.consumer.retrieve(uuid) }
lazy_accessor :package_profile, :initializer => lambda { |_s| fetch_package_profile }
lazy_accessor :simple_packages, :initializer => (lambda do |_s|
fetch_package_profile["profile"].
- collect { |package| Glue::Pulp::SimplePackage.new(package) }
+ collect { |package| Katello::Pulp::SimplePackage.new(package) }
end)
end
end
module InstanceMethods
@@ -31,15 +31,10 @@
def pulp_bound_yum_repositories
bindings(Runcible::Models::YumDistributor.type_id)
end
- def propagate_yum_repos
- pulp_ids = self.bound_repositories.map { |repo| repo.library_instance.try(:pulp_id) || repo.pulp_id }
- enable_repos(Runcible::Models::YumDistributor.type_id, pulp_bound_yum_repositories, pulp_ids, :notify_agent => false)
- end
-
# Binds and unbinds distributors of a certain type across repos
def enable_repos(distributor_type, existing_ids, update_ids, bind_options = {})
# calculate repoids to bind/unbind
bound_ids = existing_ids
intersection = update_ids & bound_ids
@@ -88,18 +83,10 @@
response = Katello.pulp_server.extensions.consumer.applicable_errata([self.uuid])
return [] if response.empty?
response[0]['applicability']['erratum'] || []
end
- def generate_applicability
- old_user = User.current
- User.current = User.anonymous_admin
- ForemanTasks.async_task(::Actions::Katello::System::GenerateApplicability, [self])
- ensure
- User.current = old_user
- end
-
def del_pulp_consumer
Rails.logger.debug "Deleting consumer in pulp: #{self.name}"
Katello.pulp_server.extensions.consumer.delete(self.uuid)
rescue => e
Rails.logger.error "Failed to delete pulp consumer #{self.name}: #{e}, #{e.backtrace.join("\n")}"
@@ -111,18 +98,9 @@
Rails.logger.debug "Updating consumer in pulp: #{self.name}"
Katello.pulp_server.extensions.consumer.update(self.uuid, :display_name => self.name)
rescue => e
Rails.logger.error "Failed to update pulp consumer #{self.name}: #{e}, #{e.backtrace.join("\n")}"
- raise e
- end
-
- def upload_package_profile(profile)
- Rails.logger.debug "Uploading package profile for consumer #{self.name}"
- Katello.pulp_server.extensions.consumer.upload_profile(self.uuid, 'rpm', profile)
- self.generate_applicability
- rescue => e
- Rails.logger.error "Failed to upload package profile to pulp consumer #{self.name}: #{e}, #{e.backtrace.join("\n")}"
raise e
end
def install_package(packages)
Rails.logger.debug "Scheduling package install for consumer #{self.name}"