mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(MAINT) Change redis.exists calls
The mock_redis backend.exists return code has change with release 0.24. See https://github.com/sds/mock_redis/compare/v0.23.0...v0.24.0#diff-af51dcbfed678206fc95148d957ff5bf This meant that some spec tests started to fail after the new gem was released. So have changed all backend.exists to use the safer exists? method.
This commit is contained in:
parent
ab92eb366d
commit
c6ab52372a
2 changed files with 5 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ module Vmpooler
|
|||
def valid_token?(backend)
|
||||
return false unless has_token?
|
||||
|
||||
backend.exists('vmpooler__token__' + request.env['HTTP_X_AUTH_TOKEN']) ? true : false
|
||||
backend.exists?('vmpooler__token__' + request.env['HTTP_X_AUTH_TOKEN']) ? true : false
|
||||
end
|
||||
|
||||
def validate_token(backend)
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ module Vmpooler
|
|||
request_id ||= generate_request_id
|
||||
result['request_id'] = request_id
|
||||
|
||||
if backend.exists("vmpooler__odrequest__#{request_id}")
|
||||
if backend.exists?("vmpooler__odrequest__#{request_id}")
|
||||
result['message'] = "request_id '#{request_id}' has already been created"
|
||||
status 409
|
||||
metrics.increment('ondemandrequest.generate.duplicaterequests')
|
||||
|
|
@ -1164,7 +1164,7 @@ module Vmpooler
|
|||
|
||||
params[:hostname] = hostname_shorten(params[:hostname], config['domain'])
|
||||
|
||||
if backend.exists('vmpooler__vm__' + params[:hostname])
|
||||
if backend.exists?('vmpooler__vm__' + params[:hostname])
|
||||
begin
|
||||
jdata = JSON.parse(request.body.read)
|
||||
rescue StandardError
|
||||
|
|
@ -1240,7 +1240,7 @@ module Vmpooler
|
|||
|
||||
params[:hostname] = hostname_shorten(params[:hostname], config['domain'])
|
||||
|
||||
if ((params[:size].to_i > 0 )and (backend.exists('vmpooler__vm__' + params[:hostname])))
|
||||
if ((params[:size].to_i > 0 )and (backend.exists?('vmpooler__vm__' + params[:hostname])))
|
||||
result[params[:hostname]] = {}
|
||||
result[params[:hostname]]['disk'] = "+#{params[:size]}gb"
|
||||
|
||||
|
|
@ -1263,7 +1263,7 @@ module Vmpooler
|
|||
|
||||
params[:hostname] = hostname_shorten(params[:hostname], config['domain'])
|
||||
|
||||
if backend.exists('vmpooler__vm__' + params[:hostname])
|
||||
if backend.exists?('vmpooler__vm__' + params[:hostname])
|
||||
result[params[:hostname]] = {}
|
||||
|
||||
o = [('a'..'z'), ('0'..'9')].map(&:to_a).flatten
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue