From 5739b567e9e3c002637c6f5d63206ce7a759e06c Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 3 Dec 2019 17:36:13 -0800 Subject: [PATCH] (POOLER-123) Update max_lifetime_upper_limit key This commit switches the max_lifetime_upper_limit key from being a symbol to being a string, which is what the config hash seems to contain. --- lib/vmpooler/api/v1.rb | 2 +- spec/integration/api/v1/vm_hostname_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vmpooler/api/v1.rb b/lib/vmpooler/api/v1.rb index ff473e2..2c39b45 100644 --- a/lib/vmpooler/api/v1.rb +++ b/lib/vmpooler/api/v1.rb @@ -893,7 +893,7 @@ module Vmpooler need_token! if Vmpooler::API.settings.config[:auth] # in hours, defaults to one week - max_lifetime_upper_limit = config[:max_lifetime_upper_limit] + max_lifetime_upper_limit = config['max_lifetime_upper_limit'] if max_lifetime_upper_limit max_lifetime_upper_limit = max_lifetime_upper_limit.to_i if arg.to_i >= max_lifetime_upper_limit diff --git a/spec/integration/api/v1/vm_hostname_spec.rb b/spec/integration/api/v1/vm_hostname_spec.rb index c534224..81aa6d0 100644 --- a/spec/integration/api/v1/vm_hostname_spec.rb +++ b/spec/integration/api/v1/vm_hostname_spec.rb @@ -136,7 +136,7 @@ describe Vmpooler::API::V1 do it 'does not allow a lifetime to be initially past config 168' do app.settings.set :config, - { :config => { :max_lifetime_upper_limit => 168 } } + { :config => { 'max_lifetime_upper_limit' => 168 } } create_vm('testhost') put "#{prefix}/vm/testhost", '{"lifetime":"200"}' @@ -148,7 +148,7 @@ describe Vmpooler::API::V1 do it 'does not allow a lifetime to be extended past config 168' do app.settings.set :config, - { :config => { :max_lifetime_upper_limit => 168 } } + { :config => { 'max_lifetime_upper_limit' => 168 } } create_vm('testhost') set_vm_data('testhost', "checkout", (Time.now - (69*60*60)))