redhat_access 2.2.11 → 2.2.16
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/controllers/redhat_access/api/machine_telemetry_api_controller.rb +12 -0
- data/app/controllers/redhat_access/api/telemetry_api_controller.rb +4 -1
- data/app/models/redhat_access/concerns/host_managed_extensions.rb +1 -1
- data/app/services/redhat_access/telemetry/look_ups.rb +47 -18
- data/config/config.yml.example +1 -0
- data/config/defaults.yml +1 -0
- data/lib/redhat_access/version.rb +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: fe33c66ba4b918fd0d0a4b643075d656ba00c8f1af2efc387643d181b8b132df
|
4
|
+
data.tar.gz: 1b7c7b46ffe75f51142247eac000413b5507f343bcefbeae4d436663adc74ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cfb18c7636c09b3e55bb16c8d848a55ff1d64c87129b0de6291121ac2da3aff83a363b679346c9bbd4dd5b347290a81a4d29aa36c96ab7d7239be9f57ecfd48
|
7
|
+
data.tar.gz: 89f7c4b1effd5629d548c82def18385e60e1357729024162daac288524b9fa9561bbdfc1bd317a496182934b82359f90bfa8b14c0f5b995ecd78ca4ec7038f9c
|
@@ -120,6 +120,18 @@ module RedhatAccess
|
|
120
120
|
host = get_content_host(uuid)
|
121
121
|
org = get_organization(host)
|
122
122
|
|
123
|
+
# {
|
124
|
+
# "Satellite": {
|
125
|
+
# "Organization": ["Insights"],
|
126
|
+
# "Location": ["North America", "RTP"]
|
127
|
+
# },
|
128
|
+
#
|
129
|
+
# "SatelliteParameter": {
|
130
|
+
# "parameter_1": ["value_1"],
|
131
|
+
# "parameter_2": ["value_2"]
|
132
|
+
# }
|
133
|
+
# }
|
134
|
+
|
123
135
|
# get organization
|
124
136
|
labels = [{
|
125
137
|
:namespace => "Satellite",
|
@@ -118,7 +118,7 @@ module RedhatAccess
|
|
118
118
|
|
119
119
|
client = get_api_client
|
120
120
|
res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, {timeout: get_tapi_timeout}, use_subsets)
|
121
|
-
#401
|
121
|
+
#401 errors means our proxy is not configured right.
|
122
122
|
#Change it to 502 to distinguish with local applications 401 errors
|
123
123
|
resp_data = res[:data]
|
124
124
|
if res[:code] == 401
|
@@ -136,6 +136,9 @@ module RedhatAccess
|
|
136
136
|
if resp_data.headers[:x_resource_count]
|
137
137
|
response.headers['x-resource-count'] = resp_data.headers[:x_resource_count]
|
138
138
|
end
|
139
|
+
if resp_data.headers[:x_rh_insights_request_id]
|
140
|
+
response.headers['x_rh_insights_request_id'] = resp_data.headers[:x_rh_insights_request_id]
|
141
|
+
end
|
139
142
|
render status: res[:code], json: resp_data
|
140
143
|
else
|
141
144
|
render status: res[:code], json: resp_data
|
@@ -12,7 +12,7 @@ module RedhatAccess
|
|
12
12
|
def search_by_plan_id(key, operator, value)
|
13
13
|
insights_plan_runner = ForemanAnsible::InsightsPlanRunner.new(Organization.current, value.to_i)
|
14
14
|
hostname_rules_relation = insights_plan_runner.hostname_rules(insights_plan_runner.playbook)
|
15
|
-
host_ids = Host::Managed.where(:name => hostname_rules_relation.keys).pluck(:id)
|
15
|
+
host_ids = Host::Managed.where(:name => hostname_rules_relation.keys.map{|h| h.downcase}).pluck(:id)
|
16
16
|
{ :conditions => " hosts.id IN(#{host_ids.join(',')})" }
|
17
17
|
end
|
18
18
|
end
|
@@ -15,8 +15,7 @@ module RedhatAccess
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def can_mask_rules(user)
|
18
|
-
#
|
19
|
-
# TODO move this to an auth class?
|
18
|
+
849456 # TODO move this to an auth class?
|
20
19
|
return false if user.nil?
|
21
20
|
return true if user.admin
|
22
21
|
permissions = user.cached_roles.collect(&:permissions).flatten.map!(&:name)
|
@@ -67,7 +66,8 @@ module RedhatAccess
|
|
67
66
|
def disconnected_org?(org)
|
68
67
|
if org
|
69
68
|
# TODO: fix hard coding
|
70
|
-
|
69
|
+
# disable insights if disconnected orgs aren't enabled and katello doesn't point to redhat's CDN
|
70
|
+
!REDHAT_ACCESS_CONFIG[:enable_insights_for_disconnected_orgs] && org.redhat_repository_url != 'https://cdn.redhat.com'
|
71
71
|
else
|
72
72
|
raise(RecordNotFound, 'Organization not found or invalid')
|
73
73
|
end
|
@@ -201,22 +201,51 @@ module RedhatAccess
|
|
201
201
|
end
|
202
202
|
|
203
203
|
def get_portal_http_proxy
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
204
|
+
begin
|
205
|
+
@http_proxy_string ||=
|
206
|
+
begin
|
207
|
+
proxy_uri = URI('')
|
208
|
+
|
209
|
+
if Setting[:content_default_http_proxy].present?
|
210
|
+
proxy_config = HttpProxy.default_global_content_proxy
|
211
|
+
proxy_uri = URI(proxy_config&.url)
|
212
|
+
if proxy_config&.username.present?
|
213
|
+
proxy_uri.user = CGI.escape(proxy_config&.username)
|
214
|
+
if proxy_config&.password.present?
|
215
|
+
proxy_uri.password = CGI.escape(proxy_config&.password)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
if proxy_uri.to_s.blank?
|
221
|
+
if SETTINGS[:katello][:cdn_proxy] && SETTINGS[:katello][:cdn_proxy][:host]
|
222
|
+
proxy_config = SETTINGS[:katello][:cdn_proxy]
|
223
|
+
proxy_uri.scheme = URI.parse(proxy_config[:host]).scheme
|
224
|
+
proxy_uri.host = URI.parse(proxy_config[:host]).host
|
225
|
+
proxy_uri.port = proxy_config[:port] if proxy_config[:port]
|
226
|
+
if proxy_config[:user].present?
|
227
|
+
proxy_uri.user = CGI.escape(proxy_config[:user]) if proxy_config[:user]
|
228
|
+
if proxy_config[:password].present?
|
229
|
+
proxy_uri.password = CGI.escape(proxy_config[:password])
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# Ruby's uri parser doesn't handle encoded characters so Katello added two new schemes to handle proxy
|
236
|
+
# passwords. See https://github.com/Katello/katello/blob/master/app/lib/katello/util/proxy_uri.rb
|
237
|
+
proxy_uri.scheme = 'proxy' if proxy_uri.scheme == 'http'
|
238
|
+
proxy_uri.scheme = 'proxys' if proxy_uri.scheme == 'https'
|
239
|
+
|
240
|
+
proxy_uri.to_s
|
241
|
+
end
|
242
|
+
|
243
|
+
Rails.logger.debug("Insights proxy url = #{@http_proxy_string}")
|
244
|
+
@http_proxy_string
|
245
|
+
rescue
|
246
|
+
Rails.logger.debug("insights plugin: Something bad happened trying to get the proxy url")
|
247
|
+
raise
|
218
248
|
end
|
219
|
-
proxy
|
220
249
|
end
|
221
250
|
|
222
251
|
def get_http_user_agent
|
data/config/config.yml.example
CHANGED
data/config/defaults.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redhat_access
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lindani Phiri
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redhat_access_lib
|