redhat_access 2.1.10 → 2.2.0

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
- SHA256:
3
- metadata.gz: 3f2d7895af2ff247048b38149cfb5d71a001368eaee189077516fa1afb4b4428
4
- data.tar.gz: 59ddd32c84310572267af5867fa0262d0ef8bdb5eea5ddfe79bdbe0a40410651
2
+ SHA1:
3
+ metadata.gz: 56b1c25b08f98029fce262ff0cff8b2ca21b908e
4
+ data.tar.gz: 14aecaa87ca12f6480d3c2a7cbdbcb8d2bc94700
5
5
  SHA512:
6
- metadata.gz: b7af6fcd285fc8ca428bc6c6b76f7691bb55cc8bc72e9e5cd123ecf8e7d97aecb99057c738087d814ae3e65dbfc994e143d15a03643ab4f9eedb66dbd31b7cb4
7
- data.tar.gz: a0e451a84bbbb4619ee4b689142e74f68a4f8a29feb435897910c1217dcd14c46e701f384cb5e51aa97781a03f6d351e57172593f76efdbd447412d12548a2dd
6
+ metadata.gz: 82243a1fc7341fdc2f7d09ea28986e169bab1c37d78303b2148b43b18334b95427ec3bc2591c8ca971752b12e83f6d0593dc6f5d703a3e5be6f51ca333ad061a
7
+ data.tar.gz: 0a773d5bb91b95e4c05381f880056d2ea3e90560550f41bdeaddf151fc3372f687d70e8a7193d94206ef29152f4aca10267ffcad09de62880685b44caf54322b
@@ -51,14 +51,9 @@ module RedhatAccess
51
51
  else
52
52
  resource = "uploads/#{params[:id]}"
53
53
  end
54
- if request.format.json?
55
- original_payload = original_payload.to_json
56
- end
57
54
  if params[:file]
58
- #Overwrite payload if sending a file
59
55
  original_payload = get_file_data(params)
60
56
  end
61
-
62
57
  client = get_api_client
63
58
  Rails.logger.debug("Proxy upload original_payload : #{original_payload}")
64
59
  res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, nil, use_subsets)
@@ -63,7 +63,7 @@ module RedhatAccess
63
63
  unless content_hdr.nil?
64
64
  headers['content-type'] = content_hdr
65
65
  end
66
- headers['Authorization'] = env['HTTP_AUTHORIZATION'] if env['HTTP_AUTHORIZATION']
66
+ headers['Authorization'] = request.env['HTTP_AUTHORIZATION'] if request.env['HTTP_AUTHORIZATION']
67
67
  Rails.logger.debug("User agent for telemetry is #{get_http_user_agent}")
68
68
  strata_host = 'https://api.' + REDHAT_ACCESS_CONFIG[:strata_host]
69
69
  return RedhatAccess::Telemetry::PortalClient.new(strata_host,
@@ -108,14 +108,9 @@ module RedhatAccess
108
108
  original_payload = request.body.read
109
109
  end
110
110
  resource = params[:path] == nil ? "/" : params[:path]
111
-
112
111
  if params[:file]
113
112
  original_payload = get_file_data(params)
114
- elsif request.format.json? && request.patch? && original_payload
115
- # because rails behaves stupidly for http PATCH:
116
- original_payload = original_payload.to_json unless original_payload.is_a? String
117
113
  end
118
-
119
114
  client = get_api_client
120
115
  res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, nil, use_subsets)
121
116
  #401 erros means our proxy is not configured right.
@@ -150,10 +145,10 @@ module RedhatAccess
150
145
  end
151
146
 
152
147
  def get_file_data params
153
- data = {}
154
- data[:file] = params[:file]
155
- data[:metadata] = params[:metadata] if params[:metadata] # include the metadata part if present
156
- return data
148
+ return {
149
+ :file => params[:file],
150
+ :filename => params[:file].original_filename
151
+ }
157
152
  end
158
153
 
159
154
  def add_branch_to_params(params)
@@ -12,10 +12,8 @@ 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
- hosts = hostname_rules_relation.keys.map do |hostname|
16
- Host::Managed.find_by(:name => hostname).id
17
- end
18
- { :conditions => " hosts.id IN(#{hosts.join(',')})" }
15
+ host_ids = Host::Managed.where(:name => hostname_rules_relation.keys).pluck(&:id)
16
+ { :conditions => " hosts.id IN(#{host_ids.join(',')})" }
19
17
  end
20
18
  end
21
19
  end
@@ -185,7 +185,8 @@ module RedhatAccess
185
185
 
186
186
  def get_content_hosts(org)
187
187
  if org
188
- ::Host::Managed.authorized('view_hosts', ::Host::Managed).joins(:subscription_facet).rewhere({:organization_id => org.id}).pluck("katello_subscription_facets.uuid")
188
+ host_ids = ::Host::Managed.authorized('view_hosts', ::Host::Managed).where({:organization_id => org.id}).pluck(:id)
189
+ Katello::Host::SubscriptionFacet.where(:host_id => host_ids).pluck(:uuid)
189
190
  else
190
191
  raise(RecordNotFound, 'Organization not found or invalid')
191
192
  end
data/config/routes.rb CHANGED
@@ -16,8 +16,8 @@ RedhatAccess::Engine.routes.draw do
16
16
  get '/v1/branch_info', to: 'api/machine_telemetry_api#get_branch_info'
17
17
  post '/uploads/(:id)', to: 'api/machine_telemetry_api#proxy_upload'
18
18
  get '/view/api/:v/me' , to: 'api/telemetry_api#connection_status', :constraints => {:v =>/(v[0-9]|latest)/}
19
- 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]
19
+ match '/view/api/:path', to: 'api/telemetry_api#proxy', :constraints => {:path => /.*/} ,via: [:get, :post, :delete,:put]
20
+ match '/:path', to: 'api/machine_telemetry_api#proxy', :constraints => {:path => /.*/}, via: [:get, :post, :delete,:put]
21
21
  end
22
22
  get 'insights', to: 'analytics_dashboard#index'
23
23
  get 'analytics_configuration', to: 'telemetry_configuration#index'
@@ -89,7 +89,7 @@ module RedhatAccess
89
89
  Foreman::Plugin.installed?('foreman_sam')
90
90
  end
91
91
 
92
- requires_foreman '>= 1.15'
92
+ requires_foreman '>= 1.18'
93
93
  #requires_foreman_plugin 'katello', '> 3.0.0'
94
94
 
95
95
  precompile_assets([
@@ -131,37 +131,6 @@ module RedhatAccess
131
131
  end
132
132
  add_all_permissions_to_default_roles
133
133
  # menus
134
- sub_menu :header_menu, :redhat_access_menu, :caption => N_('Red Hat Access') do
135
- menu :header_menu,
136
- :Search,
137
- :url => '/redhat_access/search',
138
- :url_hash => {:controller => :"redhat_access/search", :action => :index},
139
- :engine => RedhatAccess::Engine,
140
- :turbolinks => false
141
- menu :header_menu,
142
- :LogViewer,
143
- :url => '/redhat_access/logviewer',
144
- :url_hash => {:controller => :"redhat_access/logs", :action => :logs},
145
- :engine => RedhatAccess::Engine,
146
- :caption => N_('Logs'),
147
- :turbolinks => false
148
- divider :header_menu, :parent => :redhat_access_menu, :caption => N_('Support')
149
- menu :header_menu,
150
- :mycases,
151
- :url => '/redhat_access/case/list',
152
- :url_hash => {:controller => :"redhat_access/cases", :action => :index},
153
- :engine => RedhatAccess::Engine,
154
- :caption => N_('My Cases'),
155
- :turbolinks => false
156
-
157
- menu :header_menu, :new_cases, :caption => N_('Open New Case'),
158
- :url => '/redhat_access/case/new',
159
- :url_hash => {:controller => :"redhat_access/cases", :action => :create},
160
- :engine => RedhatAccess::Engine,
161
- :turbolinks => false
162
-
163
- end
164
-
165
134
  unless sam_deployment?
166
135
  sub_menu :top_menu, :redhat_access_top_menu, :caption => N_('Insights'),
167
136
  :icon => 'pficon pficon-storage-domain' do
@@ -215,6 +184,36 @@ module RedhatAccess
215
184
  :engine => RedhatAccess::Engine,
216
185
  :turbolinks => false
217
186
  end
187
+ sub_menu :top_menu, :redhat_access_menu, :caption => N_('Access'), :icon => 'fa fa-phone' do
188
+ menu :top_menu,
189
+ :Search,
190
+ :url => '/redhat_access/search',
191
+ :url_hash => {:controller => :"redhat_access/search", :action => :index},
192
+ :engine => RedhatAccess::Engine,
193
+ :turbolinks => false
194
+ menu :top_menu,
195
+ :LogViewer,
196
+ :url => '/redhat_access/logviewer',
197
+ :url_hash => {:controller => :"redhat_access/logs", :action => :logs},
198
+ :engine => RedhatAccess::Engine,
199
+ :caption => N_('Logs'),
200
+ :turbolinks => false
201
+ divider :top_menu, :parent => :redhat_access_menu, :caption => N_('Support')
202
+ menu :top_menu,
203
+ :mycases,
204
+ :url => '/redhat_access/case/list',
205
+ :url_hash => {:controller => :"redhat_access/cases", :action => :index},
206
+ :engine => RedhatAccess::Engine,
207
+ :caption => N_('My Cases'),
208
+ :turbolinks => false
209
+
210
+ menu :top_menu, :new_cases, :caption => N_('Open New Case'),
211
+ :url => '/redhat_access/case/new',
212
+ :url_hash => {:controller => :"redhat_access/cases", :action => :create},
213
+ :engine => RedhatAccess::Engine,
214
+ :turbolinks => false
215
+
216
+ end
218
217
  widget 'insights_issues_widget', :name => 'Red Hat Insights Actions', :sizey => 1, :sizex => 6
219
218
  widget 'insights_risk_widget', :name => 'Red Hat Insights Risk Summary', :sizey => 1, :sizex => 6
220
219
  end
@@ -1,3 +1,3 @@
1
1
  module RedhatAccess
2
- VERSION = "2.1.10"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redhat_access
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.10
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindani Phiri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-08 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redhat_access_lib
@@ -336,61 +336,62 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
336
  - !ruby/object:Gem::Version
337
337
  version: '0'
338
338
  requirements: []
339
- rubygems_version: 3.0.1
339
+ rubyforge_project:
340
+ rubygems_version: 2.6.8
340
341
  signing_key:
341
342
  specification_version: 4
342
343
  summary: Plugin to add Redhat Access to Foreman
343
344
  test_files:
344
- - test/unit/redhat_access/telemetry_configuration_test.rb
345
- - test/unit/helpers/redhat_access/telemetry_configuration_helper_test.rb
345
+ - test/integration/navigation_test.rb
346
346
  - test/unit/helpers/redhat_access/redhat_access_helper_test.rb
347
- - test/unit/helpers/redhat_access/attachments_helper_test.rb
348
- - test/unit/helpers/redhat_access/cases_helper_test.rb
349
- - test/unit/helpers/redhat_access/analytics_dashboard_helper_test.rb
350
- - test/unit/helpers/redhat_access/search_helper_test.rb
351
347
  - test/unit/helpers/redhat_access/logs_helper_test.rb
352
348
  - test/unit/helpers/redhat_access/log_viewer_helper_test.rb
349
+ - test/unit/helpers/redhat_access/search_helper_test.rb
350
+ - test/unit/helpers/redhat_access/telemetry_configuration_helper_test.rb
351
+ - test/unit/helpers/redhat_access/analytics_dashboard_helper_test.rb
352
+ - test/unit/helpers/redhat_access/attachments_helper_test.rb
353
+ - test/unit/helpers/redhat_access/cases_helper_test.rb
354
+ - test/unit/redhat_access/telemetry_configuration_test.rb
355
+ - test/test_helper.rb
356
+ - test/models/redhat_access/telemetry_proxy_credentials_test.rb
357
+ - test/functional/redhat_access/telemetry_configuration_controller_test.rb
358
+ - test/functional/redhat_access/redhat_access_controller_test.rb
359
+ - test/functional/redhat_access/attachments_controller_test.rb
360
+ - test/functional/redhat_access/search_controller_test.rb
361
+ - test/functional/redhat_access/analytics_dashboard_controller_test.rb
362
+ - test/functional/redhat_access/configuration_controller_test.rb
363
+ - test/functional/redhat_access/logs_controller_test.rb
364
+ - test/functional/redhat_access/cases_controller_test.rb
365
+ - test/functional/redhat_access/log_viewer_controller_test.rb
366
+ - test/redhat_access_test.rb
353
367
  - test/sos-report-test.rb
354
- - test/dummy/app/controllers/application_controller.rb
355
- - test/dummy/app/views/layouts/application.html.erb
356
- - test/dummy/app/assets/javascripts/application.js
357
- - test/dummy/app/assets/stylesheets/application.css
358
- - test/dummy/app/helpers/application_helper.rb
368
+ - test/dummy/README.rdoc
359
369
  - test/dummy/config/routes.rb
360
- - test/dummy/config/locales/en.yml
370
+ - test/dummy/config/initializers/wrap_parameters.rb
371
+ - test/dummy/config/initializers/session_store.rb
372
+ - test/dummy/config/initializers/mime_types.rb
373
+ - test/dummy/config/initializers/inflections.rb
374
+ - test/dummy/config/initializers/backtrace_silencers.rb
375
+ - test/dummy/config/initializers/secret_token.rb
361
376
  - test/dummy/config/environments/production.rb
362
377
  - test/dummy/config/environments/development.rb
363
378
  - test/dummy/config/environments/test.rb
364
- - test/dummy/config/environment.rb
365
- - test/dummy/config/application.rb
366
379
  - test/dummy/config/database.yml
380
+ - test/dummy/config/application.rb
381
+ - test/dummy/config/locales/en.yml
382
+ - test/dummy/config/environment.rb
367
383
  - test/dummy/config/boot.rb
368
- - test/dummy/config/initializers/backtrace_silencers.rb
369
- - test/dummy/config/initializers/mime_types.rb
370
- - test/dummy/config/initializers/session_store.rb
371
- - test/dummy/config/initializers/wrap_parameters.rb
372
- - test/dummy/config/initializers/secret_token.rb
373
- - test/dummy/config/initializers/inflections.rb
384
+ - test/dummy/public/404.html
385
+ - test/dummy/public/500.html
386
+ - test/dummy/public/422.html
387
+ - test/dummy/public/favicon.ico
388
+ - test/dummy/app/helpers/application_helper.rb
389
+ - test/dummy/app/views/layouts/application.html.erb
390
+ - test/dummy/app/assets/stylesheets/application.css
391
+ - test/dummy/app/assets/javascripts/application.js
392
+ - test/dummy/app/controllers/application_controller.rb
374
393
  - test/dummy/config.ru
375
- - test/dummy/script/rails
376
394
  - test/dummy/Rakefile
377
- - test/dummy/public/favicon.ico
378
- - test/dummy/public/422.html
379
- - test/dummy/public/500.html
380
- - test/dummy/public/404.html
381
- - test/dummy/README.rdoc
382
- - test/integration/navigation_test.rb
383
- - test/models/redhat_access/telemetry_proxy_credentials_test.rb
384
- - test/redhat_access_test.rb
395
+ - test/dummy/script/rails
385
396
  - test/fixtures/redhat_access/telemetry_configurations.yml
386
397
  - test/fixtures/redhat_access/telemetry_proxy_credentials.yml
387
- - test/test_helper.rb
388
- - test/functional/redhat_access/analytics_dashboard_controller_test.rb
389
- - test/functional/redhat_access/redhat_access_controller_test.rb
390
- - test/functional/redhat_access/logs_controller_test.rb
391
- - test/functional/redhat_access/search_controller_test.rb
392
- - test/functional/redhat_access/telemetry_configuration_controller_test.rb
393
- - test/functional/redhat_access/log_viewer_controller_test.rb
394
- - test/functional/redhat_access/attachments_controller_test.rb
395
- - test/functional/redhat_access/configuration_controller_test.rb
396
- - test/functional/redhat_access/cases_controller_test.rb