Skip to content

Commit

Permalink
Fixes #28329 - Make rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Jan 20, 2020
1 parent 0753000 commit 64146d7
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions definitions/features/dynflow_sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,35 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
confine do
server? && find_package('foreman-dynflow-sidekiq')
end
end

def services
service_names.map { |service| system_service service, instance_priority(service) }
end
def services
service_names.map { |service| system_service service, instance_priority(service) }
end

def config_files
[
'/etc/foreman/dynflow',
# Workaround until foreman-installer can deploy scaled workers
configured_services.map { |service| "/etc/systemd/system/multi-user.target.wants/#{service}.service" }
].flatten
def config_files
# Workaround until foreman-installer can deploy scaled workers
service_symlinks = configured_services.map do |service|
"/etc/systemd/system/multi-user.target.wants/#{service}.service"
end
[
'/etc/foreman/dynflow',
service_symlinks
].flatten
end

private
private

def instance_priority(instance)
# Orchestrator should be started before the workers are
instance.end_with?('@orchestrator') ? 30 : 31
end
def instance_priority(instance)
# Orchestrator should be started before the workers are
instance.end_with?('@orchestrator') ? 30 : 31
end

def service_names
configured_instances.map { |instance| "dynflow-sidekiq@#{instance}" }
end
def service_names
configured_instances.map { |instance| "dynflow-sidekiq@#{instance}" }
end

def configured_instances
Dir["/etc/foreman/dynflow/*"].map { |config| File.basename(config).gsub(/\.yml$/, '') }
end
def configured_instances
Dir['/etc/foreman/dynflow/*'].map { |config| File.basename(config).gsub(/\.yml$/, '') }
end
end

0 comments on commit 64146d7

Please sign in to comment.