Skip to content

Commit

Permalink
Add Zone.with_active_role
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Oct 17, 2023
1 parent 563676e commit cabf2ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/miq_schedule_worker/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def queue_work_on_each_zone(options)

def queue_work_on_each_zone_with_active_role(role_name, options)
Zone.in_my_region
.select { |z| z.role_active?(role_name) }
.with_active_role(role_name)
.each { |z| queue_work(options.merge(:zone => z.name)) }
end
end
4 changes: 4 additions & 0 deletions app/models/zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def self.default_zone
in_my_region.find_by(:name => "default")
end

def self.with_active_role(role_name)
select { |z| z.role_active?(role_name) }
end

# Zone for paused providers (no servers in it), not visible by default
def self.maintenance_zone
MiqRegion.my_region&.maintenance_zone
Expand Down

0 comments on commit cabf2ba

Please sign in to comment.