foreman_rh_cloud 10.0.2 → 11.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/foreman_rh_cloud/url_remediations_retriever.rb +1 -1
- data/config/initializers/zeitwerk.rb +3 -0
- data/lib/foreman_rh_cloud/engine.rb +103 -97
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb +2 -2
- metadata +7 -7
- data/lib/foreman_rh_cloud/settings.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcd4ee874e42e9236bbc4fae540911c372af73f3a336507c9421693b8fb128da
|
4
|
+
data.tar.gz: da0c96b9b8fb3d737d0f8902da7176adbd2f1a8810260ddeba547c3a22004ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12343eaac2bfb4c666c156a84a868f02a3b684f4a4bf044f7a838d9134d140ec6fb698b356c35efb8b11618fa0c36b3a61c0cc411caf48ff91b8fc9957528074
|
7
|
+
data.tar.gz: 41f578f21a65aee43ade158a99991c1b3b7b37ee2000e0e1c8c7d55cba60ac94d31e734d205e589bfc1bf1850fb98142b91ea975b3d9580361a11803eac8f17b
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ForemanRhCloud
|
2
|
-
class
|
2
|
+
class URLRemediationsRetriever < RemediationsRetriever
|
3
3
|
attr_reader :url, :payload, :headers
|
4
4
|
|
5
5
|
def initialize(url:, organization_id:, payload: '', headers: {}, logger: Logger.new(IO::NULL))
|
@@ -20,15 +20,6 @@ module ForemanRhCloud
|
|
20
20
|
rescue ActiveRecord::TransactionIsolationError
|
21
21
|
end
|
22
22
|
|
23
|
-
initializer 'foreman_rh_cloud.load_default_settings', :before => :load_config_initializers do
|
24
|
-
require_dependency File.expand_path('settings.rb', __dir__)
|
25
|
-
end
|
26
|
-
|
27
|
-
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
28
|
-
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
29
|
-
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
30
|
-
config.autoload_paths += Dir["#{config.root}/app/services"]
|
31
|
-
config.autoload_paths += Dir["#{config.root}/app/overrides"]
|
32
23
|
config.autoload_paths += Dir["#{config.root}/lib"]
|
33
24
|
|
34
25
|
config.eager_load_paths += Dir["#{config.root}/lib"]
|
@@ -40,109 +31,124 @@ module ForemanRhCloud
|
|
40
31
|
end
|
41
32
|
end
|
42
33
|
|
43
|
-
initializer 'foreman_rh_cloud.register_plugin', :before => :finisher_hook do |
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
permission(
|
64
|
-
:view_foreman_rh_cloud,
|
65
|
-
'foreman_inventory_upload/accounts': [:index],
|
66
|
-
'foreman_inventory_upload/reports': [:last],
|
67
|
-
'foreman_inventory_upload/uploads': [:auto_upload, :show_auto_upload, :download_file, :last],
|
68
|
-
'foreman_inventory_upload/tasks': [:show],
|
69
|
-
'foreman_inventory_upload/cloud_status': [:index],
|
70
|
-
'foreman_inventory_upload/uploads_settings': [:index],
|
71
|
-
'foreman_inventory_upload/missing_hosts': [:index],
|
72
|
-
'react': [:index]
|
73
|
-
)
|
74
|
-
permission(
|
75
|
-
:view_insights_hits,
|
76
|
-
{
|
77
|
-
'/foreman_rh_cloud/insights_cloud': [:index], # for bookmarks and later for showing the page
|
78
|
-
'insights_cloud/hits': [:index, :show, :auto_complete_search, :resolutions],
|
79
|
-
'insights_cloud/settings': [:index, :show],
|
80
|
-
'react': [:index],
|
81
|
-
},
|
82
|
-
:resource_type => ::InsightsHit.name
|
83
|
-
)
|
84
|
-
permission(
|
85
|
-
:dispatch_cloud_requests,
|
86
|
-
'api/v2/rh_cloud/cloud_request': [:update]
|
87
|
-
)
|
88
|
-
permission(
|
89
|
-
:control_organization_insights,
|
90
|
-
'insights_cloud/settings': [:set_org_parameter]
|
91
|
-
)
|
92
|
-
end
|
34
|
+
initializer 'foreman_rh_cloud.register_plugin', :before => :finisher_hook do |app|
|
35
|
+
app.reloader.to_prepare do
|
36
|
+
Foreman::Plugin.register :foreman_rh_cloud do
|
37
|
+
requires_foreman '>= 3.13'
|
38
|
+
register_gettext
|
39
|
+
|
40
|
+
apipie_documented_controllers ["#{ForemanRhCloud::Engine.root}/app/controllers/api/v2/**/*.rb"]
|
41
|
+
|
42
|
+
settings do
|
43
|
+
category(:rh_cloud, N_('RHCloud')) do
|
44
|
+
setting('allow_auto_inventory_upload', type: :boolean, description: N_('Enable automatic upload of your host inventory to the Red Hat cloud'), default: true, full_name: N_('Automatic inventory upload'))
|
45
|
+
setting('allow_auto_insights_sync', type: :boolean, description: N_('Enable automatic synchronization of Insights recommendations from the Red Hat cloud'), default: false, full_name: N_('Synchronize recommendations Automatically'))
|
46
|
+
setting('allow_auto_insights_mismatch_delete', type: :boolean, description: N_('Enable automatic deletion of mismatched host records from the Red Hat cloud'), default: false, full_name: N_('Automatic mismatch deletion'))
|
47
|
+
setting('obfuscate_inventory_hostnames', type: :boolean, description: N_('Obfuscate host names sent to the Red Hat cloud'), default: false, full_name: N_('Obfuscate host names'))
|
48
|
+
setting('obfuscate_inventory_ips', type: :boolean, description: N_('Obfuscate ipv4 addresses sent to the Red Hat cloud'), default: false, full_name: N_('Obfuscate host ipv4 addresses'))
|
49
|
+
setting('exclude_installed_packages', type: :boolean, description: N_('Exclude installed packages from being uploaded to the Red Hat cloud'), default: false, full_name: N_("Exclude installed Packages"))
|
50
|
+
setting('include_parameter_tags', type: :boolean, description: N_('Should import include parameter tags from Foreman?'), default: false, full_name: N_('Include parameters in insights-client reports'))
|
51
|
+
setting('rhc_instance_id', type: :string, description: N_('RHC daemon id'), default: nil, full_name: N_('ID of the RHC(Yggdrasil) daemon'))
|
52
|
+
end
|
53
|
+
end
|
93
54
|
|
94
|
-
|
55
|
+
# Add permissions
|
56
|
+
security_block :foreman_rh_cloud do
|
57
|
+
permission(
|
58
|
+
:generate_foreman_rh_cloud,
|
59
|
+
'foreman_inventory_upload/reports': [:generate],
|
60
|
+
'foreman_inventory_upload/tasks': [:create],
|
61
|
+
'api/v2/rh_cloud/inventory': [:get_hosts, :remove_hosts, :sync_inventory_status, :download_file, :generate_report, :enable_cloud_connector],
|
62
|
+
'foreman_inventory_upload/uploads': [:enable_cloud_connector],
|
63
|
+
'foreman_inventory_upload/uploads_settings': [:set_advanced_setting],
|
64
|
+
'foreman_inventory_upload/missing_hosts': [:remove_hosts],
|
65
|
+
'insights_cloud/settings': [:update],
|
66
|
+
'insights_cloud/tasks': [:create]
|
67
|
+
)
|
68
|
+
permission(
|
69
|
+
:view_foreman_rh_cloud,
|
70
|
+
'foreman_inventory_upload/accounts': [:index],
|
71
|
+
'foreman_inventory_upload/reports': [:last],
|
72
|
+
'foreman_inventory_upload/uploads': [:auto_upload, :show_auto_upload, :download_file, :last],
|
73
|
+
'foreman_inventory_upload/tasks': [:show],
|
74
|
+
'foreman_inventory_upload/cloud_status': [:index],
|
75
|
+
'foreman_inventory_upload/uploads_settings': [:index],
|
76
|
+
'foreman_inventory_upload/missing_hosts': [:index],
|
77
|
+
'react': [:index]
|
78
|
+
)
|
79
|
+
permission(
|
80
|
+
:view_insights_hits,
|
81
|
+
{
|
82
|
+
'/foreman_rh_cloud/insights_cloud': [:index], # for bookmarks and later for showing the page
|
83
|
+
'insights_cloud/hits': [:index, :show, :auto_complete_search, :resolutions],
|
84
|
+
'insights_cloud/settings': [:index, :show],
|
85
|
+
'react': [:index],
|
86
|
+
},
|
87
|
+
:resource_type => ::InsightsHit.name
|
88
|
+
)
|
89
|
+
permission(
|
90
|
+
:dispatch_cloud_requests,
|
91
|
+
'api/v2/rh_cloud/cloud_request': [:update]
|
92
|
+
)
|
93
|
+
permission(
|
94
|
+
:control_organization_insights,
|
95
|
+
'insights_cloud/settings': [:set_org_parameter]
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
plugin_permissions = [:view_foreman_rh_cloud, :generate_foreman_rh_cloud, :view_insights_hits, :dispatch_cloud_requests, :control_organization_insights]
|
95
100
|
|
96
|
-
|
97
|
-
|
101
|
+
role 'ForemanRhCloud', plugin_permissions, 'Role granting permissions to view the hosts inventory,
|
102
|
+
generate a report, upload it to the cloud and download it locally'
|
98
103
|
|
99
|
-
|
100
|
-
|
101
|
-
|
104
|
+
add_permissions_to_default_roles Role::ORG_ADMIN => plugin_permissions,
|
105
|
+
Role::MANAGER => plugin_permissions,
|
106
|
+
Role::SYSTEM_ADMIN => plugin_permissions
|
102
107
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
108
|
+
# Adding a sub menu after hosts menu
|
109
|
+
divider :top_menu, caption: N_('RH Cloud'), parent: :configure_menu
|
110
|
+
menu :top_menu, :inventory_upload, caption: N_('Inventory Upload'), url: '/foreman_rh_cloud/inventory_upload', url_hash: { controller: :react, action: :index }, parent: :configure_menu
|
111
|
+
menu :top_menu, :insights_hits, caption: N_('Insights'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :configure_menu
|
107
112
|
|
108
|
-
|
109
|
-
|
110
|
-
|
113
|
+
register_facet InsightsFacet, :insights do
|
114
|
+
configure_host do
|
115
|
+
set_dependent_action :destroy
|
116
|
+
end
|
111
117
|
end
|
112
|
-
end
|
113
118
|
|
114
|
-
|
119
|
+
register_global_js_file 'global'
|
115
120
|
|
116
|
-
|
117
|
-
|
121
|
+
register_custom_status InventorySync::InventoryStatus
|
122
|
+
register_custom_status InsightsClientReportStatus
|
118
123
|
|
119
|
-
|
120
|
-
|
121
|
-
|
124
|
+
describe_host do
|
125
|
+
overview_buttons_provider :insights_host_overview_buttons
|
126
|
+
end
|
122
127
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
128
|
+
extend_page 'hosts/show' do |context|
|
129
|
+
context.add_pagelet :main_tabs,
|
130
|
+
partial: 'hosts/insights_tab',
|
131
|
+
name: _('Insights'),
|
132
|
+
id: 'insights',
|
133
|
+
onlyif: proc { |host| host.insights }
|
134
|
+
end
|
130
135
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
+
extend_page 'hosts/_list' do |context|
|
137
|
+
context.with_profile :cloud, _('RH Cloud'), default: true do
|
138
|
+
add_pagelet :hosts_table_column_header, key: :insights_recommendations_count, label: _('Recommendations'), sortable: true, width: '12%', class: 'hidden-xs ellipsis', priority: 100,
|
139
|
+
export_data: CsvExporter::ExportDefinition.new(:insights_recommendations_count, callback: ->(host) { host&.insights_hits&.count })
|
140
|
+
add_pagelet :hosts_table_column_content, key: :insights_recommendations_count, callback: ->(host) { hits_counts_cell(host) }, class: 'hidden-xs ellipsis text-center', priority: 100
|
141
|
+
end
|
136
142
|
end
|
137
|
-
end
|
138
143
|
|
139
|
-
|
140
|
-
|
141
|
-
|
144
|
+
extend_template_helpers ForemanRhCloud::TemplateRendererHelper
|
145
|
+
allowed_template_helpers :remediations_playbook, :download_rh_playbook
|
146
|
+
end
|
142
147
|
|
143
|
-
|
148
|
+
::Katello::UINotifications::Subscriptions::ManifestImportSuccess.include ForemanInventoryUpload::Notifications::ManifestImportSuccessNotificationOverride if defined?(Katello)
|
144
149
|
|
145
|
-
|
150
|
+
::Host::Managed.include RhCloudHost
|
151
|
+
end
|
146
152
|
end
|
147
153
|
|
148
154
|
rake_tasks do
|
data/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'test_plugin_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class URLRemediationsRetrieverTest < ActiveSupport::TestCase
|
4
4
|
test 'Calls the given url' do
|
5
|
-
retreiver = ForemanRhCloud::
|
5
|
+
retreiver = ForemanRhCloud::URLRemediationsRetriever.new(
|
6
6
|
organization_id: FactoryBot.create(:organization).id,
|
7
7
|
url: 'http://test.example.com',
|
8
8
|
payload: 'TEST_PAYLOAD',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 11.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman_ansible
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 15.0.0
|
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:
|
26
|
+
version: 15.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: foreman-tasks
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 10.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 10.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: katello
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- app/views/job_templates/rh_cloud_remediations.erb
|
145
145
|
- app/views/layouts/foreman_rh_cloud/application.html.erb
|
146
146
|
- config/database.yml.example
|
147
|
+
- config/initializers/zeitwerk.rb
|
147
148
|
- config/package-lock.json.plugin
|
148
149
|
- config/rh_cert-api_chain.pem
|
149
150
|
- config/routes.rb
|
@@ -185,7 +186,6 @@ files:
|
|
185
186
|
- lib/foreman_rh_cloud.rb
|
186
187
|
- lib/foreman_rh_cloud/async/exponential_backoff.rb
|
187
188
|
- lib/foreman_rh_cloud/engine.rb
|
188
|
-
- lib/foreman_rh_cloud/settings.rb
|
189
189
|
- lib/foreman_rh_cloud/version.rb
|
190
190
|
- lib/insights_cloud.rb
|
191
191
|
- lib/insights_cloud/async/cloud_connector_announce_task.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Foreman::SettingManager.define(:foreman) do
|
2
|
-
category(:rh_cloud, N_('RHCloud')) do
|
3
|
-
setting('allow_auto_inventory_upload', type: :boolean, description: N_('Enable automatic upload of your host inventory to the Red Hat cloud'), default: true, full_name: N_('Automatic inventory upload'))
|
4
|
-
setting('allow_auto_insights_sync', type: :boolean, description: N_('Enable automatic synchronization of Insights recommendations from the Red Hat cloud'), default: false, full_name: N_('Synchronize recommendations Automatically'))
|
5
|
-
setting('allow_auto_insights_mismatch_delete', type: :boolean, description: N_('Enable automatic deletion of mismatched host records from the Red Hat cloud'), default: false, full_name: N_('Automatic mismatch deletion'))
|
6
|
-
setting('obfuscate_inventory_hostnames', type: :boolean, description: N_('Obfuscate host names sent to the Red Hat cloud'), default: false, full_name: N_('Obfuscate host names'))
|
7
|
-
setting('obfuscate_inventory_ips', type: :boolean, description: N_('Obfuscate ipv4 addresses sent to the Red Hat cloud'), default: false, full_name: N_('Obfuscate host ipv4 addresses'))
|
8
|
-
setting('exclude_installed_packages', type: :boolean, description: N_('Exclude installed packages from being uploaded to the Red Hat cloud'), default: false, full_name: N_("Exclude installed Packages"))
|
9
|
-
setting('include_parameter_tags', type: :boolean, description: N_('Should import include parameter tags from Foreman?'), default: false, full_name: N_('Include parameters in insights-client reports'))
|
10
|
-
setting('rhc_instance_id', type: :string, description: N_('RHC daemon id'), default: nil, full_name: N_('ID of the RHC(Yggdrasil) daemon'))
|
11
|
-
end
|
12
|
-
end
|