Class: Katello::BulkActions
- Inherits:
-
Object
- Object
- Katello::BulkActions
- Defined in:
- app/lib/katello/bulk_actions.rb
Instance Attribute Summary collapse
-
#consumer_ids ⇒ Object
Returns the value of attribute consumer_ids.
Instance Method Summary collapse
-
#initialize(hosts) ⇒ BulkActions
constructor
A new instance of BulkActions.
- #install_package_groups(groups) ⇒ Object
- #install_packages(packages) ⇒ Object
- #uninstall_package_groups(groups) ⇒ Object
- #uninstall_packages(packages) ⇒ Object
- #update_package_groups(groups) ⇒ Object
- #update_packages(packages = nil) ⇒ Object
Constructor Details
#initialize(hosts) ⇒ BulkActions
Returns a new instance of BulkActions.
5 6 7 |
# File 'app/lib/katello/bulk_actions.rb', line 5 def initialize(hosts) @consumer_ids = hosts.map { |host| host.content_facet.try(:uuid) }.compact end |
Instance Attribute Details
#consumer_ids ⇒ Object
Returns the value of attribute consumer_ids.
3 4 5 |
# File 'app/lib/katello/bulk_actions.rb', line 3 def consumer_ids @consumer_ids end |
Instance Method Details
#install_package_groups(groups) ⇒ Object
31 32 33 34 35 36 |
# File 'app/lib/katello/bulk_actions.rb', line 31 def install_package_groups(groups) fail Errors::EmptyBulkActionException if self.consumer_ids.empty? perform_bulk_action do |consumer_group| consumer_group.install_package_group(groups) end end |
#install_packages(packages) ⇒ Object
9 10 11 12 13 14 |
# File 'app/lib/katello/bulk_actions.rb', line 9 def install_packages(packages) fail Errors::EmptyBulkActionException if self.consumer_ids.empty? perform_bulk_action do |consumer_group| consumer_group.install_package(packages) end end |
#uninstall_package_groups(groups) ⇒ Object
45 46 47 48 49 50 |
# File 'app/lib/katello/bulk_actions.rb', line 45 def uninstall_package_groups(groups) fail Errors::EmptyBulkActionException if self.consumer_ids.empty? perform_bulk_action do |consumer_group| consumer_group.uninstall_package_group(groups) end end |
#uninstall_packages(packages) ⇒ Object
16 17 18 19 20 21 |
# File 'app/lib/katello/bulk_actions.rb', line 16 def uninstall_packages(packages) fail Errors::EmptyBulkActionException if self.consumer_ids.empty? perform_bulk_action do |consumer_group| consumer_group.uninstall_package(packages) end end |
#update_package_groups(groups) ⇒ Object
38 39 40 41 42 43 |
# File 'app/lib/katello/bulk_actions.rb', line 38 def update_package_groups(groups) fail Errors::EmptyBulkActionException if self.consumer_ids.empty? perform_bulk_action do |consumer_group| consumer_group.install_package_group(groups) end end |
#update_packages(packages = nil) ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/lib/katello/bulk_actions.rb', line 23 def update_packages(packages = nil) # if no packages are provided, a full system update will be performed (e.g ''yum update' equivalent) fail Errors::EmptyBulkActionException if self.consumer_ids.empty? perform_bulk_action do |consumer_group| consumer_group.update_package(packages) end end |