foreman_rh_cloud 4.0.30 → 4.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/services/foreman_rh_cloud/cloud_ping_service.rb +4 -1
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +1 -1
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +3 -1
- data/lib/foreman_rh_cloud/engine.rb +13 -11
- data/lib/foreman_rh_cloud/version.rb +1 -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/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +19 -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: 13d501dcd7ec95a0fc10ed4bd7b0a426e3f485aa3dd7ba597e56dbfd41268977
|
|
4
|
+
data.tar.gz: 6c392f1ad04344c887609894b64dac3bbd6add5c4a70cbf4ae1598c2851ac581
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5bbe88508a4df1017b05d6dd13adb432040dbad271bc317abc10169decd43f1ab785dfc9733f3c8e4d5f6116ffa46252ace5996a5e133c2c48954da71679464
|
|
7
|
+
data.tar.gz: 448308053649ce5001aeb40b53f546a52c92a5a84c870d1bbda392655f579c0f16df61c53da16f58101708fdac855813c5f1adeb2039cf2c6a0f2ea1b4c6f709
|
|
@@ -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
|
|
@@ -28,7 +28,7 @@ module ForemanRhCloud
|
|
|
28
28
|
headers: {
|
|
29
29
|
params: forward_params,
|
|
30
30
|
user_agent: http_user_agent(original_request),
|
|
31
|
-
content_type: original_request.media_type,
|
|
31
|
+
content_type: original_request.media_type.presence || original_request.format.to_s,
|
|
32
32
|
},
|
|
33
33
|
}
|
|
34
34
|
base_params.merge(path_params(original_request.path, certs))
|
|
@@ -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)
|
|
@@ -6,15 +6,18 @@ module ForemanRhCloud
|
|
|
6
6
|
engine_name 'foreman_rh_cloud'
|
|
7
7
|
|
|
8
8
|
def self.register_scheduled_task(task_class, cronline)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
ForemanTasks::RecurringLogic.transaction(isolation: :serializable) do
|
|
10
|
+
return if ForemanTasks::RecurringLogic.joins(:tasks)
|
|
11
|
+
.merge(ForemanTasks::Task.where(label: task_class.name))
|
|
12
|
+
.exists?
|
|
13
|
+
|
|
14
|
+
User.as_anonymous_admin do
|
|
15
|
+
recurring_logic = ForemanTasks::RecurringLogic.new_from_cronline(cronline)
|
|
16
|
+
recurring_logic.save!
|
|
17
|
+
recurring_logic.start(task_class)
|
|
18
|
+
end
|
|
17
19
|
end
|
|
20
|
+
rescue ActiveRecord::TransactionIsolationError
|
|
18
21
|
end
|
|
19
22
|
|
|
20
23
|
initializer 'foreman_rh_cloud.load_default_settings', :before => :load_config_initializers do
|
|
@@ -136,10 +139,9 @@ module ForemanRhCloud
|
|
|
136
139
|
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
|
|
137
140
|
end
|
|
138
141
|
|
|
139
|
-
|
|
142
|
+
initializer 'foreman_rh_cloud.register_rex_features', :before => :finisher_hook do |_app|
|
|
140
143
|
# skip database manipulations while tables do not exist, like in migrations
|
|
141
|
-
if ActiveRecord::Base.connection.data_source_exists?(ForemanTasks::Task.table_name)
|
|
142
|
-
|
|
144
|
+
if ActiveRecord::Base.connection.data_source_exists?(ForemanTasks::Task.table_name)
|
|
143
145
|
RemoteExecutionFeature.register(
|
|
144
146
|
:rh_cloud_remediate_hosts,
|
|
145
147
|
N_('Apply Insights recommendations'),
|
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
|
|
@@ -133,4 +133,23 @@ class CloudRequestForwarderTest < ActiveSupport::TestCase
|
|
|
133
133
|
assert_equal 'GET', actual[:method]
|
|
134
134
|
assert_equal params, actual[:headers][:params]
|
|
135
135
|
end
|
|
136
|
+
|
|
137
|
+
test 'should forward content type correctly' do
|
|
138
|
+
user_agent = { :foo => :bar }
|
|
139
|
+
params = { :page => 5, :per_page => 42 }
|
|
140
|
+
ForemanRhCloud::BranchInfo.any_instance.expects(:core_app_name).returns('test_app')
|
|
141
|
+
ForemanRhCloud::BranchInfo.any_instance.expects(:core_app_version).returns('test_ver')
|
|
142
|
+
|
|
143
|
+
req = ActionDispatch::Request.new(
|
|
144
|
+
'REQUEST_URI' => '/foo/bar',
|
|
145
|
+
'REQUEST_METHOD' => 'GET',
|
|
146
|
+
'HTTP_USER_AGENT' => user_agent,
|
|
147
|
+
'rack.input' => ::Puma::NullIO.new,
|
|
148
|
+
'action_dispatch.request.query_parameters' => params
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
actual = @forwarder.prepare_request_opts(req, 'TEST PAYLOAD', params, generate_certs_hash)
|
|
152
|
+
|
|
153
|
+
assert_match /text\/html/, actual[:headers][:content_type]
|
|
154
|
+
end
|
|
136
155
|
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: 4.0.
|
|
4
|
+
version: 4.0.35
|
|
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-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: katello
|