Class: Katello::Pulp::ConsumerGroup

Inherits:
Object
  • Object
show all
Defined in:
app/services/katello/pulp/consumer_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#consumer_idsObject

Returns the value of attribute consumer_ids.



4
5
6
# File 'app/services/katello/pulp/consumer_group.rb', line 4

def consumer_ids
  @consumer_ids
end

#pulp_idObject

Returns the value of attribute pulp_id.



4
5
6
# File 'app/services/katello/pulp/consumer_group.rb', line 4

def pulp_id
  @pulp_id
end

Instance Method Details

#del_pulp_consumer_groupObject



14
15
16
17
18
19
20
# File 'app/services/katello/pulp/consumer_group.rb', line 14

def del_pulp_consumer_group
  Rails.logger.debug "deleting pulp consumer group '#{self.pulp_id}'"
  Katello.pulp_server.extensions.consumer_group.delete(self.pulp_id)
rescue => e
  Rails.logger.error "Failed to delete pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#install_consumer_errata(errata_ids) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
# File 'app/services/katello/pulp/consumer_group.rb', line 82

def install_consumer_errata(errata_ids)
  Rails.logger.debug "Scheduling errata install for consumer group #{self.pulp_id}"

  Katello.pulp_server.extensions.consumer_group.install_content(self.pulp_id,
                                                                  'erratum',
                                                                  errata_ids,
                                                                  'importkeys' => true)
rescue => e
  Rails.logger.error "Failed to schedule errata install for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#install_package(packages) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/katello/pulp/consumer_group.rb', line 22

def install_package(packages)
  Rails.logger.debug "Scheduling package install for consumer group #{self.pulp_id}"

  Katello.pulp_server.extensions.consumer_group.install_content(self.pulp_id,
                                                                  'rpm',
                                                                  packages,
                                                                  'importkeys' => true)
rescue => e
  Rails.logger.error "Failed to schedule package install for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#install_package_group(groups) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'app/services/katello/pulp/consumer_group.rb', line 59

def install_package_group(groups)
  Rails.logger.debug "Scheduling package group install for consumer group #{self.pulp_id}"

  Katello.pulp_server.extensions.consumer_group.install_content(self.pulp_id,
                                                                  'package_group',
                                                                  groups,
                                                                  'importkeys' => true)
rescue => e
  Rails.logger.error "Failed to schedule package group install for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#set_pulp_consumer_groupObject



6
7
8
9
10
11
12
# File 'app/services/katello/pulp/consumer_group.rb', line 6

def set_pulp_consumer_group
  Rails.logger.debug "creating pulp consumer group '#{self.pulp_id}'"
  Katello.pulp_server.extensions.consumer_group.create(self.pulp_id, :consumer_ids => (consumer_ids || []))
rescue => e
  Rails.logger.error "Failed to create pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#uninstall_package(packages) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'app/services/katello/pulp/consumer_group.rb', line 34

def uninstall_package(packages)
  Rails.logger.debug "Scheduling package uninstall for consumer group #{self.pulp_id}"

  Katello.pulp_server.extensions.consumer_group.uninstall_content(self.pulp_id,
                                                                    'rpm',
                                                                    packages)
rescue => e
  Rails.logger.error "Failed to schedule package uninstall for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#uninstall_package_group(groups) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'app/services/katello/pulp/consumer_group.rb', line 71

def uninstall_package_group(groups)
  Rails.logger.debug "Scheduling package group uninstall for consumer group #{self.pulp_id}"

  Katello.pulp_server.extensions.consumer_group.uninstall_content(self.pulp_id,
                                                                    'package_group',
                                                                    groups)
rescue => e
  Rails.logger.error "Failed to schedule package group uninstall for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end

#update_package(packages) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/services/katello/pulp/consumer_group.rb', line 45

def update_package(packages)
  Rails.logger.debug "Scheduling package update for consumer group #{self.pulp_id}"

  options = {"importkeys" => true}
  options[:all] = true if packages.blank?
  Katello.pulp_server.extensions.consumer_group.update_content(self.pulp_id,
                                                                 'rpm',
                                                                 packages,
                                                                 options)
rescue => e
  Rails.logger.error "Failed to schedule package update for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
  raise e
end