From 1a5f14f2755629d2a63c6cef0c1729fd9cb4a219 Mon Sep 17 00:00:00 2001 From: Alex Welch Date: Wed, 25 Feb 2015 15:12:41 -0700 Subject: [PATCH] Revert "Upgrade to fleet-api 1.0.0" This reverts commit fcd02a3cdd27fe06a4b675788c3a18ad340464ea. --- Gemfile | 2 +- Gemfile.lock | 7 ++++--- app/services/service_manager.rb | 7 +------ spec/services/service_manager_spec.rb | 14 +++++--------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index 5c7f786..82085aa 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem 'puma', '2.8.2' gem 'sqlite3', '1.3.9' gem 'faraday_middleware', '0.9.0' gem 'docker-api', '1.13.0', require: 'docker' -gem 'fleet-api', '1.1.0', require: 'fleet' +gem 'fleet-api', '0.6.0', require: 'fleet' gem 'active_model_serializers', '0.9.0' gem 'octokit', '3.2.0' gem 'kmts', '2.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 3774c1a..597c691 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,8 +54,9 @@ GEM multipart-post (~> 1.2.0) faraday_middleware (0.9.0) faraday (>= 0.7.4, < 0.9) - fleet-api (1.1.0) - excon (>= 0.27.4) + fleet-api (0.6.0) + faraday (= 0.8.9) + faraday_middleware (= 0.9.0) hike (1.2.3) i18n (0.7.0) its (0.2.0) @@ -151,7 +152,7 @@ DEPENDENCIES database_cleaner (= 1.3.0) docker-api (= 1.13.0) faraday_middleware (= 0.9.0) - fleet-api (= 1.1.0) + fleet-api (= 0.6.0) its kmts (= 2.0.1) octokit (= 3.2.0) diff --git a/app/services/service_manager.rb b/app/services/service_manager.rb index ef4cebe..c1b4a75 100644 --- a/app/services/service_manager.rb +++ b/app/services/service_manager.rb @@ -58,12 +58,7 @@ def destroy end def get_state - states = fleet_client.get_unit_state(@service.unit_name) - { - load_state: states['systemdLoadState'], - active_state: states['systemdActiveState'], - sub_state: states['systemdSubState'] - } + fleet_client.status(@service.unit_name) rescue {} end diff --git a/spec/services/service_manager_spec.rb b/spec/services/service_manager_spec.rb index 1788a0e..cd50544 100644 --- a/spec/services/service_manager_spec.rb +++ b/spec/services/service_manager_spec.rb @@ -183,30 +183,26 @@ describe '#get_state' do let(:fleet_state) do - { - 'systemdLoadState' => 'a', - 'systemdActiveState' => 'b', - 'systemdSubState' => 'c' - } + { load: 'loaded', run: 'running' } end before do - allow(fake_fleet_client).to receive(:get_unit_state).and_return(fleet_state) + allow(fake_fleet_client).to receive(:status).and_return(fleet_state) end it 'retrieves service state from the fleet client' do - expect(fake_fleet_client).to receive(:get_unit_state).with(service.unit_name) + expect(fake_fleet_client).to receive(:status).with(service.unit_name) subject.get_state end it 'returns the states' do - expect(subject.get_state).to eq(load_state: 'a', active_state: 'b', sub_state: 'c') + expect(subject.get_state).to eq(load: 'loaded', run: 'running') end context 'when an error occurs while querying fleet' do before do - allow(fake_fleet_client).to receive(:get_unit_state).and_raise('boom') + allow(fake_fleet_client).to receive(:status).and_raise('boom') end it 'returns an empty hash' do