diff --git a/lib/vmpooler/api/v1.rb b/lib/vmpooler/api/v1.rb index 4b0d25e..be8fc3f 100644 --- a/lib/vmpooler/api/v1.rb +++ b/lib/vmpooler/api/v1.rb @@ -855,6 +855,21 @@ module Vmpooler JSON.pretty_generate(result) end + + get "#{api_prefix}/config/?" do + content_type :json + result = { 'ok' => false } + status 404 + + if pools + result = { + 'ok' => true, + 'pool configuration' => pools + } + status 200 + end + JSON.pretty_generate(result) + end end end end diff --git a/spec/integration/api/v1/config_spec.rb b/spec/integration/api/v1/config_spec.rb index 3cab23a..1e3863a 100644 --- a/spec/integration/api/v1/config_spec.rb +++ b/spec/integration/api/v1/config_spec.rb @@ -156,5 +156,12 @@ describe Vmpooler::API::V1 do expect(last_response.body).to eq(JSON.pretty_generate(expected)) end end + + describe 'GET /config' do + it 'returns pool configuration when set' do + get "#{prefix}/config" + expect_json(ok = true, http = 200) + end + end end end