topological_inventory-providers-common 1.0.6 → 1.0.11

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: aafb37efd571f568a887c8c11b31bc87a6141a556ae06b970bf4acfcbdea3d08
4
- data.tar.gz: 2d1024891611a96df454a56819a5f6f921e195605d3867ca05c595c336f9a699
3
+ metadata.gz: d2593d36aee528450e29282d903ddcc2d74c6593e9579c69ec2a510c9fcc15ab
4
+ data.tar.gz: 47b0675fcab7eaab9c2b3899837b597295a0e7c6c737f1ce39ca49c4a7968cc5
5
5
  SHA512:
6
- metadata.gz: daff9b2dc2388297dba831994c74e048d608256c9fd3aadc06446c16abfa4143f5fcbed2e6dd3eff66cb6fbb9e6637abe8f47c1eda452b99d5557c9424c20849
7
- data.tar.gz: ece193799a908c7ca96aee73de80e9a6dc7cf17346b549ebf2d802cd3ed42b11aec7b46837a4078c1569fe608ef0241f7ac64a7daf43bd2905df1d53e21c8e01
6
+ metadata.gz: 03f98f6334065f62a4462e30633c6a6d852552f49414be2293b4864d3971372ce66ab52d47e23b4a7ad2f8c0277d9d2352f38519e2621a80f6c9b2b011a7cdd4
7
+ data.tar.gz: b801478114b42cc897329a12eca067cc707306f488ed7e84eddf7eddd91c0098dbbdf5d6d3fcb116734b39cd08d25dcabdd6731b60057fc900ca2c39a5008bd8
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.0.11]
8
+ Make Collector Poll Time a parameter so we can tweak the collection interval #51
9
+
10
+ ## [1.0.10]
11
+ Add HealthCheck class for operations workers #48
12
+ Set the LOG_LEVEL if present #50
13
+
14
+ ## [1.0.9]
15
+ Added refresh-type to save and sweep inventory #45
16
+
17
+ ## [1.0.8] - 2020-08-12
18
+ Add => to error messages that rubocop missed #44
19
+
20
+ ## [1.0.7] - 2020-07-27
21
+ Update operations/source model for receptor-enabled availability checks #36
22
+ Add check for Application subresource under a Source during Availability check #40
23
+ Remove infinite loop in error messages #43
24
+
7
25
  ## [1.0.6] - 2020-07-06
8
26
  Add some error handling if Sources does not have endpoints/authentications for a source #38
9
27
  Specs for Collector #35
@@ -38,7 +56,12 @@ manageiq-loggers to >= 0.4.2 #20
38
56
  ## [1.0.0] - 2020-03-19
39
57
  ### Initial release to rubygems.org
40
58
 
41
- [Unreleased]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.6...HEAD
59
+ [Unreleased]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.11...HEAD
60
+ [1.0.11]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.10...v1.0.11
61
+ [1.0.10]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.9...v1.0.10
62
+ [1.0.9]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.8...v1.0.9
63
+ [1.0.8]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.7...v1.0.8
64
+ [1.0.7]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.6...v1.0.7
42
65
  [1.0.6]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.5...v1.0.6
43
66
  [1.0.5]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.4...v1.0.5
44
67
  [1.0.4]: https://github.com/RedHatInsights/topological_inventory-providers-common/compare/v1.0.3...v1.0.4
@@ -2,6 +2,7 @@ require "topological_inventory/providers/common/version"
2
2
  require "topological_inventory/providers/common/logging"
3
3
  require "topological_inventory/providers/common/operations/processor"
4
4
  require "topological_inventory/providers/common/operations/endpoint_client"
5
+ require "topological_inventory/providers/common/operations/health_check"
5
6
  require "topological_inventory/providers/common/collectors_pool"
6
7
  require "topological_inventory/providers/common/collector"
7
8
 
@@ -104,7 +104,8 @@ module TopologicalInventory
104
104
  refresh_state_uuid = nil,
105
105
  refresh_state_part_uuid = nil,
106
106
  refresh_state_part_collected_at = nil,
107
- refresh_state_part_sent_at = Time.now.utc)
107
+ refresh_state_part_sent_at = Time.now.utc,
108
+ refresh_type = default_refresh_type)
108
109
  return 0 if collections.empty?
109
110
 
110
111
  SaveInventory::Saver.new(:client => ingress_api_client, :logger => logger).save(
@@ -116,7 +117,8 @@ module TopologicalInventory
116
117
  :refresh_state_uuid => refresh_state_uuid,
117
118
  :refresh_state_part_uuid => refresh_state_part_uuid,
118
119
  :refresh_state_part_collected_at => refresh_state_part_collected_at,
119
- :refresh_state_part_sent_at => refresh_state_part_sent_at
120
+ :refresh_state_part_sent_at => refresh_state_part_sent_at,
121
+ :refresh_type => refresh_type
120
122
  )
121
123
  )
122
124
  rescue => e
@@ -134,7 +136,8 @@ module TopologicalInventory
134
136
  total_parts,
135
137
  sweep_scope,
136
138
  refresh_state_started_at = nil,
137
- refresh_state_sent_at = Time.now.utc)
139
+ refresh_state_sent_at = Time.now.utc,
140
+ refresh_type = default_refresh_type)
138
141
  return if !total_parts || sweep_scope.empty?
139
142
 
140
143
  SaveInventory::Saver.new(:client => ingress_api_client, :logger => logger).save(
@@ -147,7 +150,8 @@ module TopologicalInventory
147
150
  :total_parts => total_parts,
148
151
  :sweep_scope => sweep_scope,
149
152
  :refresh_state_started_at => refresh_state_started_at,
150
- :refresh_state_sent_at => refresh_state_sent_at
153
+ :refresh_state_sent_at => refresh_state_sent_at,
154
+ :refresh_type => refresh_type
151
155
  )
152
156
  )
153
157
  rescue => e
@@ -165,6 +169,10 @@ module TopologicalInventory
165
169
  "Default"
166
170
  end
167
171
 
172
+ def default_refresh_type
173
+ 'full-refresh'
174
+ end
175
+
168
176
  def ingress_api_client
169
177
  TopologicalInventoryIngressApiClient::DefaultApi.new
170
178
  end
@@ -5,8 +5,9 @@ module TopologicalInventory
5
5
  module Common
6
6
  class CollectorsPool
7
7
  SECRET_FILENAME = "credentials".freeze
8
+ COLLECTOR_POLL_TIME = ENV['COLLECTOR_POLL_TIME']&.to_i || 300
8
9
 
9
- def initialize(config_name, metrics, collector_poll_time: 60, thread_pool_size: 2)
10
+ def initialize(config_name, metrics, collector_poll_time: COLLECTOR_POLL_TIME, thread_pool_size: 2)
10
11
  self.config_name = config_name
11
12
  self.collector_status = Concurrent::Map.new
12
13
  self.metrics = metrics
@@ -33,7 +33,10 @@ module TopologicalInventory
33
33
 
34
34
  class Logger < ManageIQ::Loggers::CloudWatch
35
35
  def self.new(*args)
36
- super.tap { |logger| logger.extend(TopologicalInventory::Providers::Common::LoggingFunctions) }
36
+ super.tap do |logger|
37
+ logger.extend(TopologicalInventory::Providers::Common::LoggingFunctions)
38
+ logger.level = ENV['LOG_LEVEL'] if ENV['LOG_LEVEL']
39
+ end
37
40
  end
38
41
  end
39
42
 
@@ -0,0 +1,15 @@
1
+ module TopologicalInventory
2
+ module Providers
3
+ module Common
4
+ module Operations
5
+ class HealthCheck
6
+ HEARTBEAT_FILE = '/tmp/healthy'.freeze
7
+
8
+ def self.touch_file
9
+ FileUtils.touch(HEARTBEAT_FILE)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -12,18 +12,20 @@ module TopologicalInventory
12
12
  STATUS_AVAILABLE, STATUS_UNAVAILABLE = %w[available unavailable].freeze
13
13
 
14
14
  ERROR_MESSAGES = {
15
- :authentication_not_found => "Authentication not found in Sources API",
16
- :endpoint_not_found => "Endpoint not found in Sources API",
15
+ :authentication_not_found => "Authentication not found in Sources API",
16
+ :endpoint_or_application_not_found => "Endpoint or Application not found in Sources API",
17
17
  }.freeze
18
18
 
19
19
  LAST_CHECKED_AT_THRESHOLD = 5.minutes.freeze
20
+ AUTH_NOT_NECESSARY = "n/a".freeze
20
21
 
21
- attr_accessor :params, :request_context, :source_id
22
+ attr_accessor :params, :request_context, :source_id, :account_number
22
23
 
23
24
  def initialize(params = {}, request_context = nil)
24
25
  self.params = params
25
26
  self.request_context = request_context
26
27
  self.source_id = params['source_id']
28
+ self.account_number = params['external_tenant']
27
29
  end
28
30
 
29
31
  def availability_check
@@ -33,7 +35,7 @@ module TopologicalInventory
33
35
 
34
36
  status, error_message = connection_status
35
37
 
36
- update_source_and_endpoint(status, error_message)
38
+ update_source_and_subresources(status, error_message)
37
39
 
38
40
  logger.availability_check("Completed: Source #{source_id} is #{status}")
39
41
  end
@@ -57,32 +59,57 @@ module TopologicalInventory
57
59
  end
58
60
 
59
61
  def checked_recently?
60
- return false if endpoint.nil?
62
+ checked_recently = if endpoint.present?
63
+ endpoint.last_checked_at.present? && endpoint.last_checked_at >= LAST_CHECKED_AT_THRESHOLD.ago
64
+ elsif application.present?
65
+ application.last_checked_at.present? && application.last_checked_at >= LAST_CHECKED_AT_THRESHOLD.ago
66
+ end
61
67
 
62
- checked_recently = endpoint.last_checked_at.present? && endpoint.last_checked_at >= LAST_CHECKED_AT_THRESHOLD.ago
63
- logger.availability_check("Skipping, last check at #{endpoint.last_checked_at} [Source ID: #{source_id}] ") if checked_recently
68
+ logger.availability_check("Skipping, last check at #{endpoint.last_checked_at || application.last_checked_at} [Source ID: #{source_id}] ") if checked_recently
64
69
 
65
70
  checked_recently
66
71
  end
67
72
 
68
73
  def connection_status
69
- return [STATUS_UNAVAILABLE, ERROR_MESSAGES[:endpoint_not_found]] unless endpoint
70
- return [STATUS_UNAVAILABLE, ERROR_MESSAGES[:authentication_not_found]] unless authentication
74
+ # we need either an endpoint or application to check the source.
75
+ return [STATUS_UNAVAILABLE, ERROR_MESSAGES[:endpoint_or_application_not_found]] unless endpoint || application
71
76
 
72
77
  check_time
78
+ if endpoint
79
+ endpoint_connection_check
80
+ elsif application
81
+ application_connection_check
82
+ end
83
+ end
84
+
85
+ def endpoint_connection_check
86
+ return [STATUS_UNAVAILABLE, ERROR_MESSAGES[:authentication_not_found]] unless authentication
87
+
88
+ # call down into the operations pod implementation of `Source#connection_check`
73
89
  connection_check
74
90
  end
75
91
 
92
+ def application_connection_check
93
+ case application.availability_status
94
+ when "available"
95
+ [STATUS_AVAILABLE, nil]
96
+ when "unavailable"
97
+ [STATUS_UNAVAILABLE, "Application id #{application.id} unavailable"]
98
+ end
99
+ end
100
+
76
101
  # @return [Array<String, String|nil] - STATUS_[UN]AVAILABLE, error message
77
102
  def connection_check
78
103
  raise NotImplementedError, "#{__method__} must be implemented in a subclass"
79
104
  end
80
105
 
81
- def update_source_and_endpoint(status, error_message = nil)
106
+ def update_source_and_subresources(status, error_message = nil)
82
107
  logger.availability_check("Updating source [#{source_id}] status [#{status}] message [#{error_message}]")
83
108
 
84
109
  update_source(status)
85
- update_endpoint(status, error_message)
110
+
111
+ update_endpoint(status, error_message) if endpoint
112
+ update_application(status) if application
86
113
  end
87
114
 
88
115
  def update_source(status)
@@ -114,18 +141,39 @@ module TopologicalInventory
114
141
  logger.availability_check("Failed to update Endpoint(ID: #{endpoint.id}) - #{e.message}", :error)
115
142
  end
116
143
 
144
+ def update_application(status)
145
+ application_update = ::SourcesApiClient::Application.new
146
+ application_update.last_checked_at = check_time
147
+ application_update.last_available_at = check_time if status == STATUS_AVAILABLE
148
+
149
+ api_client.update_application(application.id, application_update)
150
+ rescue ::SourcesApiClient::ApiError => e
151
+ logger.availability_check("Failed to update Application id: #{application.id} - #{e.message}", :error)
152
+ end
153
+
117
154
  def endpoint
118
155
  @endpoint ||= api_client.fetch_default_endpoint(source_id)
119
- rescue StandardError => e
120
- logger.availability_check("Failed to fetch Endpoint for Source #{source_id}, Endpoint #{endpoint}: #{e.message}", :error)
121
- return
156
+ rescue => e
157
+ logger.availability_check("Failed to fetch Endpoint for Source #{source_id}: #{e.message}", :error)
158
+ nil
122
159
  end
123
160
 
124
161
  def authentication
125
- @authentication ||= api_client.fetch_authentication(source_id, endpoint)
126
- rescue StandardError => e
127
- logger.availability_check("Failed to fetch Authentication for Source #{source_id}, Endpoint #{endpoint}: #{e.message}", :error)
128
- return
162
+ @authentication ||= if endpoint.receptor_node.present?
163
+ AUTH_NOT_NECESSARY
164
+ else
165
+ api_client.fetch_authentication(source_id, endpoint)
166
+ end
167
+ rescue => e
168
+ logger.availability_check("Failed to fetch Authentication for Source #{source_id}: #{e.message}", :error)
169
+ nil
170
+ end
171
+
172
+ def application
173
+ @application ||= api_client.fetch_application(source_id)
174
+ rescue => e
175
+ logger.availability_check("Failed to fetch Application for Source #{source_id}: #{e.message}", :error)
176
+ nil
129
177
  end
130
178
 
131
179
  def check_time
@@ -133,7 +181,7 @@ module TopologicalInventory
133
181
  end
134
182
 
135
183
  def identity
136
- @identity ||= {"x-rh-identity" => Base64.strict_encode64({"identity" => {"account_number" => params["external_tenant"], "user" => {"is_org_admin" => true}}}.to_json)}
184
+ @identity ||= {"x-rh-identity" => Base64.strict_encode64({"identity" => {"account_number" => account_number, "user" => {"is_org_admin" => true}}}.to_json)}
137
185
  end
138
186
 
139
187
  def api_client
@@ -5,7 +5,7 @@ module TopologicalInventory
5
5
  module Common
6
6
  module Operations
7
7
  class SourcesApiClient < ::SourcesApiClient::ApiClient
8
- delegate :update_source, :update_endpoint, :to => :api
8
+ delegate :update_source, :update_endpoint, :update_application, :to => :api
9
9
 
10
10
  INTERNAL_API_PATH = '//internal/v1.0'.freeze
11
11
 
@@ -25,6 +25,11 @@ module TopologicalInventory
25
25
  endpoints.find(&:default)
26
26
  end
27
27
 
28
+ def fetch_application(source_id)
29
+ applications = api.list_source_applications(source_id)&.data || []
30
+ applications.first
31
+ end
32
+
28
33
  def fetch_authentication(source_id, default_endpoint = nil, authtype = nil)
29
34
  endpoint = default_endpoint || fetch_default_endpoint(source_id)
30
35
  return if endpoint.nil?
@@ -1,7 +1,7 @@
1
1
  module TopologicalInventory
2
2
  module Providers
3
3
  module Common
4
- VERSION = "1.0.6"
4
+ VERSION = "1.0.11"
5
5
  end
6
6
  end
7
7
  end
@@ -11,6 +11,7 @@ RSpec.shared_examples "availability_check" do
11
11
  let(:headers) { {'Content-Type' => 'application/json'}.merge(identity) }
12
12
  let(:source_id) { '123' }
13
13
  let(:endpoint_id) { '234' }
14
+ let(:application_id) { '345' }
14
15
  let(:authentication_id) { '345' }
15
16
  let(:payload) do
16
17
  {
@@ -26,6 +27,8 @@ RSpec.shared_examples "availability_check" do
26
27
  let(:list_endpoint_authentications_response) { "{\"data\":[{\"authtype\":\"username_password\",\"id\":\"#{authentication_id}\",\"resource_id\":\"#{endpoint_id}\",\"resource_type\":\"Endpoint\",\"username\":\"admin\",\"tenant\":\"#{external_tenant}\"}]}" }
27
28
  let(:list_endpoint_authentications_response_empty) { "{\"data\":[]}" }
28
29
  let(:internal_api_authentication_response) { "{\"authtype\":\"username_password\",\"id\":\"#{authentication_id}\",\"resource_id\":\"#{endpoint_id}\",\"resource_type\":\"Endpoint\",\"username\":\"admin\",\"tenant\":\"#{external_tenant}\",\"password\":\"xxx\"}" }
30
+ let(:list_applications_response) { {:data => [{:id => "345", :availability_status => "available"}]}.to_json }
31
+ let(:list_applications_unavailable_response) { {:data => [{:id => "345", :availability_status => "unavailable"}]}.to_json }
29
32
 
30
33
  subject { described_class.new(payload["params"]) }
31
34
 
@@ -39,6 +42,7 @@ RSpec.shared_examples "availability_check" do
39
42
  stub_get(:endpoint, list_endpoints_response)
40
43
  stub_get(:authentication, list_endpoint_authentications_response)
41
44
  stub_get(:password, internal_api_authentication_response)
45
+ stub_not_found(:application)
42
46
 
43
47
  # PATCH
44
48
  source_patch_body = {'availability_status' => described_class::STATUS_AVAILABLE, 'last_available_at' => subject.send(:check_time), 'last_checked_at' => subject.send(:check_time)}.to_json
@@ -61,6 +65,7 @@ RSpec.shared_examples "availability_check" do
61
65
  stub_get(:endpoint, list_endpoints_response)
62
66
  stub_get(:authentication, list_endpoint_authentications_response)
63
67
  stub_get(:password, internal_api_authentication_response)
68
+ stub_not_found(:application)
64
69
 
65
70
  # PATCH
66
71
  connection_error_message = "Some connection error"
@@ -81,7 +86,8 @@ RSpec.shared_examples "availability_check" do
81
86
 
82
87
  it "updates only Source to 'unavailable' status if Endpoint not found" do
83
88
  # GET
84
- stub_get(:endpoint, '')
89
+ stub_not_found(:endpoint)
90
+ stub_not_found(:application)
85
91
 
86
92
  # PATCH
87
93
  source_patch_body = {'availability_status' => described_class::STATUS_UNAVAILABLE, 'last_checked_at' => subject.send(:check_time)}.to_json
@@ -100,6 +106,7 @@ RSpec.shared_examples "availability_check" do
100
106
  # GET
101
107
  stub_get(:endpoint, list_endpoints_response)
102
108
  stub_get(:authentication, list_endpoint_authentications_response_empty)
109
+ stub_not_found(:application)
103
110
 
104
111
  # PATCH
105
112
  source_patch_body = {'availability_status' => described_class::STATUS_UNAVAILABLE, 'last_checked_at' => subject.send(:check_time)}.to_json
@@ -131,6 +138,49 @@ RSpec.shared_examples "availability_check" do
131
138
  end
132
139
  end
133
140
 
141
+ context "when there is an application" do
142
+ context "when it is available" do
143
+ it "updates the availability status to available" do
144
+ # GET
145
+ stub_not_found(:endpoint)
146
+ stub_get(:application, list_applications_response)
147
+ # PATCH
148
+ application_patch_body = {'last_available_at' => subject.send(:check_time), 'last_checked_at' => subject.send(:check_time)}.to_json
149
+ source_patch_body = {'availability_status' => described_class::STATUS_AVAILABLE, 'last_available_at' => subject.send(:check_time), 'last_checked_at' => subject.send(:check_time)}.to_json
150
+
151
+ stub_patch(:source, source_patch_body)
152
+ stub_patch(:application, application_patch_body)
153
+
154
+ # Check
155
+ expect(subject).not_to receive(:connection_check)
156
+ subject.availability_check
157
+
158
+ assert_patch(:source, source_patch_body)
159
+ assert_patch(:application, application_patch_body)
160
+ end
161
+ end
162
+
163
+ context "when it is unavailable" do
164
+ it "updates the availability status to unavailable" do
165
+ # GET
166
+ stub_not_found(:endpoint)
167
+ stub_get(:application, list_applications_unavailable_response)
168
+ # PATCH
169
+ application_patch_body = {'last_checked_at' => subject.send(:check_time)}.to_json
170
+ source_patch_body = {'availability_status' => described_class::STATUS_UNAVAILABLE, 'last_checked_at' => subject.send(:check_time)}.to_json
171
+
172
+ stub_patch(:source, source_patch_body)
173
+ stub_patch(:application, application_patch_body)
174
+
175
+ # Check
176
+ expect(subject).not_to receive(:connection_check)
177
+ subject.availability_check
178
+
179
+ assert_patch(:source, source_patch_body)
180
+ assert_patch(:application, application_patch_body)
181
+ end
182
+ end
183
+ end
134
184
 
135
185
  def stub_get(object_type, response)
136
186
  case object_type
@@ -146,6 +196,31 @@ RSpec.shared_examples "availability_check" do
146
196
  stub_request(:get, "#{host_url}#{sources_internal_api_path}/authentications/#{authentication_id}?expose_encrypted_attribute%5B%5D=password")
147
197
  .with(:headers => headers)
148
198
  .to_return(:status => 200, :body => response, :headers => {})
199
+ when :application
200
+ stub_request(:get, "#{sources_api_url}/sources/#{source_id}/applications")
201
+ .with(:headers => headers)
202
+ .to_return(:status => 200, :body => response, :headers => {})
203
+ end
204
+ end
205
+
206
+ def stub_not_found(object_type)
207
+ case object_type
208
+ when :endpoint
209
+ stub_request(:get, "#{sources_api_url}/sources/#{source_id}/endpoints")
210
+ .with(:headers => headers)
211
+ .to_return(:status => 404, :body => {}.to_json, :headers => {})
212
+ when :authentication
213
+ stub_request(:get, "#{sources_api_url}/endpoints/#{endpoint_id}/authentications")
214
+ .with(:headers => headers)
215
+ .to_return(:status => 404, :body => {}.to_json, :headers => {})
216
+ when :password
217
+ stub_request(:get, "#{host_url}#{sources_internal_api_path}/authentications/#{authentication_id}?expose_encrypted_attribute%5B%5D=password")
218
+ .with(:headers => headers)
219
+ .to_return(:status => 404, :body => {}.to_json, :headers => {})
220
+ when :application
221
+ stub_request(:get, "#{sources_api_url}/sources/#{source_id}/applications")
222
+ .with(:headers => headers)
223
+ .to_return(:status => 404, :body => {}.to_json, :headers => {})
149
224
  end
150
225
  end
151
226
 
@@ -159,6 +234,10 @@ RSpec.shared_examples "availability_check" do
159
234
  stub_request(:patch, "#{sources_api_url}/endpoints/#{endpoint_id}")
160
235
  .with(:body => data, :headers => headers)
161
236
  .to_return(:status => 200, :body => "", :headers => {})
237
+ when :application
238
+ stub_request(:patch, "#{sources_api_url}/applications/#{application_id}")
239
+ .with(:body => data, :headers => headers)
240
+ .to_return(:status => 200, :body => "", :headers => {})
162
241
  end
163
242
  end
164
243
 
@@ -166,10 +245,13 @@ RSpec.shared_examples "availability_check" do
166
245
  case object_type
167
246
  when :source
168
247
  expect(WebMock).to have_requested(:patch, "#{sources_api_url}/sources/#{source_id}")
169
- .with(:body => data, :headers => headers).once
248
+ .with(:body => data, :headers => headers).once
170
249
  when :endpoint
171
250
  expect(WebMock).to have_requested(:patch, "#{sources_api_url}/endpoints/#{endpoint_id}")
172
- .with(:body => data, :headers => headers).once
251
+ .with(:body => data, :headers => headers).once
252
+ when :application
253
+ expect(WebMock).to have_requested(:patch, "#{sources_api_url}/applications/#{application_id}")
254
+ .with(:body => data, :headers => headers).once
173
255
  end
174
256
  end
175
257
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency "manageiq-loggers", ">= 0.4.2"
30
30
  spec.add_runtime_dependency "sources-api-client", "~> 3.0"
31
31
  spec.add_runtime_dependency "topological_inventory-api-client", "~> 3.0", ">= 3.0.1"
32
- spec.add_runtime_dependency "topological_inventory-ingress_api-client", "~> 1.0"
32
+ spec.add_runtime_dependency "topological_inventory-ingress_api-client", "~> 1.0", ">= 1.0.3"
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 2.0"
35
35
  spec.add_development_dependency "rake", ">= 12.3.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topological_inventory-providers-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Slemr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-09 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -113,6 +113,9 @@ dependencies:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '1.0'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 1.0.3
116
119
  type: :runtime
117
120
  prerelease: false
118
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -120,6 +123,9 @@ dependencies:
120
123
  - - "~>"
121
124
  - !ruby/object:Gem::Version
122
125
  version: '1.0'
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 1.0.3
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: bundler
125
131
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +253,7 @@ files:
247
253
  - lib/topological_inventory/providers/common/collectors_pool.rb
248
254
  - lib/topological_inventory/providers/common/logging.rb
249
255
  - lib/topological_inventory/providers/common/operations/endpoint_client.rb
256
+ - lib/topological_inventory/providers/common/operations/health_check.rb
250
257
  - lib/topological_inventory/providers/common/operations/processor.rb
251
258
  - lib/topological_inventory/providers/common/operations/source.rb
252
259
  - lib/topological_inventory/providers/common/operations/sources_api_client.rb