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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89c6bc366a2f296b03f0026ba83aab427386bed63bf90b830317c230e055bd16
4
- data.tar.gz: 9d0adc8be6158e6f777a8d46c9e0bed874b2deae99d9c259c508b12a8ea3d544
3
+ metadata.gz: d5fac7b0590ca10422d21dd457a0638e986d8881b08f0216b5730c46059a1636
4
+ data.tar.gz: 8635c591b5bc4ee8ed53474a83b4a62706d67943b78464fc5fcc5663932e031d
5
5
  SHA512:
6
- metadata.gz: fdba6f8c40db6c5c181b05ed62c8c9b71e4f0ac799c8460b3b01ffe798d8e7b77d0158ce833afdf00621f9331669c4c698a0f51c97f544a634fd3bcf0eca49fe
7
- data.tar.gz: 3b188cb73fe6a1f289973719f37c59728d12b72ba1e4d9357bd661005f731a82f9b2e84fbbb51967986788a2986f8c3622fd2a7ad1e92b8a32ca0b8fea94061c
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
- 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' : 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'
@@ -1,3 +1,3 @@
1
1
  module RedhatAccess
2
- VERSION = "2.8.1"
2
+ VERSION = "2.9.1"
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.8.1
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindani Phiri