redhat_access 2.8.1 → 2.9.1
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 +0 -115
- data/app/models/redhat_access/concerns/host_managed_extensions.rb +4 -2
- data/app/services/redhat_access/telemetry/look_ups.rb +0 -9
- data/config/routes.rb +0 -2
- data/lib/redhat_access/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5fac7b0590ca10422d21dd457a0638e986d8881b08f0216b5730c46059a1636
|
4
|
+
data.tar.gz: 8635c591b5bc4ee8ed53474a83b4a62706d67943b78464fc5fcc5663932e031d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf437bf35adc8ef7660dd6120319c5557227844ba0d491d37d1776a269c9afa6bd8ea8dab440fcb7b8c8d596bf783fabf74694699463cf591ee7c466ae765f44
|
7
|
+
data.tar.gz: 45346558889b5e81168512981e4b56a51ead1d5f465b36d3a6013668c126b4dce5dd6a1874770de704a61ad86c774c9d37d1c258da48ca8d760ee52d07810cfd
|
@@ -65,31 +65,6 @@ module RedhatAccess
|
|
65
65
|
render status: res[:code], json: res[:data]
|
66
66
|
end
|
67
67
|
|
68
|
-
def get_branch_info
|
69
|
-
uuid = User.current.login
|
70
|
-
begin
|
71
|
-
org = get_organization(uuid)
|
72
|
-
labels = get_labels_for_host(uuid)
|
73
|
-
major, minor, build = get_plugin_parent_version.scan(/\d+/)
|
74
|
-
client_id = {:remote_leaf => uuid,
|
75
|
-
:remote_branch => get_branch_id_for_org(org),
|
76
|
-
:display_name => org.name,
|
77
|
-
:hostname => request.host,
|
78
|
-
:product => {:type => get_plugin_parent_name,
|
79
|
-
:major_version => major,
|
80
|
-
:minor_version => minor
|
81
|
-
},
|
82
|
-
:organization_id => org.id,
|
83
|
-
:satellite_instance_id => get_foreman_instance_id,
|
84
|
-
:labels => labels
|
85
|
-
}
|
86
|
-
render :json => client_id.to_json
|
87
|
-
rescue RedhatAccess::Telemetry::LookUps::RecordNotFound => e
|
88
|
-
http_error_response(e.message, 400)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
68
|
protected
|
94
69
|
|
95
70
|
def use_subsets
|
@@ -110,96 +85,6 @@ module RedhatAccess
|
|
110
85
|
client_user_agent = request.env['HTTP_USER_AGENT']
|
111
86
|
"#{base_user_agent};#{client_user_agent}"
|
112
87
|
end
|
113
|
-
|
114
|
-
|
115
|
-
def get_branch_id
|
116
|
-
get_branch_id_for_uuid(User.current.login)
|
117
|
-
end
|
118
|
-
|
119
|
-
def get_labels_for_host(uuid)
|
120
|
-
host = get_content_host(uuid)
|
121
|
-
org = get_organization(host)
|
122
|
-
|
123
|
-
# get organization
|
124
|
-
labels = [{
|
125
|
-
:namespace => "Satellite",
|
126
|
-
:key => "Organization",
|
127
|
-
:value => org.name
|
128
|
-
}]
|
129
|
-
|
130
|
-
# get locations - one tag for each location element
|
131
|
-
location = host.location
|
132
|
-
unless location.nil?
|
133
|
-
location.title.split('/').each do |title|
|
134
|
-
labels += [{
|
135
|
-
:namespace => "Satellite",
|
136
|
-
:key => "Location",
|
137
|
-
:value => title
|
138
|
-
}]
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
# get hostgroup and config groups
|
143
|
-
hostgroup = host.hostgroup_id.nil? ? nil : ::Hostgroup.unscoped.find(host.hostgroup_id)
|
144
|
-
unless hostgroup.nil?
|
145
|
-
hostgroup.title.split('/').each do |title|
|
146
|
-
labels += [{
|
147
|
-
:namespace => "Satellite",
|
148
|
-
:key => "Host Group",
|
149
|
-
:value => title
|
150
|
-
}]
|
151
|
-
end
|
152
|
-
|
153
|
-
# We're leaving these out for the moment....
|
154
|
-
|
155
|
-
# # seems like this is missing parent config groups...
|
156
|
-
# hostgroup.all_config_groups.each do |config_group|
|
157
|
-
# labels += [{
|
158
|
-
# :namespace => "Satellite",
|
159
|
-
# :key => "Config Group",
|
160
|
-
# :value => config_group.name
|
161
|
-
# }]
|
162
|
-
# end
|
163
|
-
end
|
164
|
-
|
165
|
-
# get host_collections
|
166
|
-
host.host_collections.each do |collection|
|
167
|
-
labels += [{
|
168
|
-
:namespace => "Satellite",
|
169
|
-
:key => "Host Collection",
|
170
|
-
:value => collection.name
|
171
|
-
}]
|
172
|
-
end
|
173
|
-
|
174
|
-
# get parameters - perhaps we should only include parameter.searchable_value == true?
|
175
|
-
include_parameter_tags = get_include_parameter_tags # true, false or list
|
176
|
-
if include_parameter_tags
|
177
|
-
host.host_inherited_params_objects.each do |parameter|
|
178
|
-
# check to see if parameter.name is in list (if it *is* a list...)
|
179
|
-
if include_parameter_tags.respond_to?(:none?)
|
180
|
-
# skip tag if no match in list
|
181
|
-
next if include_parameter_tags.none? do |pattern|
|
182
|
-
begin
|
183
|
-
parameter.name.match?(pattern)
|
184
|
-
rescue RegexpError => e
|
185
|
-
Rails.logger.debug("Skipping bad parameter expression: #{e}")
|
186
|
-
# remove the bad pattern from the list so we don't keep iterating over it
|
187
|
-
include_parameter_tags.delete(pattern)
|
188
|
-
next
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
# add tag to list of labels
|
193
|
-
labels += [{
|
194
|
-
:namespace => "SatelliteParameter",
|
195
|
-
:key => parameter.name,
|
196
|
-
:value => parameter.value
|
197
|
-
}]
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
return labels
|
202
|
-
end
|
203
88
|
end
|
204
89
|
end
|
205
90
|
end
|
@@ -12,8 +12,10 @@ 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
|
-
|
16
|
-
{
|
15
|
+
hostnames = hostname_rules_relation.keys.map{|h| h.downcase}
|
16
|
+
hostnames.map! { |hname| hname.split('.').first } if Setting[:use_shortname_for_vms]
|
17
|
+
conditions = hostnames.empty? ? ' 0 = 1' : sanitize_sql_array([' hosts.name IN (?)', hostnames])
|
18
|
+
{ :conditions => conditions }
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -196,10 +196,6 @@ module RedhatAccess
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
def get_foreman_instance_id
|
200
|
-
Foreman.respond_to?(:instance_id) ? Foreman.instance_id : nil
|
201
|
-
end
|
202
|
-
|
203
199
|
def get_portal_http_proxy
|
204
200
|
begin
|
205
201
|
@http_proxy_string ||=
|
@@ -279,11 +275,6 @@ module RedhatAccess
|
|
279
275
|
REDHAT_ACCESS_CONFIG[:telemetry_upload_timeout_s] || 120
|
280
276
|
end
|
281
277
|
|
282
|
-
# list of parameters to include as tags (or 'true' for all of them)
|
283
|
-
def get_include_parameter_tags
|
284
|
-
REDHAT_ACCESS_CONFIG[:include_parameter_tags] || false
|
285
|
-
end
|
286
|
-
|
287
278
|
def user_login_to_hash(login)
|
288
279
|
Digest::SHA1.hexdigest(login)
|
289
280
|
end
|
data/config/routes.rb
CHANGED
@@ -13,11 +13,9 @@ RedhatAccess::Engine.routes.draw do
|
|
13
13
|
get "/insights/templates/:page" => "analytics_dashboard#template" # hack to get around angular-rails-templates bug
|
14
14
|
scope '/r/insights' do
|
15
15
|
get '/', to: 'api/machine_telemetry_api#api_connection_test'
|
16
|
-
get '/v1/branch_info', to: 'api/machine_telemetry_api#get_branch_info'
|
17
16
|
post '/uploads/(:id)', to: 'api/machine_telemetry_api#proxy_upload'
|
18
17
|
get '/view/api/:v/me' , to: 'api/telemetry_api#connection_status', :constraints => {:v =>/(v[0-9]|latest)/}
|
19
18
|
match '/view/api/:path', to: 'api/telemetry_api#proxy', :constraints => {:path => /.*/} ,via: [:get, :post, :delete,:put, :patch]
|
20
|
-
match '/:path', to: 'api/machine_telemetry_api#proxy', :constraints => {:path => /.*/}, via: [:get, :post, :delete,:put, :patch]
|
21
19
|
end
|
22
20
|
get 'insights', to: 'analytics_dashboard#index'
|
23
21
|
get 'analytics_configuration', to: 'telemetry_configuration#index'
|