redhat_access 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +24 -0
  3. data/LICENSE.txt +620 -0
  4. data/README.rdoc +7 -0
  5. data/Rakefile +131 -0
  6. data/app/assets/javascripts/insights/app.module.js +64 -0
  7. data/app/assets/javascripts/insights/application.js +18 -0
  8. data/app/assets/javascripts/insights/configuration.controller.js +66 -0
  9. data/app/assets/javascripts/insights/configuration.service.js +28 -0
  10. data/app/assets/javascripts/insights/views/configuration.html +85 -0
  11. data/app/assets/javascripts/insights/views/error.html +13 -0
  12. data/app/assets/javascripts/insights/views/help.html +16 -0
  13. data/app/assets/javascripts/redhat_access/analytics_dashboard.js +2 -0
  14. data/app/assets/javascripts/redhat_access/application.js +15 -0
  15. data/app/assets/javascripts/redhat_access/redhat_access.module.js +126 -0
  16. data/app/assets/stylesheets/insights/application.css +14 -0
  17. data/app/assets/stylesheets/insights/insights.css +21 -0
  18. data/app/assets/stylesheets/redhat_access/application.css +14 -0
  19. data/app/assets/stylesheets/redhat_access/telemetry_configuration.css +4 -0
  20. data/app/controllers/redhat_access/analytics_dashboard_controller.rb +12 -0
  21. data/app/controllers/redhat_access/api/api_controller.rb +24 -0
  22. data/app/controllers/redhat_access/api/attachments_controller.rb +40 -0
  23. data/app/controllers/redhat_access/api/logs_controller.rb +49 -0
  24. data/app/controllers/redhat_access/api/machine_telemetry_api_controller.rb +112 -0
  25. data/app/controllers/redhat_access/api/strata_proxy_controller.rb +81 -0
  26. data/app/controllers/redhat_access/api/telemetry_api_controller.rb +179 -0
  27. data/app/controllers/redhat_access/application_controller.rb +2 -0
  28. data/app/controllers/redhat_access/cases_controller.rb +14 -0
  29. data/app/controllers/redhat_access/configuration_controller.rb +21 -0
  30. data/app/controllers/redhat_access/log_viewer_controller.rb +9 -0
  31. data/app/controllers/redhat_access/redhat_access_controller.rb +8 -0
  32. data/app/controllers/redhat_access/search_controller.rb +9 -0
  33. data/app/controllers/redhat_access/strata_credentials_controller.rb +48 -0
  34. data/app/controllers/redhat_access/telemetry_configurations_controller.rb +38 -0
  35. data/app/controllers/redhat_access/telemetry_controller.rb +6 -0
  36. data/app/helpers/redhat_access/analytics_dashboard_helper.rb +13 -0
  37. data/app/helpers/redhat_access/application_helper.rb +4 -0
  38. data/app/helpers/redhat_access/attachments_helper.rb +4 -0
  39. data/app/helpers/redhat_access/cases_helper.rb +4 -0
  40. data/app/helpers/redhat_access/log_viewer_helper.rb +4 -0
  41. data/app/helpers/redhat_access/logs_helper.rb +4 -0
  42. data/app/helpers/redhat_access/redhat_access_helper.rb +4 -0
  43. data/app/helpers/redhat_access/search_helper.rb +4 -0
  44. data/app/helpers/redhat_access/telemetry_configuration_helper.rb +4 -0
  45. data/app/models/redhat_access/concerns/organization_extensions.rb +10 -0
  46. data/app/models/redhat_access/telemetry_configuration.rb +11 -0
  47. data/app/models/redhat_access/telemetry_proxy_credentials.rb +10 -0
  48. data/app/services/redhat_access/authentication/client_authentication.rb +80 -0
  49. data/app/services/redhat_access/telemetry/look_ups.rb +233 -0
  50. data/app/services/redhat_access/telemetry/portal_client.rb +39 -0
  51. data/app/views/redhat_access/analytics_dashboard/configuration.html.erb +85 -0
  52. data/app/views/redhat_access/analytics_dashboard/error.html.erb +13 -0
  53. data/app/views/redhat_access/analytics_dashboard/help.html.erb +16 -0
  54. data/app/views/redhat_access/analytics_dashboard/index.html.erb +69 -0
  55. data/app/views/redhat_access/analytics_dashboard/welcome.html.erb +8 -0
  56. data/app/views/redhat_access/redhat_access/index.html.erb +34 -0
  57. data/ca/rh_cert-api_chain.pem +74 -0
  58. data/config/config.yml.example +15 -0
  59. data/config/environments/development.rb +5 -0
  60. data/config/initializers/load_config.rb +5 -0
  61. data/config/mount_engine.rb +3 -0
  62. data/config/routes.rb +36 -0
  63. data/db/migrate/20141204161152_create_redhat_access_telemetry_proxy_credentials.rb +11 -0
  64. data/db/migrate/20150319153744_create_redhat_access_telemetry_configurations.rb +13 -0
  65. data/db/migrate/20160425175501_add_email_to_telemetry_configurations.rb +5 -0
  66. data/db/seeds.d/200-update-insights-roles.rb +11 -0
  67. data/lib/redhat_access/configuration.rb +8 -0
  68. data/lib/redhat_access/engine.rb +225 -0
  69. data/lib/redhat_access/sos_reports/generator.rb +58 -0
  70. data/lib/redhat_access/strata/client.rb +39 -0
  71. data/lib/redhat_access/version.rb +3 -0
  72. data/lib/redhat_access.rb +5 -0
  73. data/lib/tasks/redhat_access_tasks.rake +41 -0
  74. data/locale/Makefile +62 -0
  75. data/locale/de/LC_MESSAGES/redhat_access.mo +0 -0
  76. data/locale/de/redhat_access.po +589 -0
  77. data/locale/es/LC_MESSAGES/redhat_access.mo +0 -0
  78. data/locale/es/redhat_access.po +589 -0
  79. data/locale/fr/LC_MESSAGES/redhat_access.mo +0 -0
  80. data/locale/fr/redhat_access.po +593 -0
  81. data/locale/gemspec.rb +2 -0
  82. data/locale/it/LC_MESSAGES/redhat_access.mo +0 -0
  83. data/locale/it/redhat_access.po +589 -0
  84. data/locale/ja/LC_MESSAGES/redhat_access.mo +0 -0
  85. data/locale/ja/redhat_access.po +569 -0
  86. data/locale/ko/LC_MESSAGES/redhat_access.mo +0 -0
  87. data/locale/ko/redhat_access.po +570 -0
  88. data/locale/pt/LC_MESSAGES/redhat_access.mo +0 -0
  89. data/locale/pt/redhat_access.po +588 -0
  90. data/locale/redhat_access.pot +34 -0
  91. data/locale/ru/LC_MESSAGES/redhat_access.mo +0 -0
  92. data/locale/ru/redhat_access.po +580 -0
  93. data/locale/zh/LC_MESSAGES/redhat_access.mo +0 -0
  94. data/locale/zh/redhat_access.po +561 -0
  95. data/redhat_access.gemspec +30 -0
  96. data/script/rails +8 -0
  97. data/script/sos_reports/foreman_sosreport.pam +9 -0
  98. data/script/sos_reports/foreman_sosreport_console.apps +3 -0
  99. data/script/sos_reports/foreman_sosreport_wrapper.py +65 -0
  100. data/test/dummy/README.rdoc +261 -0
  101. data/test/dummy/Rakefile +7 -0
  102. data/test/dummy/app/assets/javascripts/application.js +15 -0
  103. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  104. data/test/dummy/app/controllers/application_controller.rb +3 -0
  105. data/test/dummy/app/helpers/application_helper.rb +2 -0
  106. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  107. data/test/dummy/config/application.rb +59 -0
  108. data/test/dummy/config/boot.rb +10 -0
  109. data/test/dummy/config/database.yml +25 -0
  110. data/test/dummy/config/environment.rb +5 -0
  111. data/test/dummy/config/environments/development.rb +37 -0
  112. data/test/dummy/config/environments/production.rb +67 -0
  113. data/test/dummy/config/environments/test.rb +37 -0
  114. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  115. data/test/dummy/config/initializers/inflections.rb +15 -0
  116. data/test/dummy/config/initializers/mime_types.rb +5 -0
  117. data/test/dummy/config/initializers/secret_token.rb +7 -0
  118. data/test/dummy/config/initializers/session_store.rb +8 -0
  119. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  120. data/test/dummy/config/locales/en.yml +5 -0
  121. data/test/dummy/config/routes.rb +4 -0
  122. data/test/dummy/config.ru +4 -0
  123. data/test/dummy/public/404.html +26 -0
  124. data/test/dummy/public/422.html +26 -0
  125. data/test/dummy/public/500.html +25 -0
  126. data/test/dummy/public/favicon.ico +0 -0
  127. data/test/dummy/script/rails +6 -0
  128. data/test/fixtures/redhat_access/telemetry_configurations.yml +11 -0
  129. data/test/fixtures/redhat_access/telemetry_proxy_credentials.yml +11 -0
  130. data/test/functional/redhat_access/analytics_dashboard_controller_test.rb +11 -0
  131. data/test/functional/redhat_access/attachments_controller_test.rb +11 -0
  132. data/test/functional/redhat_access/cases_controller_test.rb +16 -0
  133. data/test/functional/redhat_access/configuration_controller_test.rb +11 -0
  134. data/test/functional/redhat_access/log_viewer_controller_test.rb +11 -0
  135. data/test/functional/redhat_access/logs_controller_test.rb +9 -0
  136. data/test/functional/redhat_access/redhat_access_controller_test.rb +11 -0
  137. data/test/functional/redhat_access/search_controller_test.rb +11 -0
  138. data/test/functional/redhat_access/telemetry_configuration_controller_test.rb +26 -0
  139. data/test/integration/navigation_test.rb +10 -0
  140. data/test/models/redhat_access/telemetry_proxy_credentials_test.rb +9 -0
  141. data/test/redhat_access_test.rb +7 -0
  142. data/test/sos-report-test.rb +32 -0
  143. data/test/test_helper.rb +15 -0
  144. data/test/unit/helpers/redhat_access/analytics_dashboard_helper_test.rb +6 -0
  145. data/test/unit/helpers/redhat_access/attachments_helper_test.rb +6 -0
  146. data/test/unit/helpers/redhat_access/cases_helper_test.rb +6 -0
  147. data/test/unit/helpers/redhat_access/log_viewer_helper_test.rb +6 -0
  148. data/test/unit/helpers/redhat_access/logs_helper_test.rb +6 -0
  149. data/test/unit/helpers/redhat_access/redhat_access_helper_test.rb +6 -0
  150. data/test/unit/helpers/redhat_access/search_helper_test.rb +6 -0
  151. data/test/unit/helpers/redhat_access/telemetry_configuration_helper_test.rb +6 -0
  152. data/test/unit/redhat_access/telemetry_configuration_test.rb +9 -0
  153. data/vendor/assets/fonts/fonts/FontAwesome.otf +0 -0
  154. data/vendor/assets/fonts/fonts/fontawesome-webfont.eot +0 -0
  155. data/vendor/assets/fonts/fonts/fontawesome-webfont.svg +655 -0
  156. data/vendor/assets/fonts/fonts/fontawesome-webfont.ttf +0 -0
  157. data/vendor/assets/fonts/fonts/fontawesome-webfont.woff +0 -0
  158. data/vendor/assets/fonts/fonts/icomoon.eot +0 -0
  159. data/vendor/assets/fonts/fonts/icomoon.svg +22 -0
  160. data/vendor/assets/fonts/fonts/icomoon.ttf +0 -0
  161. data/vendor/assets/fonts/fonts/icomoon.woff +0 -0
  162. data/vendor/assets/fonts/fonts/overpass_bold-web.eot +0 -0
  163. data/vendor/assets/fonts/fonts/overpass_bold-web.svg +454 -0
  164. data/vendor/assets/fonts/fonts/overpass_bold-web.ttf +0 -0
  165. data/vendor/assets/fonts/fonts/overpass_bold-web.woff +0 -0
  166. data/vendor/assets/fonts/fonts/overpass_light-webfont.eot +0 -0
  167. data/vendor/assets/fonts/fonts/overpass_light-webfont.svg +2105 -0
  168. data/vendor/assets/fonts/fonts/overpass_light-webfont.ttf +0 -0
  169. data/vendor/assets/fonts/fonts/overpass_light-webfont.woff +0 -0
  170. data/vendor/assets/fonts/fonts/overpass_regular-web.eot +0 -0
  171. data/vendor/assets/fonts/fonts/overpass_regular-web.svg +454 -0
  172. data/vendor/assets/fonts/fonts/overpass_regular-web.ttf +0 -0
  173. data/vendor/assets/fonts/fonts/overpass_regular-web.woff +0 -0
  174. data/vendor/assets/fonts/fonts/portalicons.eot +0 -0
  175. data/vendor/assets/fonts/fonts/portalicons.svg +145 -0
  176. data/vendor/assets/fonts/fonts/portalicons.ttf +0 -0
  177. data/vendor/assets/fonts/fonts/portalicons.woff +0 -0
  178. data/vendor/assets/images/images/Icon_RH_Document_Blueprint_RGB_Button.png +0 -0
  179. data/vendor/assets/images/images/Icon_RH_Misc_Lifestyle_RGB_Button.png +0 -0
  180. data/vendor/assets/images/images/Icon_RH_Software_Data_CMYK_Button.png +0 -0
  181. data/vendor/assets/images/images/Icon_RH_Software_Transfer-Upload_CMYK_Button.png +0 -0
  182. data/vendor/assets/images/images/bg1.jpg +0 -0
  183. data/vendor/assets/images/images/bg_body.jpg +0 -0
  184. data/vendor/assets/images/images/bg_chart-shadow.png +0 -0
  185. data/vendor/assets/images/images/bg_dount-hole-na.png +0 -0
  186. data/vendor/assets/images/images/bg_glow.jpg +0 -0
  187. data/vendor/assets/images/images/bg_pattern.png +0 -0
  188. data/vendor/assets/images/images/i_chart.png +0 -0
  189. data/vendor/assets/images/images/img-insights-connection-sat.png +0 -0
  190. data/vendor/assets/images/images/img-insights-connection.png +0 -0
  191. data/vendor/assets/images/images/img-sat5-step2-admin.png +0 -0
  192. data/vendor/assets/images/images/img-sat5-step3-completed.png +0 -0
  193. data/vendor/assets/images/images/img-sat5-step3-pending.png +0 -0
  194. data/vendor/assets/images/images/img-sat5-step3-setup.png +0 -0
  195. data/vendor/assets/images/images/img-sat5-step5-overview.png +0 -0
  196. data/vendor/assets/images/images/img-sat5-step5-reports.png +0 -0
  197. data/vendor/assets/images/images/img-sat5-step5-systems.png +0 -0
  198. data/vendor/assets/images/images/img-sat6-step2.jpg +0 -0
  199. data/vendor/assets/images/images/img-sat6-step3.jpg +0 -0
  200. data/vendor/assets/images/images/img-sat6-step3.png +0 -0
  201. data/vendor/assets/images/images/img-sat6-step4.jpg +0 -0
  202. data/vendor/assets/images/images/img-sat6-step5a.jpg +0 -0
  203. data/vendor/assets/images/images/img-sat6-step5b.jpg +0 -0
  204. data/vendor/assets/images/images/img-sat6-step5c.jpg +0 -0
  205. data/vendor/assets/images/images/img-sat6-step5d.jpg +0 -0
  206. data/vendor/assets/images/images/keynote-snap.jpg +0 -0
  207. data/vendor/assets/images/images/keynote-snap.png +0 -0
  208. data/vendor/assets/images/images/splash-gettingstarted.jpg +0 -0
  209. data/vendor/assets/images/images/splash-learnmore.jpg +0 -0
  210. data/vendor/assets/images/images/splash-security.jpg +0 -0
  211. data/vendor/assets/javascripts/angular/angular.js +20131 -0
  212. data/vendor/assets/javascripts/redhat_access/redhat_access_angular_ui-deps.js +14103 -0
  213. data/vendor/assets/javascripts/redhat_access/redhat_access_angular_ui.js +7854 -0
  214. data/vendor/assets/javascripts/telemetry/insights.js +39 -0
  215. data/vendor/assets/stylesheets/redhat_access/redhat_access_angular_ui-deps.css +11 -0
  216. data/vendor/assets/stylesheets/redhat_access/redhat_access_angular_ui.css +1 -0
  217. data/vendor/assets/stylesheets/telemetry/sat6.css +18 -0
  218. metadata +341 -0
@@ -0,0 +1,74 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIHZDCCBUygAwIBAgIJAOb+QiglyeZeMA0GCSqGSIb3DQEBBQUAMIGwMQswCQYD
3
+ VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcMB1JhbGVp
4
+ Z2gxFjAUBgNVBAoMDVJlZCBIYXQsIEluYy4xGDAWBgNVBAsMD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onZhfZS6SjKm0UmwoV6o3V1ED6y7muQNRmgDpA5PcbvO
69
+ gl7OexNL4zcpyfMdAmTYf5yTRSvB42Yg5hVfuzPEnOIqupwES3mWkEHRlqbMUkHw
70
+ qIQAxIwQqZd5PdPpElQ/6j/ZT9DwW/I6zgndX2rsS0oGYcwFTkSj0/rKKkC13hk7
71
+ LchXMZu5ckdustM79U6OZIBairrJaL2OpR08un2nwIjgEGqhVFYc44UK1VpkE8mr
72
+ qvqJS6OHVlTlKcEDnhVkPS3i5qjuS/PtSq0CwH8bzYKFJayLDY/z36Zv6PdttzmU
73
+ Yb1NSDcJejHJ80pMINutyYQ=
74
+ -----END CERTIFICATE-----
@@ -0,0 +1,15 @@
1
+ :strata_host : access.redhat.com
2
+ :attachment_max_http_size : 250000000
3
+ :attachment_ftp_host : dropbox.redhat.com
4
+ :attachment_ftp_dir : /incoming
5
+ :deployment : satellite
6
+
7
+ :enable_telemetry_basic_auth : false
8
+ :telemetry_upload_host : "https://cert-api.access.redhat.com"
9
+ :telemetry_api_host : "https://cert-api.access.redhat.com"
10
+ :telemetry_ssl_verify_peer : true
11
+
12
+ :diagnostic_logs :
13
+ - /var/log/foreman/production.log
14
+ - /var/log/foreman/delayed_job.log
15
+ - /var/log/foreman/jobs-startup.log
@@ -0,0 +1,5 @@
1
+ Foreman::Application.configure do
2
+ config.assets.debug = false
3
+ config.assets.compress = true
4
+ config.assets.compile = true
5
+ end
@@ -0,0 +1,5 @@
1
+ if File.exists? ("#{RedhatAccess::Engine.root}/config/config.yml")
2
+ REDHAT_ACCESS_CONFIG = YAML.load_file("#{RedhatAccess::Engine.root}/config/config.yml")
3
+ elsif File.exists? ('/etc/redhat_access/config.yml')
4
+ REDHAT_ACCESS_CONFIG = YAML.load_file('/etc/redhat_access/config.yml')
5
+ end
@@ -0,0 +1,3 @@
1
+ Foreman::Application.routes.draw do
2
+ mount RedhatAccess::Engine, :at => "/redhat_access", :as => 'redhat_access'
3
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,36 @@
1
+ RedhatAccess::Engine.routes.draw do
2
+
3
+ #API routes
4
+ get 'configuration' => 'configuration#index'
5
+ get 'logs' => 'api/logs#index'
6
+ get 'attachments' => 'api/attachments#index'
7
+ post 'attachments' => 'api/attachments#create'
8
+
9
+ unless Foreman::Plugin.installed?('foreman_sam')
10
+ scope '/' do
11
+ resource :telemetry_configuration, only: [:show, :update]
12
+ end
13
+ get "/insights/templates/:page" => "analytics_dashboard#template" # hack to get around angular-rails-templates bug
14
+ scope '/r/insights' do
15
+ get '/', to: 'api/machine_telemetry_api#api_connection_test'
16
+ get '/v1/branch_info', to: 'api/machine_telemetry_api#get_branch_info'
17
+ post '/uploads/(:id)', to: 'api/machine_telemetry_api#proxy_upload'
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]
20
+ match '/:path', to: 'api/machine_telemetry_api#proxy', :constraints => {:path => /.*/}, via: [:get, :post, :delete,:put]
21
+ end
22
+ get 'insights', to: 'analytics_dashboard#index'
23
+ get 'analytics_configuration', to: 'telemetry_configuration#index'
24
+ match '/insights/*path', to: 'analytics_dashboard#index', via: [:get]
25
+ end
26
+
27
+ scope '/strata' do
28
+ match '/:path', to: 'api/strata_proxy#call', :constraints => {:path => /.*/}, via: [:get, :post, :delete,:put]
29
+ end
30
+
31
+ #Angular UI routes
32
+
33
+ match '/:path', to: 'redhat_access#index', :constraints => {:path => /.*/}, :via => [:get]
34
+ root :to => 'redhat_access#index'
35
+
36
+ end
@@ -0,0 +1,11 @@
1
+ class CreateRedhatAccessTelemetryProxyCredentials < ActiveRecord::Migration
2
+ def change
3
+ create_table :redhat_access_telemetry_proxy_credentials do |t|
4
+ t.string :username
5
+ t.string :password
6
+ t.string :strata_url
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateRedhatAccessTelemetryConfigurations < ActiveRecord::Migration
2
+ def change
3
+ create_table :redhat_access_telemetry_configurations do |t|
4
+ t.string :portal_user
5
+ t.string :portal_password
6
+ t.boolean :enable_telemetry
7
+ t.integer :organization_id
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :redhat_access_telemetry_configurations, :organization_id
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddEmailToTelemetryConfigurations < ActiveRecord::Migration
2
+ def change
3
+ add_column :redhat_access_telemetry_configurations, :email, :string
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ Role.without_auditing do
2
+ insights_admin_role = Role.where(:name => "Access Insights Admin").first
3
+ insights_viewer_role = Role.where(:name => "Access Insights Viewer").first
4
+ view_host_perm = Permission.find_by_name(:view_hosts)
5
+ if insights_admin_role
6
+ insights_admin_role.add_permissions!(:view_hosts) unless insights_admin_role.has_permission?(view_host_perm)
7
+ end
8
+ if insights_viewer_role
9
+ insights_viewer_role.add_permissions!(:view_hosts) unless insights_viewer_role.has_permission?(view_host_perm)
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module RedhatAccess
2
+ class Configuration
3
+ attr_reader :api
4
+ def initialize()
5
+
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,225 @@
1
+ # require 'fast_gettext'
2
+ # require 'gettext_i18n_rails'
3
+ # require 'deface'
4
+ begin
5
+ # Since we depend on katello, need to force it load so our plugin
6
+ # dependency checks can work properly
7
+ require 'katello'
8
+ require 'foreman_sam.rb'
9
+ rescue Exception => error
10
+ # don't need to do anything
11
+ end
12
+
13
+ module RedhatAccess
14
+ class Engine < ::Rails::Engine
15
+ isolate_namespace RedhatAccess
16
+
17
+ initializer 'redhat_access.load_app_instance_data' do |app|
18
+ unless app.root.to_s.match root.to_s
19
+ config.paths["db/migrate"].expanded.each do |expanded_path|
20
+ app.config.paths["db/migrate"] << expanded_path
21
+ end
22
+ end
23
+ end
24
+
25
+ initializer 'redhat_access.mount_engine', :after => :build_middleware_stack do |app|
26
+ app.routes_reloader.paths << "#{RedhatAccess::Engine.root}/config/mount_engine.rb"
27
+ app.reload_routes!
28
+ end
29
+
30
+ # Precompile any JS or CSS files under app/assets/
31
+ # If requiring files from each other, list them explicitly here to avoid precompiling the same
32
+ # content twice.
33
+ assets_to_precompile = [
34
+ 'redhat_access/application.js',
35
+ 'redhat_access/application.css',
36
+ 'insights/application.js',
37
+ 'insights/application.css'
38
+ ]
39
+ initializer 'redhat_access.assets.precompile' do |app|
40
+ app.config.assets.precompile += assets_to_precompile
41
+ end
42
+ initializer 'redhat_access.configure_assets', :group => :assets do
43
+ SETTINGS[:redhat_access] = {:assets => {:precompile => assets_to_precompile}}
44
+ end
45
+
46
+ initializer :security_initialization do |app|
47
+ app.config.filter_parameters << :authToken
48
+ end
49
+
50
+ initializer 'redhat_access.register_gettext', :after => :load_config_initializers do |_app|
51
+ locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
52
+ locale_domain = 'redhat_access'
53
+ Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
54
+ end
55
+
56
+ initializer :config_csp_headers do |_app|
57
+ ::SecureHeaders::Configuration.configure do |config|
58
+ if config && config.csp
59
+ if config.csp[:frame_src]
60
+ config.csp[:frame_src] = config.csp[:frame_src] << ' *.redhat.com *.force.com'
61
+ end
62
+ if config.csp[:connect_src]
63
+ config.csp[:connect_src] = config.csp[:connect_src] << ' *.redhat.com'
64
+ end
65
+ if config.csp[:script_src]
66
+ config.csp[:script_src] = config.csp[:script_src] << ' *.redhat.com'
67
+ end
68
+ if config.csp[:img_src]
69
+ config.csp[:img_src] = config.csp[:img_src] << ' *.redhat.com'
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ config.after_initialize do
76
+ Foreman::Plugin.register :redhat_access do
77
+ #
78
+ # Start Monkey Patching
79
+ # Implement our own (temp until we fix foreman upstream)
80
+ #
81
+ class RhaItem < Menu::Item
82
+ def initialize(name, options)
83
+ super(name, options)
84
+ end
85
+
86
+ def authorized?
87
+ return false if @condition and not @condition.call
88
+ User.current.allowed_to?(url_hash.slice(:controller, :action, :id))
89
+ rescue => error
90
+ Rails.logger.error "#{error.message} (#{error.class})\n#{error.backtrace.join("\n")}"
91
+ false
92
+ end
93
+ end
94
+
95
+ def rha_menu(menu, name, options = {})
96
+ options.merge!(:parent => @parent) if @parent
97
+ Menu::Manager.map(menu).push(RhaItem.new(name, options), options)
98
+ end
99
+
100
+ #
101
+ # End monkey patching
102
+ #
103
+
104
+ def sam_deployment?
105
+ # TODO: make generic and move to lib util class
106
+ Foreman::Plugin.installed?('foreman_sam')
107
+ end
108
+
109
+ requires_foreman '> 1.6'
110
+ #requires_foreman_plugin 'katello', '> 3.0.0'
111
+
112
+
113
+ # permission section
114
+ security_block :redhat_access_security do
115
+ # Everything except logs should be available to all users
116
+ permission :view_search, {:"redhat_access/search" => [:index]}, :public => true
117
+ permission :view_cases, {:"redhat_access/cases" => [:index, :create]}, :public => true
118
+ permission :attachments, {:"redhat_access/attachments" => [:index, :create]}, :public => true
119
+ permission :configuration, {:"redhat_access/configuration" => [:index]}, :public => true
120
+ permission :app_root, {:"redhat_access/redhat_access" => [:index]}, :public => true
121
+
122
+ # Logs require special permissions
123
+ permission :view_log_viewer, {:"redhat_access/logviewer" => [:index]}
124
+ permission :logs, {:"redhat_access/logs" => [:index]}
125
+
126
+ unless sam_deployment?
127
+ # Proactive Diagnostics permissions
128
+ permission :rh_telemetry_api, {:"redhat_access/api/telemetry_api" => [:proxy, :connection_status]}
129
+ permission :rh_telemetry_view, {:"redhat_access/analytics_dashboard" => [:index]}
130
+ permission :rh_telemetry_configurations, {:"redhat_access/telemetry_configurations" => [:show, :update]}
131
+ end
132
+ end
133
+ # roles section
134
+ role "Red Hat Access Logs", [:logs, :view_log_viewer]
135
+ unless sam_deployment?
136
+ #Need to be kept in sync with db/seeds.d/20-update-insights-roles
137
+ role "Access Insights Viewer", [:rh_telemetry_api, :rh_telemetry_view]
138
+ role "Access Insights Admin", [:rh_telemetry_api, :rh_telemetry_view, :rh_telemetry_configurations]
139
+ end
140
+ # menus
141
+ sub_menu :header_menu, :redhat_access_menu, :caption => N_('Red Hat Access') do
142
+ menu :header_menu,
143
+ :Search,
144
+ :url => '/redhat_access/search',
145
+ :url_hash => {:controller => :"redhat_access/search", :action => :index},
146
+ :engine => RedhatAccess::Engine,
147
+ :turbolinks => false
148
+ menu :header_menu,
149
+ :LogViewer,
150
+ :url => '/redhat_access/logviewer',
151
+ :url_hash => {:controller => :"redhat_access/logs", :action => :index},
152
+ :engine => RedhatAccess::Engine,
153
+ :caption => N_('Logs'),
154
+ :turbolinks => false
155
+ divider :header_menu, :parent => :redhat_access_menu, :caption => N_('Support')
156
+ menu :header_menu,
157
+ :mycases,
158
+ :url => '/redhat_access/case/list',
159
+ :url_hash => {:controller => :"redhat_access/cases", :action => :index},
160
+ :engine => RedhatAccess::Engine,
161
+ :caption => N_('My Cases'),
162
+ :turbolinks => false
163
+
164
+ menu :header_menu, :new_cases, :caption => N_('Open New Case'),
165
+ :url => '/redhat_access/case/new',
166
+ :url_hash => {:controller => :"redhat_access/cases", :action => :create},
167
+ :engine => RedhatAccess::Engine,
168
+ :turbolinks => false
169
+
170
+ end
171
+
172
+ unless sam_deployment?
173
+ sub_menu :top_menu, :redhat_access_top_menu, :caption => N_('Red Hat Insights') do
174
+ rha_menu :top_menu,
175
+ :rhai_dashboard,
176
+ :caption => N_('Overview'),
177
+ :url => '/redhat_access/insights',
178
+ :url_hash => {:controller => :"redhat_access/analytics_dashboard", :action => :index},
179
+ :engine => RedhatAccess::Engine,
180
+ :turbolinks => false
181
+ rha_menu :top_menu,
182
+ :rhai_actions,
183
+ :caption => N_('Actions'),
184
+ :url => '/redhat_access/insights/actions',
185
+ :url_hash => {:controller => :"redhat_access/analytics_dashboard", :action => :index},
186
+ :engine => RedhatAccess::Engine,
187
+ :turbolinks => false
188
+ rha_menu :top_menu,
189
+ :rhai_inventory,
190
+ :caption => N_('Inventory'),
191
+ :url => '/redhat_access/insights/inventory',
192
+ :url_hash => {:controller => :"redhat_access/analytics_dashboard", :action => :index},
193
+ :engine => RedhatAccess::Engine,
194
+ :turbolinks => false
195
+ rha_menu :top_menu,
196
+ :rhai_rules,
197
+ :caption => N_('Rules'),
198
+ :url => '/redhat_access/insights/rules',
199
+ :url_hash => {:controller => :"redhat_access/analytics_dashboard", :action => :index},
200
+ :engine => RedhatAccess::Engine,
201
+ :turbolinks => false
202
+ rha_menu :top_menu,
203
+ :rhai_configuration,
204
+ :caption => N_('Manage'),
205
+ :url => '/redhat_access/insights/manage',
206
+ :url_hash => {:controller => :"redhat_access/telemetry_configurations", :action => :show},
207
+ :engine => RedhatAccess::Engine,
208
+ :turbolinks => false
209
+ rha_menu :top_menu,
210
+ :rhai_help,
211
+ :caption => N_('Help'),
212
+ :url => '/redhat_access/insights/help',
213
+ :url_hash => {:controller => :"redhat_access/analytics_dashboard", :action => :index},
214
+ :engine => RedhatAccess::Engine,
215
+ :turbolinks => false
216
+ end
217
+ end
218
+ end
219
+ end
220
+
221
+ config.to_prepare do
222
+ ::Organization.send :include, RedhatAccess::Concerns::OrganizationExtensions
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,58 @@
1
+ # This program is free software; you can redistribute it and/or modify
2
+ # it under the terms of the GNU General Public License as published by
3
+ # the Free Software Foundation; either version 2 of the License, or
4
+ # (at your option) any later version.
5
+
6
+ # This program is distributed in the hope that it will be useful,
7
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
8
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
+ # GNU General Public License for more details.
10
+
11
+ # You should have received a copy of the GNU General Public License
12
+ # along with this program; if not, write to the Free Software
13
+ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14
+ require 'open3'
15
+ module RedhatAccess::SosReports
16
+ SOS_COMMAND = "foreman-sosreport --batch -o foreman"
17
+ class Generator
18
+ def self.create_report case_num
19
+ command = SOS_COMMAND
20
+ unless case_num.nil?
21
+ unless is_valid_case_number case_num #security injection check
22
+ raise ArgumentError.new "case number must be an integer"
23
+ else
24
+ command = command + " --ticket-number=#{case_num}"
25
+ end
26
+ end
27
+ begin
28
+ Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
29
+ report_location = ''
30
+ if wait_thr.value == 0
31
+ stdout.readlines.each do |line|
32
+ if line.include? "tar.xz"
33
+ report_location = line #brittle, but we assume only single line
34
+ break
35
+ end
36
+ end
37
+ else
38
+ #puts "sos report failed"
39
+ end
40
+ sos_file_name = report_location.strip
41
+ puts "SOS file created : " + sos_file_name
42
+ sos_file_name
43
+ end
44
+ rescue => exception
45
+ Rails.logger.error("Error Creating SOS report: #{$!}")
46
+ raise exception
47
+ end
48
+
49
+ end
50
+
51
+ def self.is_valid_case_number case_num
52
+ if case_num.nil?
53
+ return false
54
+ end
55
+ case_num.to_s =~ /\A\d+\z/ ? true : false
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,39 @@
1
+ require 'redhat_access_lib'
2
+ require 'base64'
3
+ module RedhatAccess::Strata
4
+ class Client
5
+ attr_reader :api
6
+ def initialize(token)
7
+ username = ""
8
+ password = ""
9
+ unless token.nil?
10
+ token = Base64.decode64(token)
11
+ username,password = token.split(":")
12
+ end
13
+ config = RedHatSupportLib::Network::Config.new
14
+ config.base_uri = 'https://api.' + REDHAT_ACCESS_CONFIG[:strata_host]
15
+ config.username= username
16
+ config.password = password
17
+ config.proxy = get_portal_http_proxy
18
+ attachments_config = {:max_http_size => REDHAT_ACCESS_CONFIG[:attachment_max_http_size],
19
+ :ftp_host => REDHAT_ACCESS_CONFIG[:attachment_ftp_host],
20
+ :ftp_remote_dir => REDHAT_ACCESS_CONFIG[:attachment_ftp_dir]}
21
+ @api = RedHatSupportLib::Api::API.new(config,attachments_config)
22
+ end
23
+
24
+ def get_portal_http_proxy
25
+ proxy = nil
26
+ if Katello.config.cdn_proxy && Katello.config.cdn_proxy.host
27
+ proxy_config = Katello.config.cdn_proxy
28
+ uri = URI('')
29
+ uri.scheme = URI.parse(proxy_config.host).scheme
30
+ uri.host = URI.parse(proxy_config.host).host
31
+ uri.port = proxy_config.port
32
+ uri.user = proxy_config.user
33
+ uri.password = proxy_config.password
34
+ proxy = uri.to_s
35
+ end
36
+ return proxy
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module RedhatAccess
2
+ VERSION = "2.0.0"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "redhat_access/engine"
2
+ require 'angular-rails-templates'
3
+
4
+ module RedhatAccess
5
+ end
@@ -0,0 +1,41 @@
1
+ # desc "Explaining what the task does"
2
+ # task :redhat_access do
3
+ # # Task goes here
4
+ # end
5
+ desc 'Compile stand alone engine assets'
6
+ task 'assets:precompile:engine' do
7
+ require 'sprockets'
8
+ require 'sprockets/railtie'
9
+ require 'uglifier'
10
+ require 'sass/rails/compressor'
11
+ require File.expand_path('../lib/red_hat_access', __FILE__)
12
+
13
+ precompile = [
14
+ 'red_hat_access/articles.js',
15
+ 'red_hat_access/articles.css'
16
+ ]
17
+
18
+ env = Sprockets::Environment.new(RedHatAccess::Engine.root)
19
+ env.js_compressor = Uglifier.new
20
+ env.css_compressor = Sass::Rails::CssCompressor.new
21
+
22
+ paths = [
23
+ 'app/assets/stylesheets',
24
+ 'app/assets/javascripts',
25
+ 'vendor/assets/javascripts',
26
+ 'vendor/assets/stylesheets',
27
+ ]
28
+
29
+ paths.each do |path|
30
+ env.append_path(path)
31
+ end
32
+
33
+ target = File.join(RedHatAccess::Engine.root, 'public', 'assets')
34
+ compiler = Sprockets::StaticCompiler.new(env,
35
+ target,
36
+ precompile,
37
+ :manifest_path => File.join(target),
38
+ :digest => true,
39
+ :manifest => true)
40
+ compiler.compile
41
+ end
data/locale/Makefile ADDED
@@ -0,0 +1,62 @@
1
+ #
2
+ # Makefile for PO merging and MO generation. More info in the README.
3
+ #
4
+ # make all-mo (default) - generate MO files
5
+ # make check - check translations using translate-tool
6
+ # make tx-update - download and merge translations from Transifex
7
+ # make clean - clean everything
8
+ #
9
+ DOMAIN = redhat_access
10
+ VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load(Dir.glob("../*.gemspec")[0]);puts spec.version')
11
+ POTFILE = $(DOMAIN).pot
12
+ MOFILE = $(DOMAIN).mo
13
+ POFILES = $(shell find . -name '*.po')
14
+ MOFILES = $(patsubst %.po,%.mo,$(POFILES))
15
+ POXFILES = $(patsubst %.po,%.pox,$(POFILES))
16
+
17
+ %.mo: %.po
18
+ mkdir -p $(shell dirname $@)/LC_MESSAGES
19
+ msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
20
+
21
+ # Generate MO files from PO files
22
+ all-mo: $(MOFILES)
23
+
24
+ # Check for malformed strings
25
+ %.pox: %.po
26
+ msgfmt -c $<
27
+ pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
28
+ -t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
29
+ cat $@
30
+ ! grep -q msgid $@
31
+
32
+ check: $(POXFILES)
33
+ msgfmt -c ${POTFILE}
34
+
35
+ # Merge PO files
36
+ update-po:
37
+ for f in $(shell find ./ -name "*.po") ; do \
38
+ msgmerge -N --backup=none -U $$f ${POTFILE} ; \
39
+ done
40
+
41
+ # Unify duplicate translations
42
+ uniq-po:
43
+ for f in $(shell find ./ -name "*.po") ; do \
44
+ msguniq $$f -o $$f ; \
45
+ done
46
+
47
+ tx-pull:
48
+ tx pull -f
49
+ for f in $(POFILES) ; do \
50
+ sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
51
+ done
52
+ -git commit -a -m "i18n - pulling from tx"
53
+
54
+ reset-po:
55
+ # merging po files is unnecessary when using transifex.com
56
+ git checkout -- ../locale/*/*po
57
+
58
+ tx-update: tx-pull reset-po $(MOFILES)
59
+ # amend mo files
60
+ git add ../locale/*/LC_MESSAGES
61
+ git commit -a --amend -m "i18n - pulling from tx"
62
+ -echo Changes commited!