Skip to content

Commit

Permalink
Merge pull request #127 from sschneid/duplicate_ok
Browse files Browse the repository at this point in the history
(maint) Remove duplicate (nested) "ok" responses
  • Loading branch information
colinPL committed Sep 4, 2015
2 parents 3fdf168 + 906ae89 commit 0c1e89f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
10 changes: 0 additions & 10 deletions lib/vmpooler/api/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,6 @@ def need_token!
jdata.each do |key, val|
result[key] ||= {}

result[key]['ok'] = true ##

val.to_i.times do |_i|
vm = backend.spop('vmpooler__ready__' + key)

Expand All @@ -320,17 +318,13 @@ def need_token!

result[key] ||= {}

result[key]['ok'] = true ##

if result[key]['hostname']
result[key]['hostname'] = [result[key]['hostname']] unless result[key]['hostname'].is_a?(Array)
result[key]['hostname'].push(vm)
else
result[key]['hostname'] = vm
end
else
result[key]['ok'] = false ##

status 503
result['ok'] = false
end
Expand Down Expand Up @@ -373,8 +367,6 @@ def need_token!
params[:template].split('+').each do |template|
result[template] ||= {}

result[template]['ok'] = true ##

vm = backend.spop('vmpooler__ready__' + template)

unless vm.nil?
Expand Down Expand Up @@ -404,8 +396,6 @@ def need_token!
result[template]['hostname'] = vm
end
else
result[template]['ok'] = false ##

status 503
result['ok'] = false
end
Expand Down
6 changes: 0 additions & 6 deletions spec/vmpooler/api/v1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ def app()
expected = {
ok: true,
pool1: {
ok: true,
hostname: 'abcdefghijklmnop'
}
}
Expand All @@ -229,11 +228,9 @@ def app()
expected = {
ok: true,
pool1: {
ok: true,
hostname: 'abcdefghijklmnop'
},
pool2: {
ok: true,
hostname: 'qrstuvwxyz012345'
}
}
Expand All @@ -256,7 +253,6 @@ def app()
expected = {
ok: true,
pool1: {
ok: true,
hostname: 'abcdefghijklmnop'
}
}
Expand All @@ -280,7 +276,6 @@ def app()
expected = {
ok: true,
pool1: {
ok: true,
hostname: 'abcdefghijklmnop'
}
}
Expand All @@ -298,7 +293,6 @@ def app()
expected = {
ok: true,
pool1: {
ok: true,
hostname: 'abcdefghijklmnop'
}
}
Expand Down

0 comments on commit 0c1e89f

Please sign in to comment.