redhat_access 2.2.7 → 2.2.8

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: b740339358ef572af5ca6bc1df7226e0b00eff8ab6e3740d3715b8a07af199ea
4
- data.tar.gz: b996a6399e8a2c120ea0e7958f8e35eb8ef243c2346e121b890a809c53c02edf
3
+ metadata.gz: 06eace60e082178a03ecb70b5e9e074b59de66baf85ff9cdbbd5704ee72c6e26
4
+ data.tar.gz: 947a47fbdc1da0bfcf31a3ff0e6aaffbb88e08912c72be9ab9f94fc70ca68036
5
5
  SHA512:
6
- metadata.gz: 85e504f465a34208d70866c1776c49dab33cf1d362b4406d8a071a51da8333a2d88d8b3278de9aa2b74ab450badf54a1459b4e0f3435f7966bf4a0a7a4a99f65
7
- data.tar.gz: 0e691f651455847d24ac38e46288215eef9c6fcd2bec624ab2f024c38dcb3a6b4eefa6579207794ec1e96a52c4b3d91006eb94ee58ae82d3ff3f96020f015336
6
+ metadata.gz: 512e7a807786b57d014dab005e5a31881f0eb3002aa29ceda6036b9fef68391698374d390a3cb33758825fd4f9916651b982714ed942a2311d3181b4af28ee4c
7
+ data.tar.gz: 9b93f4a0e89392eb16aa15ef7f5f20df33bace669b62f79c3ce665c5573bddb2d38f9f09ac1b8139e4d59a85e48d9315a0967e3bb4c5564fcf86566654da6a17
@@ -36,7 +36,7 @@ module RedhatAccess
36
36
 
37
37
  def api_connection_test
38
38
  client = get_api_client
39
- res = client.call_tapi('GET', '/', nil, nil, nil)
39
+ res = client.call_tapi('GET', '/', nil, nil, {timeout: get_tapi_timeout})
40
40
  Rails.logger.debug(res[:data])
41
41
  render status: res[:code], json: {}
42
42
  end
@@ -61,7 +61,7 @@ module RedhatAccess
61
61
 
62
62
  client = get_api_client
63
63
  Rails.logger.debug("Proxy upload original_payload : #{original_payload}")
64
- res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, nil, use_subsets)
64
+ res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, {timeout: get_upload_timeout}, use_subsets)
65
65
  render status: res[:code] , json: res[:data]
66
66
  end
67
67
 
@@ -65,7 +65,7 @@ module RedhatAccess
65
65
 
66
66
  def connection_status
67
67
  client = get_api_client
68
- res = client.call_tapi('GET', 'me', nil, nil, nil)
68
+ res = client.call_tapi('GET', 'me', nil, nil, {timeout: get_tapi_timeout})
69
69
  Rails.logger.debug(res[:data])
70
70
  case res[:code]
71
71
  when 200
@@ -117,7 +117,7 @@ module RedhatAccess
117
117
  end
118
118
 
119
119
  client = get_api_client
120
- res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, nil, use_subsets)
120
+ res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, {timeout: get_tapi_timeout}, use_subsets)
121
121
  #401 erros 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]
@@ -19,7 +19,7 @@ module RedhatAccess
19
19
  else
20
20
  render json: {:error=>"Invalid parameters"}.to_json, status: 400
21
21
  end
22
- rescue=>e
22
+ rescue => e
23
23
  Rails.logger.info(e)
24
24
  render json: {:error=>"Error processing update"}.to_json, status: 500
25
25
  end
@@ -210,7 +210,6 @@ module RedhatAccess
210
210
  "#{get_plugin_parent_name}/#{get_plugin_parent_version};#{get_rha_plugin_name}/#{get_rha_plugin_version}"
211
211
  end
212
212
 
213
-
214
213
  def get_http_options(include_user_id = false)
215
214
  headers = {}
216
215
  if include_user_id && User.current
@@ -222,6 +221,22 @@ module RedhatAccess
222
221
  :headers => headers}
223
222
  end
224
223
 
224
+ # global use_subsets flag - defaults to false to suppress use of subsets to address scalability problems
225
+ # (subset and branch_id are equivalent for satellite)
226
+ def use_subsets?
227
+ REDHAT_ACCESS_CONFIG[:use_subsets] || false
228
+ end
229
+
230
+ # timeout for telemetry api operations
231
+ def get_tapi_timeout
232
+ REDHAT_ACCESS_CONFIG[:telemetry_api_timeout_s] || 60
233
+ end
234
+
235
+ # timeout for telemetry uploads
236
+ def get_upload_timeout
237
+ REDHAT_ACCESS_CONFIG[:telemetry_upload_timeout_s] || 120
238
+ end
239
+
225
240
  def user_login_to_hash(login)
226
241
  Digest::SHA1.hexdigest(login)
227
242
  end
@@ -164,7 +164,7 @@ module RedhatAccess
164
164
  #{:branch_id => @branch_id}.merge(options[:params]),
165
165
  options[:params],
166
166
  options[:payload],
167
- nil,
167
+ {timeout: get_tapi_timeout},
168
168
  options[:use_subsets])
169
169
  if res.key?(:error)
170
170
  raise res[:error]
@@ -20,6 +20,11 @@ module RedhatAccess
20
20
  @context = context
21
21
  end
22
22
 
23
+ # intercept call_tapi() so we can override use of subsets
24
+ def call_tapi(original_method, resource, original_params, original_payload, extra, use_subsets = true)
25
+ super(original_method, resource, original_params, original_payload, extra, use_subsets? && use_subsets)
26
+ end
27
+
23
28
  # Returns the branch id of the current org/account
24
29
  def get_branch_id
25
30
  organization = get_current_organization
@@ -6,8 +6,11 @@
6
6
 
7
7
  :enable_telemetry_basic_auth : false
8
8
  :telemetry_upload_host : "https://cert-api.access.redhat.com"
9
+ # :telemetry_upload_timeout_s : 120
9
10
  :telemetry_api_host : "https://cert-api.access.redhat.com"
11
+ # :telemetry_api_timeout_s : 60
10
12
  :telemetry_ssl_verify_peer : true
13
+ :use_subsets : false
11
14
 
12
15
  :diagnostic_logs :
13
16
  - /var/log/foreman/production.log
data/config/defaults.yml CHANGED
@@ -9,6 +9,8 @@
9
9
  :telemetry_api_host : "https://cert-api.access.redhat.com"
10
10
  :telemetry_ssl_verify_peer : true
11
11
 
12
+ :use_subsets : false
13
+
12
14
  :diagnostic_logs :
13
15
  - /var/log/foreman/production.log
14
16
  - /var/log/foreman/delayed_job.log
@@ -1,3 +1,3 @@
1
1
  module RedhatAccess
2
- VERSION = "2.2.7"
2
+ VERSION = "2.2.8"
3
3
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.files = Dir["{app,config,db,lib,vendor,public,script,ca,locale}/**/*"] + ["LICENSE.txt", "Rakefile", "README.rdoc", "redhat_access.gemspec", "Gemfile"]
18
18
  s.test_files = Dir["test/**/*"]
19
- s.add_dependency "redhat_access_lib" , ">=1.1.0"
19
+ s.add_dependency "redhat_access_lib" , ">=1.1.5"
20
20
  s.add_dependency "angular-rails-templates", ">=0.0.4"
21
21
 
22
22
  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.2.7
4
+ version: 2.2.8
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: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redhat_access_lib
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 1.1.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.0
26
+ version: 1.1.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: angular-rails-templates
29
29
  requirement: !ruby/object:Gem::Requirement