foreman_rh_cloud 1.0.4 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -0
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +14 -7
- data/app/models/setting/rh_cloud.rb +13 -0
- data/config/routes.rb +1 -0
- data/lib/foreman_inventory_upload.rb +12 -0
- data/lib/foreman_inventory_upload/async/async_helpers.rb +13 -0
- data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +8 -0
- data/lib/foreman_inventory_upload/async/shell_process.rb +3 -1
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +1 -5
- data/lib/foreman_inventory_upload/generators/archived_report.rb +6 -3
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +13 -0
- data/lib/foreman_inventory_upload/generators/queries.rb +2 -0
- data/lib/foreman_inventory_upload/generators/slice.rb +31 -11
- data/lib/foreman_rh_cloud/engine.rb +5 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +20 -100
- data/test/controllers/accounts_controller_test.rb +8 -3
- data/test/controllers/uploads_controller_test.rb +13 -0
- data/test/factories/inventory_upload_factories.rb +13 -13
- data/test/unit/archived_report_generator_test.rb +1 -0
- data/test/unit/fact_helpers_test.rb +29 -0
- data/test/unit/slice_generator_test.rb +112 -15
- data/test/unit/slice_generator_test.rb.orig +280 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +5 -14
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +8 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +12 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +10 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +10 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +5 -2
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.fixtures.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +32 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +38 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcherActions.test.js.snap +14 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +3 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/index.js +17 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +13 -9
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +5 -15
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +15 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +3 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +5 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +21 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +33 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +4 -2
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +0 -2
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +12 -1
- data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +5 -4
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +6 -5
- metadata +22 -9
- data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
- data/webpack/stories/configureStore.js +0 -15
- data/webpack/stories/decorators/index.js +0 -1
- data/webpack/stories/decorators/withCardsDecorator.js +0 -14
- data/webpack/stories/index.js +0 -10
- data/webpack/stories/index.scss +0 -7
- data/webpack/test_setup.js +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f497849e8c31b5ca95c689315cd88222097b769c1cf41d9f3ebf89f9cd64febf
|
4
|
+
data.tar.gz: deca6935796bd48f87e1bd6820deb732dc589dd6704fbd923270847be3d46984
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0407bf3aa9d3ce7d3abc86ed6c82182024a68f7b370ba4b406d19924697a8af5c404bf4e361e638821f98a63cc81867c46d8aa6d3af9a8da0c774c33829b14
|
7
|
+
data.tar.gz: 5f4de6af57144fa3e22f10ea1d25269fe309a268bb71b8b677cfcd606f1a507fec9b02ce744e7f184fe74f56b95ed7b6b9c5110d56f0e495d217afb573b6e3cb
|
data/README.md
CHANGED
@@ -11,6 +11,14 @@ for how to install Foreman plugins
|
|
11
11
|
|
12
12
|
*Usage here*
|
13
13
|
|
14
|
+
### In Satellite
|
15
|
+
|
16
|
+
Normally you run it via UI in RH Cloud -> Inventory Upload -> Restart, but if you need to run from command-line for some reason:
|
17
|
+
|
18
|
+
export organization_id=1
|
19
|
+
export target=/var/lib/foreman/red_hat_inventory/generated_reports/
|
20
|
+
/usr/sbin/foreman-rake foreman_inventory_upload:report:generate
|
21
|
+
|
14
22
|
## TODO
|
15
23
|
|
16
24
|
*Todo list here*
|
@@ -11,14 +11,10 @@ module ForemanInventoryUpload
|
|
11
11
|
|
12
12
|
def download_file
|
13
13
|
filename = ForemanInventoryUpload.facts_archive_name(params[:organization_id])
|
14
|
-
|
15
|
-
unless File.exist? path
|
16
|
-
return throw_flash_error(
|
17
|
-
"Path doesn't exist: #{path}"
|
18
|
-
)
|
19
|
-
end
|
14
|
+
files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]
|
20
15
|
|
21
|
-
send_file
|
16
|
+
return send_file files.first, disposition: 'attachment', filename: filename unless files.empty?
|
17
|
+
throw_flash_error "File doesn't exist"
|
22
18
|
end
|
23
19
|
|
24
20
|
def throw_flash_error(message)
|
@@ -27,5 +23,16 @@ module ForemanInventoryUpload
|
|
27
23
|
:error_msg => message
|
28
24
|
)
|
29
25
|
end
|
26
|
+
|
27
|
+
def auto_upload
|
28
|
+
Setting[:allow_auto_inventory_upload] = auto_upload_params
|
29
|
+
render json: {
|
30
|
+
autoUploadEnabled: Setting[:allow_auto_inventory_upload],
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def auto_upload_params
|
35
|
+
ActiveModel::Type::Boolean.new.cast(params.require(:value))
|
36
|
+
end
|
30
37
|
end
|
31
38
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Setting::RhCloud < Setting
|
2
|
+
def self.default_settings
|
3
|
+
return unless ActiveRecord::Base.connection.table_exists?('settings')
|
4
|
+
return unless super
|
5
|
+
[
|
6
|
+
set('allow_auto_inventory_upload', N_('Allow automatic upload of the host inventory to the Red Hat cloud'), true),
|
7
|
+
]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.humanized_category
|
11
|
+
N_('RH Cloud')
|
12
|
+
end
|
13
|
+
end
|
data/config/routes.rb
CHANGED
@@ -6,5 +6,6 @@ Rails.application.routes.draw do
|
|
6
6
|
get ':organization_id/uploads/last', to: 'uploads#last', constraints: { organization_id: %r{[^\/]+} }
|
7
7
|
get ':organization_id/uploads/file', to: 'uploads#download_file', constraints: { organization_id: %r{[^\/]+} }
|
8
8
|
get 'accounts', to: 'accounts#index'
|
9
|
+
post 'auto_upload', to: 'uploads#auto_upload'
|
9
10
|
end
|
10
11
|
end
|
@@ -18,6 +18,18 @@ module ForemanInventoryUpload
|
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.uploads_file_path(filename)
|
22
|
+
File.join(ForemanInventoryUpload.uploads_folder, filename)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.done_folder
|
26
|
+
File.join(ForemanInventoryUpload.uploads_folder, 'done/')
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.done_file_path(filename)
|
30
|
+
File.join(ForemanInventoryUpload.done_folder, filename)
|
31
|
+
end
|
32
|
+
|
21
33
|
def self.generated_reports_folder
|
22
34
|
@generated_reports_folder ||= ensure_folder(
|
23
35
|
File.join(
|
@@ -2,6 +2,14 @@ module ForemanInventoryUpload
|
|
2
2
|
module Async
|
3
3
|
class GenerateAllReportsJob < ::ApplicationJob
|
4
4
|
def perform
|
5
|
+
unless Setting[:allow_auto_inventory_upload]
|
6
|
+
logger.debug(
|
7
|
+
'The scheduled process is disabled due to the "allow_auto_inventory_upload"
|
8
|
+
setting being set to false.'
|
9
|
+
)
|
10
|
+
return
|
11
|
+
end
|
12
|
+
|
5
13
|
organizations = Organization.unscoped.all
|
6
14
|
|
7
15
|
organizations.map do |organization|
|
@@ -3,11 +3,13 @@ require 'open3'
|
|
3
3
|
module ForemanInventoryUpload
|
4
4
|
module Async
|
5
5
|
class ShellProcess < ::ApplicationJob
|
6
|
+
include AsyncHelpers
|
7
|
+
|
6
8
|
def perform(instance_label)
|
7
9
|
klass_name = self.class.name
|
8
10
|
logger.debug("Starting #{klass_name} with label #{instance_label}")
|
9
11
|
progress_output = ProgressOutput.register(instance_label)
|
10
|
-
Open3.popen2e(env, command) do |_stdin, stdout_stderr, wait_thread|
|
12
|
+
Open3.popen2e(hash_to_s(env), command) do |_stdin, stdout_stderr, wait_thread|
|
11
13
|
progress_output.status = "Running in pid #{wait_thread.pid}"
|
12
14
|
|
13
15
|
stdout_stderr.each do |out_line|
|
@@ -37,11 +37,7 @@ module ForemanInventoryUpload
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def http_proxy_string
|
40
|
-
@http_proxy_string ||=
|
41
|
-
if Setting[:content_default_http_proxy]
|
42
|
-
HttpProxy.unscoped.find_by(name: Setting[:content_default_http_proxy])&.full_url
|
43
|
-
end
|
44
|
-
end
|
40
|
+
@http_proxy_string ||= HttpProxy.default_global_content_proxy&.full_url
|
45
41
|
end
|
46
42
|
|
47
43
|
def rh_credentials
|
@@ -16,9 +16,9 @@ module ForemanInventoryUpload
|
|
16
16
|
first = true
|
17
17
|
host_batches.each do |hosts_batch|
|
18
18
|
slice_id = Foreman.uuid
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
@logger.info "Adding slice #{slice_id}"
|
20
|
+
hosts_count = generate_slice(tmpdir, slice_id, hosts_batch)
|
21
|
+
@logger.info "slice #{slice_id} was created with #{hosts_count} hosts"
|
22
22
|
inner_generator.add_slice(slice_id, hosts_count, first)
|
23
23
|
first = false
|
24
24
|
end
|
@@ -43,10 +43,13 @@ module ForemanInventoryUpload
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def generate_slice(tmpdir, slice_id, hosts_batch)
|
46
|
+
hosts_count = 0
|
46
47
|
File.open(File.join(tmpdir, "#{slice_id}.json"), 'w') do |slice_out|
|
47
48
|
slice_generator = ForemanInventoryUpload::Generators::Slice.new(hosts_batch, slice_out, slice_id)
|
48
49
|
slice_generator.render
|
50
|
+
hosts_count = slice_generator.hosts_count
|
49
51
|
end
|
52
|
+
hosts_count
|
50
53
|
end
|
51
54
|
end
|
52
55
|
end
|
@@ -13,6 +13,19 @@ module ForemanInventoryUpload
|
|
13
13
|
def kilobytes_to_bytes(kilobytes)
|
14
14
|
kilobytes * 1024
|
15
15
|
end
|
16
|
+
|
17
|
+
def account_id(organization)
|
18
|
+
@organization_accounts ||= {}
|
19
|
+
@organization_accounts[organization.id] ||= organization.pools.where.not(account_number: nil).pluck(:account_number).first
|
20
|
+
end
|
21
|
+
|
22
|
+
def golden_ticket?(organization)
|
23
|
+
result = organization.try(:golden_ticket?)
|
24
|
+
result = organization.content_access_mode == 'org_environment' if result.nil?
|
25
|
+
|
26
|
+
@organization_golden_tickets ||= {}
|
27
|
+
@organization_golden_tickets[organization.id] ||= result
|
28
|
+
end
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
@@ -4,11 +4,13 @@ module ForemanInventoryUpload
|
|
4
4
|
include FactHelpers
|
5
5
|
|
6
6
|
attr_accessor :slice_id
|
7
|
+
attr_reader :hosts_count
|
7
8
|
|
8
9
|
def initialize(hosts, output = [], slice_id = Foreman.uuid)
|
9
10
|
@stream = JsonStream.new(output)
|
10
11
|
@hosts = hosts
|
11
12
|
@slice_id = slice_id
|
13
|
+
@hosts_count = 0
|
12
14
|
end
|
13
15
|
|
14
16
|
def render
|
@@ -24,9 +26,12 @@ module ForemanInventoryUpload
|
|
24
26
|
@stream.array_field('hosts', :last) do
|
25
27
|
first = true
|
26
28
|
hosts_batch.each do |host|
|
27
|
-
next unless host&.subscription_facet
|
29
|
+
next unless host&.subscription_facet
|
28
30
|
@stream.comma unless first
|
29
|
-
|
31
|
+
if report_host(host)
|
32
|
+
first = false
|
33
|
+
@hosts_count += 1
|
34
|
+
end
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
@@ -34,11 +39,10 @@ module ForemanInventoryUpload
|
|
34
39
|
|
35
40
|
def report_host(host)
|
36
41
|
@stream.object do
|
37
|
-
@stream.simple_field('display_name', host.name)
|
38
42
|
@stream.simple_field('fqdn', host.fqdn)
|
39
|
-
@stream.simple_field('account', host.
|
40
|
-
@stream.simple_field('subscription_manager_id', host.subscription_facet
|
41
|
-
@stream.simple_field('satellite_id', host.subscription_facet
|
43
|
+
@stream.simple_field('account', account_id(host.organization).to_s)
|
44
|
+
@stream.simple_field('subscription_manager_id', host.subscription_facet&.uuid)
|
45
|
+
@stream.simple_field('satellite_id', host.subscription_facet&.uuid)
|
42
46
|
@stream.simple_field('bios_uuid', fact_value(host, 'dmi::system::uuid'))
|
43
47
|
@stream.simple_field('vm_uuid', fact_value(host, 'virt::uuid'))
|
44
48
|
@stream.array_field('ip_addresses') do
|
@@ -65,7 +69,7 @@ module ForemanInventoryUpload
|
|
65
69
|
|
66
70
|
@stream.array_field('tags', :last) do
|
67
71
|
report_tag('satellite', 'satellite_instance_id', Foreman.instance_id) if Foreman.respond_to?(:instance_id)
|
68
|
-
report_tag('satellite', 'organization_id', host.organization_id, :last)
|
72
|
+
report_tag('satellite', 'organization_id', host.organization_id.to_s, :last)
|
69
73
|
end
|
70
74
|
end
|
71
75
|
end
|
@@ -105,12 +109,23 @@ module ForemanInventoryUpload
|
|
105
109
|
end.join(', '))
|
106
110
|
end
|
107
111
|
end
|
108
|
-
@stream.simple_field(
|
112
|
+
@stream.simple_field(
|
113
|
+
'os_release',
|
114
|
+
os_release_value(
|
115
|
+
name: fact_value(host, 'distribution::name'),
|
116
|
+
version: fact_value(host, 'distribution::version'),
|
117
|
+
codename: fact_value(host, 'distribution::id')
|
118
|
+
)
|
119
|
+
)
|
109
120
|
@stream.simple_field('os_kernel_version', fact_value(host, 'uname::release'))
|
110
121
|
@stream.simple_field('arch', host.architecture&.name)
|
111
122
|
@stream.simple_field('subscription_status', host.subscription_status_label)
|
112
123
|
@stream.simple_field('katello_agent_running', host.content_facet&.katello_agent_installed?)
|
113
124
|
@stream.simple_field('satellite_managed', true)
|
125
|
+
@stream.simple_field(
|
126
|
+
'infrastructure_type',
|
127
|
+
ActiveModel::Type::Boolean.new.cast(fact_value(host, 'virt::is_guest')) ? 'virtual' : 'physical'
|
128
|
+
)
|
114
129
|
unless (installed_products = host.subscription_facet&.installed_products).empty?
|
115
130
|
@stream.array_field('installed_products') do
|
116
131
|
@stream.raw(installed_products.map do |product|
|
@@ -131,17 +146,22 @@ module ForemanInventoryUpload
|
|
131
146
|
end
|
132
147
|
|
133
148
|
def report_satellite_facts(host)
|
134
|
-
@stream.simple_field('virtual_host_name', host.subscription_facet
|
135
|
-
@stream.simple_field('virtual_host_uuid', host.subscription_facet
|
149
|
+
@stream.simple_field('virtual_host_name', host.subscription_facet&.hypervisor_host&.name)
|
150
|
+
@stream.simple_field('virtual_host_uuid', host.subscription_facet&.hypervisor_host&.subscription_facet&.uuid)
|
136
151
|
if defined?(ForemanThemeSatellite)
|
137
152
|
@stream.simple_field('satellite_version', ForemanThemeSatellite::SATELLITE_VERSION)
|
138
153
|
end
|
139
154
|
@stream.simple_field('system_purpose_usage', host.subscription_facet.purpose_usage)
|
140
155
|
@stream.simple_field('system_purpose_role', host.subscription_facet.purpose_role)
|
141
156
|
@stream.simple_field('distribution_version', fact_value(host, 'distribution::version'))
|
142
|
-
@stream.simple_field('satellite_instance_id', Foreman.
|
157
|
+
@stream.simple_field('satellite_instance_id', Foreman.try(:instance_id))
|
158
|
+
@stream.simple_field('is_simple_content_access', golden_ticket?(host.organization))
|
143
159
|
@stream.simple_field('organization_id', host.organization_id, :last)
|
144
160
|
end
|
161
|
+
|
162
|
+
def os_release_value(name:, version:, codename:)
|
163
|
+
"#{name} #{version} (#{codename})"
|
164
|
+
end
|
145
165
|
end
|
146
166
|
end
|
147
167
|
end
|
@@ -5,6 +5,10 @@ module ForemanRhCloud
|
|
5
5
|
class Engine < ::Rails::Engine
|
6
6
|
engine_name 'foreman_rh_cloud'
|
7
7
|
|
8
|
+
initializer 'foreman_rh_cloud.load_default_settings', :before => :load_config_initializers do
|
9
|
+
require_dependency File.expand_path('../../app/models/setting/rh_cloud.rb', __dir__)
|
10
|
+
end
|
11
|
+
|
8
12
|
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
9
13
|
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
10
14
|
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
@@ -22,7 +26,7 @@ module ForemanRhCloud
|
|
22
26
|
|
23
27
|
initializer 'foreman_rh_cloud.register_plugin', :before => :finisher_hook do |_app|
|
24
28
|
Foreman::Plugin.register :foreman_rh_cloud do
|
25
|
-
requires_foreman '
|
29
|
+
requires_foreman '> 1.24'
|
26
30
|
|
27
31
|
# Add permissions
|
28
32
|
security_block :foreman_rh_cloud do
|
data/package.json
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
"description": "Inventory Upload =============",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
|
-
"lint": "
|
8
|
-
"test": "
|
9
|
-
"test:watch": "
|
10
|
-
"test:current": "
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
7
|
+
"lint": "tfm-lint --plugin -d /webpack",
|
8
|
+
"test": "tfm-test --plugin",
|
9
|
+
"test:watch": "tfm-test --plugin --watchAll",
|
10
|
+
"test:current": "tfm-test --plugin --watch",
|
11
|
+
"publish-coverage": "tfm-publish-coverage",
|
12
|
+
"stories": "tfm-stories --plugin",
|
13
|
+
"stories:build": "tfm-build-stories --plugin",
|
14
|
+
"stories:deploy": "surge --project .storybook-dist"
|
15
15
|
},
|
16
16
|
"repository": {
|
17
17
|
"type": "git",
|
@@ -20,106 +20,26 @@
|
|
20
20
|
"bugs": {
|
21
21
|
"url": "http://projects.theforeman.org/projects/foreman_rh_cloud/issues"
|
22
22
|
},
|
23
|
-
"
|
24
|
-
"
|
23
|
+
"peerDependencies": {
|
24
|
+
"@theforeman/vendor": ">= 4.0.2"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
|
-
"@
|
28
|
-
"@
|
29
|
-
"@
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"babel-
|
34
|
-
"
|
35
|
-
"babel-plugin-dynamic-import-node": "^2.0.0",
|
36
|
-
"babel-plugin-lodash": "^3.3.4",
|
37
|
-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
38
|
-
"babel-plugin-transform-class-properties": "^6.24.1",
|
39
|
-
"babel-plugin-transform-object-assign": "^6.8.0",
|
40
|
-
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
41
|
-
"babel-preset-env": "^1.7.0",
|
42
|
-
"babel-preset-react": "^6.5.0",
|
43
|
-
"coveralls": "^3.0.0",
|
44
|
-
"enzyme": "^3.4.0",
|
45
|
-
"enzyme-adapter-react-16": "^1.4.0",
|
46
|
-
"enzyme-to-json": "^3.2.1",
|
47
|
-
"eslint": "^4.10.0",
|
48
|
-
"eslint-import-resolver-babel-module": "^4.0.0",
|
49
|
-
"eslint-plugin-patternfly-react": "0.2.0",
|
50
|
-
"identity-obj-proxy": "^3.0.0",
|
51
|
-
"jed": "^1.1.1",
|
52
|
-
"jest-cli": "^23.6.0",
|
53
|
-
"jest-prop-type-error": "^1.1.0",
|
54
|
-
"node-sass": "^4.5.0",
|
55
|
-
"patternfly": "^3.58.0",
|
27
|
+
"@babel/core": "^7.7.0",
|
28
|
+
"@theforeman/builder": "^4.0.2",
|
29
|
+
"@theforeman/stories": "^4.0.2",
|
30
|
+
"@theforeman/test": "^4.0.2",
|
31
|
+
"@theforeman/vendor-dev": "^4.0.2",
|
32
|
+
"@theforeman/eslint-plugin-foreman": "^4.0.2",
|
33
|
+
"babel-eslint": "^10.0.0",
|
34
|
+
"eslint": "^6.7.2",
|
56
35
|
"prettier": "^1.13.5",
|
57
36
|
"raf": "^3.4.0",
|
58
|
-
"react-redux-test-utils": "^0.1.1",
|
59
|
-
"react-remarkable": "^1.1.3",
|
60
|
-
"sass-loader": "^6.0.7",
|
61
37
|
"stylelint": "^9.3.0",
|
62
38
|
"stylelint-config-standard": "^18.0.0",
|
63
39
|
"surge": "^0.20.3"
|
64
40
|
},
|
65
41
|
"dependencies": {
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"lodash": "^4.17.10",
|
69
|
-
"patternfly-react": "^2.19.1",
|
70
|
-
"prop-types": "^15.6.0",
|
71
|
-
"react": "^16.4.0",
|
72
|
-
"react-dom": "^16.4.0",
|
73
|
-
"react-intl": "^2.8.0",
|
74
|
-
"react-redux": "^5.0.6",
|
75
|
-
"redux": "^3.6.0",
|
76
|
-
"redux-thunk": "^2.2.0",
|
77
|
-
"reselect": "^3.0.1",
|
78
|
-
"seamless-immutable": "^7.1.2",
|
79
|
-
"urijs": "^1.18.10",
|
80
|
-
"uuid": "^3.0.1"
|
81
|
-
},
|
82
|
-
"jest": {
|
83
|
-
"automock": true,
|
84
|
-
"verbose": true,
|
85
|
-
"testMatch": [
|
86
|
-
"**/*.test.js"
|
87
|
-
],
|
88
|
-
"testURL": "http://localhost/",
|
89
|
-
"collectCoverage": true,
|
90
|
-
"collectCoverageFrom": [
|
91
|
-
"webpack/**/*.js",
|
92
|
-
"!webpack/index.js",
|
93
|
-
"!webpack/test_setup.js",
|
94
|
-
"!webpack/**/bundle*",
|
95
|
-
"!webpack/stories/**",
|
96
|
-
"!webpack/**/*stories.js"
|
97
|
-
],
|
98
|
-
"coverageReporters": [
|
99
|
-
"lcov"
|
100
|
-
],
|
101
|
-
"unmockedModulePathPatterns": [
|
102
|
-
"webpack/",
|
103
|
-
"react",
|
104
|
-
"node_modules/"
|
105
|
-
],
|
106
|
-
"moduleNameMapper": {
|
107
|
-
"^.+\\.(png|gif|css|scss)$": "identity-obj-proxy"
|
108
|
-
},
|
109
|
-
"globals": {
|
110
|
-
"__testing__": true
|
111
|
-
},
|
112
|
-
"transform": {
|
113
|
-
"^.+\\.js$": "babel-jest"
|
114
|
-
},
|
115
|
-
"moduleDirectories": [
|
116
|
-
"node_modules",
|
117
|
-
"webpack"
|
118
|
-
],
|
119
|
-
"setupFiles": [
|
120
|
-
"raf/polyfill",
|
121
|
-
"jest-prop-type-error",
|
122
|
-
"./webpack/test_setup.js"
|
123
|
-
]
|
42
|
+
"jed": "^1.1.1",
|
43
|
+
"react-intl": "^2.8.0"
|
124
44
|
}
|
125
45
|
}
|