diff --git a/app/controllers/katello/api/v2/sync_controller.rb b/app/controllers/katello/api/v2/sync_controller.rb index b43d502264f..cf324a004f6 100644 --- a/app/controllers/katello/api/v2/sync_controller.rb +++ b/app/controllers/katello/api/v2/sync_controller.rb @@ -4,7 +4,6 @@ class Api::V2::SyncController < Api::V2::ApiController before_action :find_object, :only => [:index] before_action :ensure_library, :only => [:index] - api :GET, "/organizations/:organization_id/products/:product_id/sync", N_("Get status of repo synchronisation for given product") api :GET, "/repositories/:repository_id/sync", N_("Get status of synchronisation for given repository") def index respond_for_async(:resource => @obj.sync_status) diff --git a/app/models/katello/repository.rb b/app/models/katello/repository.rb index 1fbf499ec44..ccd76734ba6 100644 --- a/app/models/katello/repository.rb +++ b/app/models/katello/repository.rb @@ -947,6 +947,10 @@ def in_content_view?(content_view) content_view.repositories.include? self end + def sync_status + return latest_dynflow_sync + end + protected def unit_type_for_removal(type_class = nil) diff --git a/app/views/katello/api/v2/sync/index.json.rabl b/app/views/katello/api/v2/sync/index.json.rabl deleted file mode 100644 index 4296aca962b..00000000000 --- a/app/views/katello/api/v2/sync/index.json.rabl +++ /dev/null @@ -1 +0,0 @@ -extends 'katello/api/v2/common/async' diff --git a/config/routes/api/v2.rb b/config/routes/api/v2.rb index 67ad91dbc2c..9ec5312b4e0 100644 --- a/config/routes/api/v2.rb +++ b/config/routes/api/v2.rb @@ -484,6 +484,7 @@ class ActionDispatch::Routing::Mapper end api_resources :sync_plans, :only => [:index, :show, :update, :destroy] do + api_resources :products, :only => [:index] get :auto_complete_search, :on => :collection put :sync end diff --git a/test/controllers/api/v2/sync_controller_test.rb b/test/controllers/api/v2/sync_controller_test.rb index ddc4b6e8b98..615a7cb11fc 100644 --- a/test/controllers/api/v2/sync_controller_test.rb +++ b/test/controllers/api/v2/sync_controller_test.rb @@ -22,7 +22,7 @@ def setup end def test_index - Product.any_instance.expects(:sync_status).returns([{}]) + Product.any_instance.expects(:sync_status).returns([]) get :index, params: { :product_id => @product.cp_id, :organization_id => @organization.id } assert_response :success