foreman_rh_cloud 5.0.31 → 5.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/foreman_inventory_upload_host_helper.rb +2 -1
- data/app/services/foreman_rh_cloud/cloud_ping_service.rb +4 -1
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +3 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +7 -1
- data/package.json +1 -1
- data/test/controllers/inventory_upload/cloud_status_controller_test.rb +2 -0
- data/test/unit/fact_helpers_test.rb +2 -2
- data/test/unit/foreman_rh_cloud_self_host_test.rb +7 -0
- data/test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb +4 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5991354b7fcd361491a962af732a7543402245af2516964876fee68b1bfd6e07
|
4
|
+
data.tar.gz: 6232fd7c367092e0afb3591c313f3347c751610fa2a3b4d38e2f59de08cd2313
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d38647081b45704673ed8c77b51ade6e90ee8955bf5bd8433bdca9f3072667d505b314ece193e1dd488af51c8cdf6396de5d987acb718693e6c0cecd7e1c7a18
|
7
|
+
data.tar.gz: 2622868402ef0d3a0fa55d74652e1985b97c95b1dd42bab865e86dd8b68929e95ebd5dd1bc3bba8fb9fef2fa8d7e4af23b9f00c959d5aca8eb4d4ee180722fb6
|
@@ -5,8 +5,9 @@ module ForemanInventoryUploadHostHelper
|
|
5
5
|
|
6
6
|
def hits_counts_cell(host)
|
7
7
|
host_hits = hits_counts[host.id]
|
8
|
+
host_link = Setting['host_details_ui'] ? "#{host_details_page_path(host)}#/Insights" : "#{host_path(host)}#insights"
|
8
9
|
tag.td class: ['hidden-xs', 'ellipsis', 'text-center'] do
|
9
|
-
link_to(host_hits,
|
10
|
+
link_to(host_hits, host_link) if host_hits
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -39,6 +39,9 @@ module ForemanRhCloud
|
|
39
39
|
certs = candlepin_id_cert(@org)
|
40
40
|
return StandardError.new('certificate missing') unless certs
|
41
41
|
|
42
|
+
cert_checker = Katello::UpstreamConnectionChecker.new(@org)
|
43
|
+
cert_checker.assert_connection
|
44
|
+
|
42
45
|
execute_cloud_request(
|
43
46
|
method: :get,
|
44
47
|
url: ForemanRhCloud.cert_base_url + "/api/apicast-tests/ping",
|
@@ -72,7 +75,7 @@ module ForemanRhCloud
|
|
72
75
|
org,
|
73
76
|
{
|
74
77
|
success: cert_response.is_a?(RestClient::Response),
|
75
|
-
error: (cert_response.is_a?(Exception) ? cert_response.inspect : nil),
|
78
|
+
error: (cert_response.is_a?(Exception) ? cert_response&.message || cert_response.inspect : nil),
|
76
79
|
},
|
77
80
|
]
|
78
81
|
end
|
@@ -104,7 +104,9 @@ module ForemanInventoryUpload
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def obfuscate_ip(ip, ips_dict)
|
107
|
-
|
107
|
+
max_obfuscated = ips_dict.values.map { |v| IPAddr.new(v).to_i }.max || IPAddr.new('10.230.230.0').to_i
|
108
|
+
|
109
|
+
IPAddr.new(max_obfuscated + 1, Socket::AF_INET).to_s
|
108
110
|
end
|
109
111
|
|
110
112
|
def bios_uuid(host)
|
data/lib/foreman_rh_cloud.rb
CHANGED
@@ -109,7 +109,13 @@ module ForemanRhCloud
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def self.foreman_host_name
|
112
|
-
ENV['SATELLITE_RH_CLOUD_FOREMAN_HOST'] || ::SmartProxy.default_capsule.name
|
112
|
+
ENV['SATELLITE_RH_CLOUD_FOREMAN_HOST'] || marked_foreman_host&.name || ::SmartProxy.default_capsule.name
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.marked_foreman_host
|
116
|
+
::Host.unscoped.search_for('infrastructure_facet.foreman = true').first
|
117
|
+
rescue ScopedSearch::QueryNotSupported
|
118
|
+
nil
|
113
119
|
end
|
114
120
|
|
115
121
|
def self.legacy_insights_ca
|
data/package.json
CHANGED
@@ -29,6 +29,8 @@ class CloudStatusControllerTest < ActionController::TestCase
|
|
29
29
|
RestClient::Response.new('TEST RESPONSE ORG 1')
|
30
30
|
)
|
31
31
|
|
32
|
+
Katello::UpstreamConnectionChecker.any_instance.expects(:assert_connection).twice.returns(true)
|
33
|
+
|
32
34
|
get :index, session: set_session_user
|
33
35
|
|
34
36
|
assert_response :success
|
@@ -30,13 +30,13 @@ class FactHelpersTest < ActiveSupport::TestCase
|
|
30
30
|
test 'obfuscates ips with insights-client data' do
|
31
31
|
host = mock('host')
|
32
32
|
@instance.expects(:fact_value).with(host, 'insights_client::ips').returns(
|
33
|
-
'[{"obfuscated": "10.230.230.1", "original": "224.0.0.1"}, {"obfuscated": "10.230.230.
|
33
|
+
'[{"obfuscated": "10.230.230.1", "original": "224.0.0.1"}, {"obfuscated": "10.230.230.255", "original": "224.0.0.251"}]'
|
34
34
|
)
|
35
35
|
|
36
36
|
actual = @instance.obfuscated_ips(host)
|
37
37
|
|
38
38
|
assert_equal '10.230.230.1', actual['224.0.0.1']
|
39
|
-
assert_equal '10.230.
|
39
|
+
assert_equal '10.230.231.0', actual['224.0.0.2']
|
40
40
|
end
|
41
41
|
|
42
42
|
test 'obfuscates ips without insights-client data' do
|
@@ -25,4 +25,11 @@ class ForemanRhCloudSelfHostTest < ActiveSupport::TestCase
|
|
25
25
|
|
26
26
|
assert_not_nil actual
|
27
27
|
end
|
28
|
+
|
29
|
+
test 'finds host by infrastructure facet' do
|
30
|
+
@host = FactoryBot.create(:host, :managed, :with_infrastructure_facet)
|
31
|
+
actual = ForemanRhCloud.foreman_host
|
32
|
+
|
33
|
+
assert_equal @host, actual
|
34
|
+
end
|
28
35
|
end
|
@@ -28,6 +28,8 @@ class CloudStatusServiceTest < ActiveSupport::TestCase
|
|
28
28
|
RestClient::Response.new('TEST RESPONSE ORG 1')
|
29
29
|
)
|
30
30
|
|
31
|
+
Katello::UpstreamConnectionChecker.any_instance.expects(:assert_connection).twice.returns(true)
|
32
|
+
|
31
33
|
service = ForemanRhCloud::CloudPingService.new(organizations, nil)
|
32
34
|
actual = service.ping
|
33
35
|
|
@@ -55,6 +57,8 @@ class CloudStatusServiceTest < ActiveSupport::TestCase
|
|
55
57
|
'TEST RESPONSE ORG 0'
|
56
58
|
)
|
57
59
|
|
60
|
+
Katello::UpstreamConnectionChecker.any_instance.expects(:assert_connection).returns(true)
|
61
|
+
|
58
62
|
service = ForemanRhCloud::CloudPingService.new(organizations, nil)
|
59
63
|
actual = service.ping
|
60
64
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|