From 47ebfc09a2f4f0f74ee0cd97ebdb45ac0a685fd7 Mon Sep 17 00:00:00 2001 From: Maximilian Meister Date: Thu, 15 Sep 2016 16:27:03 +0200 Subject: [PATCH] rename storages to ceph and drop unused endpoints the barclamp name fits better than the abstracted name --- .../app/controllers/api/ceph_controller.rb | 33 ++++++++++++++ .../controllers/api/storages_controller.rb | 44 ------------------- .../app/models/api/{storage.rb => ceph.rb} | 2 +- .../routes.d/{storage.routes => ceph.routes} | 3 +- 4 files changed, 35 insertions(+), 47 deletions(-) create mode 100644 crowbar_framework/app/controllers/api/ceph_controller.rb delete mode 100644 crowbar_framework/app/controllers/api/storages_controller.rb rename crowbar_framework/app/models/api/{storage.rb => ceph.rb} (96%) rename crowbar_framework/config/routes.d/{storage.routes => ceph.routes} (68%) diff --git a/crowbar_framework/app/controllers/api/ceph_controller.rb b/crowbar_framework/app/controllers/api/ceph_controller.rb new file mode 100644 index 0000000..61257ff --- /dev/null +++ b/crowbar_framework/app/controllers/api/ceph_controller.rb @@ -0,0 +1,33 @@ +# +# Copyright 2016, SUSE Linux GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +module Api + class CephController < ApiController + before_action :set_ceph + + api :GET, "/api/ceph/repocheck", "Sanity check ceph repositories" + api_version "2.0" + def repocheck + render json: @ceph.repocheck + end + + protected + + def set_ceph + @ceph = Api::Ceph.new + end + end +end diff --git a/crowbar_framework/app/controllers/api/storages_controller.rb b/crowbar_framework/app/controllers/api/storages_controller.rb deleted file mode 100644 index 759d6c3..0000000 --- a/crowbar_framework/app/controllers/api/storages_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright 2016, SUSE Linux GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class Api::StoragesController < ApiController - before_action :set_ceph - - api :GET, "/api/storages", "List all Ceph storages" - api_version "2.0" - def index - render json: [], status: :not_implemented - end - - api :GET, "/api/storages/:id", "Show a single Ceph storage" - param :id, Integer, desc: "Ceph Storage ID", required: true - api_version "2.0" - def show - render json: {}, status: :not_implemented - end - - api :GET, "/api/storages/repocheck", "Sanity check ceph repositories" - api_version "2.0" - def repocheck - render json: @ceph.repocheck - end - - protected - - def set_ceph - @ceph = Api::Storage.new - end -end diff --git a/crowbar_framework/app/models/api/storage.rb b/crowbar_framework/app/models/api/ceph.rb similarity index 96% rename from crowbar_framework/app/models/api/storage.rb rename to crowbar_framework/app/models/api/ceph.rb index acc4746..f60329b 100644 --- a/crowbar_framework/app/models/api/storage.rb +++ b/crowbar_framework/app/models/api/ceph.rb @@ -15,7 +15,7 @@ # module Api - class Storage < Tableless + class Ceph < Tableless def repocheck Api::Node.new.repocheck(addon: "ceph") end diff --git a/crowbar_framework/config/routes.d/storage.routes b/crowbar_framework/config/routes.d/ceph.routes similarity index 68% rename from crowbar_framework/config/routes.d/storage.routes rename to crowbar_framework/config/routes.d/ceph.routes index 79d8458..faab4ad 100644 --- a/crowbar_framework/config/routes.d/storage.routes +++ b/crowbar_framework/config/routes.d/ceph.routes @@ -1,7 +1,6 @@ namespace :api, constraints: ApiConstraint.new(2.0) do - resources :storages, - only: [:index, :show] do + resource :ceph, controller: :ceph, only: [] do collection do get :repocheck end