redhat_access 2.2.18 → 2.2.19

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: 86bd04f9f04b00a09726b0e76ed2c668b84efdf2bb9cf8dc70a030c22ec0beb8
4
- data.tar.gz: abb8e439938a3148d4b99fae335b28253a88e13156d2a50fb57cd15dadaf2c8c
3
+ metadata.gz: 22973a0685c5aeb9b9683037f930a2afb7ec325c145c5d7e3dc97e2cac4429c2
4
+ data.tar.gz: 46d2f9bf710bc14f1d528cc6c2c2e8c2f6c52c1c856c3047424190bb5d5a4e9e
5
5
  SHA512:
6
- metadata.gz: c9bd5b013607f4cfc490c71990b1e7dbc9bc2f8fc54e14f7a957736b31c462db18a0a94afb73e9835915d69179f9b8a5f063c5b24f359e9e94345fd262e2e33e
7
- data.tar.gz: 645ac25141593cbb13a20c01ef389264548f08d309d8615004e275ec27e81500b3bc9bc031cddf1add4192224d6d4d099c6e88011a3f5c8c002316d6c8a95d0f
6
+ metadata.gz: bacad0f960e2003ef1b2da974e549e0962e6f961ea87d641148e7fe4b2c48acf98f795ad09aac713b70591056f4d5d125325d05b834298da684f058e88c8bea0
7
+ data.tar.gz: af0704351dac7f9d830f25af9de20cd53ff53aa8117ae65e322db6c869c1d98fba1b7160585c73fb52df05aa0bb66df7a5a90e0ffba4aa5661f25978b61c2909
@@ -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,108 +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
- # {
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
-
135
- # get organization
136
- labels = [{
137
- :namespace => "Satellite",
138
- :key => "Organization",
139
- :value => org.name
140
- }]
141
-
142
- # get locations - one tag for each location element
143
- location = host.location
144
- unless location.nil?
145
- location.title.split('/').each do |title|
146
- labels += [{
147
- :namespace => "Satellite",
148
- :key => "Location",
149
- :value => title
150
- }]
151
- end
152
- end
153
-
154
- # get hostgroup and config groups
155
- hostgroup = host.hostgroup_id.nil? ? nil : ::Hostgroup.unscoped.find(host.hostgroup_id)
156
- unless hostgroup.nil?
157
- hostgroup.title.split('/').each do |title|
158
- labels += [{
159
- :namespace => "Satellite",
160
- :key => "Host Group",
161
- :value => title
162
- }]
163
- end
164
-
165
- # We're leaving these out for the moment....
166
-
167
- # # seems like this is missing parent config groups...
168
- # hostgroup.all_config_groups.each do |config_group|
169
- # labels += [{
170
- # :namespace => "Satellite",
171
- # :key => "Config Group",
172
- # :value => config_group.name
173
- # }]
174
- # end
175
- end
176
-
177
- # get host_collections
178
- host.host_collections.each do |collection|
179
- labels += [{
180
- :namespace => "Satellite",
181
- :key => "Host Collection",
182
- :value => collection.name
183
- }]
184
- end
185
-
186
- # get parameters - perhaps we should only include parameter.searchable_value == true?
187
- include_parameter_tags = get_include_parameter_tags # true, false or list
188
- if include_parameter_tags
189
- host.host_inherited_params_objects.each do |parameter|
190
- # check to see if parameter.name is in list (if it *is* a list...)
191
- if include_parameter_tags.respond_to?(:none?)
192
- # skip tag if no match in list
193
- next if include_parameter_tags.none? do |pattern|
194
- begin
195
- parameter.name.match?(pattern)
196
- rescue RegexpError => e
197
- Rails.logger.debug("Skipping bad parameter expression: #{e}")
198
- # remove the bad pattern from the list so we don't keep iterating over it
199
- include_parameter_tags.delete(pattern)
200
- next
201
- end
202
- end
203
- end
204
- # add tag to list of labels
205
- labels += [{
206
- :namespace => "SatelliteParameter",
207
- :key => parameter.name,
208
- :value => parameter.value
209
- }]
210
- end
211
- end
212
-
213
- return labels
214
- end
215
88
  end
216
89
  end
217
90
  end
@@ -12,8 +12,9 @@ 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.map{|h| h.downcase}).pluck(:id)
16
- { :conditions => " hosts.id IN(#{host_ids.join(',')})" }
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' : " hosts.name IN(#{hostnames.join(',')})") }
17
18
  end
18
19
  end
19
20
  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'
@@ -1,3 +1,3 @@
1
1
  module RedhatAccess
2
- VERSION = "2.2.18"
2
+ VERSION = "2.2.19"
3
3
  end
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.18
4
+ version: 2.2.19
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-10-14 00:00:00.000000000 Z
12
+ date: 2021-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redhat_access_lib