default process concurrency is 0 when concurrency options specified, otherwise default concurrency is 1

This commit is contained in:
Michael Dwan
2011-11-07 13:10:18 -07:00
parent c6a410b664
commit 33aa1efc90
6 changed files with 68 additions and 23 deletions
+4 -1
View File
@@ -5,7 +5,10 @@ class Foreman::Utils
def self.parse_concurrency(concurrency)
begin
pairs = concurrency.to_s.gsub(/\s/, "").split(",")
pairs.inject(Hash.new(1)) do |hash, pair|
default = concurrency.nil? ? 1 : 0
pairs.inject(Hash.new(default)) do |hash, pair|
process, amount = pair.split("=")
hash.update(process => amount.to_i)
end