foreman_rh_cloud 8.0.47 → 8.0.48

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4c84356ce25f9683795e8adb7ab42d223cef0a4ba84a4a8d9f5836cc6b80986
4
- data.tar.gz: 5f86cd9c8240aff463e25620a5e0bb47fbc15ab7318647f40918d98a85513ab8
3
+ metadata.gz: e5aaa9176ddc41ce5b0d3877b0f84d4da1e7646095d9552c0b4e2c268d6cff2b
4
+ data.tar.gz: 323a006184c5e0f989ef81ac8a010a2e493eb8cd69dc35b93ecb30a2e807dcec
5
5
  SHA512:
6
- metadata.gz: 0a7765f56a4d7e695dd253b17fd87820e8455fbe95a23450e2577125f65f20acc813723a2ff036c81d6b41c4d75d1bcf3b3aea65fb1b4042b916a68a117340a5
7
- data.tar.gz: d8e8db10a0fc49b9741d38f93e5d59917f85b7ac6fcc8e3007dcb84346ccd15c07bd644a91de1a5ea38942cbb5b27553d5a7c59315e317fe79d1b13b542151bd
6
+ metadata.gz: 4758b21705294f7bc5628878fbcf101e081f7a662426fb50501ad9909b09d7c33959ec316e3b790f248587a0ba85933782c5822c70fe9ec434ab57f070b0b0ca
7
+ data.tar.gz: e67bebbc9e8d478fa32778037d1fd4172b8633ff0c845bda2fa554c9e51cc74f94eca21ded5b9c7826a0622aa2842908e5abf70f1ffe2472fdecb6c6cf2f7d11
@@ -28,6 +28,29 @@ module Api
28
28
  }, status: :ok
29
29
  end
30
30
 
31
+ api :GET, "/organizations/:organization_id/rh_cloud/missing_hosts", N_("Grab hosts that are missing in RH Cloud")
32
+ param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
33
+ def get_hosts
34
+ organization_id = params[:organization_id]
35
+ payload = InsightsMissingHosts.where(organization_id: organization_id)
36
+
37
+ render :json => payload
38
+ end
39
+
40
+ api :POST, "/organizations/:organization_id/rh_cloud/missing_hosts", N_("Grab hosts that are missing in RH Cloud")
41
+ param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
42
+ param :search_term, String, required: true, desc: N_("Scoped search string for host removal")
43
+ def remove_hosts
44
+ organization_id = params[:organization_id]
45
+ search_term = params[:search_term]
46
+
47
+ task = ForemanTasks.async_task(ForemanInventoryUpload::Async::RemoveInsightsHostsJob, search_term, organization_id)
48
+
49
+ render json: {
50
+ task: task,
51
+ }, status: :ok
52
+ end
53
+
31
54
  api :POST, "/organizations/:organization_id/rh_cloud/inventory_sync", N_("Start inventory synchronization")
32
55
  param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
33
56
  def sync_inventory_status
@@ -0,0 +1,22 @@
1
+ module ForemanInventoryUpload
2
+ class MissingHostsController < ::ApplicationController
3
+ def index
4
+ organizations = Organization.current || User.current.my_organizations
5
+ organization_id = organizations.pluck(:id)
6
+ payload = InsightsMissingHosts.where(organization_id: organization_id)
7
+
8
+ render :json => payload
9
+ end
10
+
11
+ def remove_hosts
12
+ organization_id = params[:organization_id]
13
+ search_term = params[:search_term]
14
+
15
+ task = ForemanTasks.async_task(ForemanInventoryUpload::Async::RemoveInsightsHostsJob, search_term, organization_id)
16
+
17
+ render json: {
18
+ task: task,
19
+ }, status: :ok
20
+ end
21
+ end
22
+ end
@@ -2,4 +2,6 @@ class InsightsMissingHost < ApplicationRecord
2
2
  belongs_to :organization
3
3
 
4
4
  scoped_search on: [:name, :insights_id, :rhsm_id, :ip_address]
5
+ validates :organization_id, presence: true
6
+ validates :name, presence: true
5
7
  end