foreman_remote_execution 4.7.0 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -0
- data/app/controllers/api/v2/job_invocations_controller.rb +16 -1
- data/app/controllers/ui_job_wizard_controller.rb +16 -4
- data/app/graphql/mutations/job_invocations/create.rb +43 -0
- data/app/graphql/types/job_invocation_input.rb +13 -0
- data/app/graphql/types/recurrence_input.rb +8 -0
- data/app/graphql/types/scheduling_input.rb +6 -0
- data/app/graphql/types/targeting_enum.rb +7 -0
- data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +20 -9
- data/app/helpers/remote_execution_helper.rb +1 -1
- data/app/lib/actions/remote_execution/run_host_job.rb +6 -1
- data/app/lib/actions/remote_execution/run_hosts_job.rb +57 -3
- data/app/mailers/rex_job_mailer.rb +15 -0
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +12 -0
- data/app/models/job_invocation.rb +4 -0
- data/app/models/job_invocation_composer.rb +21 -13
- data/app/models/remote_execution_provider.rb +18 -2
- data/app/models/rex_mail_notification.rb +13 -0
- data/app/models/targeting.rb +3 -3
- data/app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb +2 -1
- data/app/views/dashboard/_latest-jobs.html.erb +21 -0
- data/app/views/job_invocations/_preview_hosts_list.html.erb +1 -1
- data/app/views/job_invocations/refresh.js.erb +1 -0
- data/app/views/rex_job_mailer/job_finished.html.erb +24 -0
- data/app/views/rex_job_mailer/job_finished.text.erb +9 -0
- data/app/views/template_invocations/show.html.erb +3 -2
- data/config/routes.rb +1 -0
- data/db/migrate/20210816100932_rex_setting_category_to_dsl.rb +5 -0
- data/db/seeds.d/50-notification_blueprints.rb +14 -0
- data/db/seeds.d/95-mail_notifications.rb +24 -0
- data/foreman_remote_execution.gemspec +1 -1
- data/lib/foreman_remote_execution/engine.rb +116 -7
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/package.json +9 -7
- data/test/functional/api/v2/job_invocations_controller_test.rb +20 -0
- data/test/functional/cockpit_controller_test.rb +0 -1
- data/test/graphql/mutations/job_invocations/create.rb +58 -0
- data/test/helpers/remote_execution_helper_test.rb +0 -1
- data/test/unit/actions/run_host_job_test.rb +21 -0
- data/test/unit/actions/run_hosts_job_test.rb +99 -4
- data/test/unit/concerns/host_extensions_test.rb +36 -3
- data/test/unit/job_invocation_composer_test.rb +3 -5
- data/test/unit/job_invocation_report_template_test.rb +16 -13
- data/test/unit/job_template_effective_user_test.rb +0 -4
- data/test/unit/remote_execution_provider_test.rb +46 -4
- data/test/unit/targeting_test.rb +68 -1
- data/webpack/JobWizard/JobWizard.js +142 -28
- data/webpack/JobWizard/JobWizard.scss +86 -33
- data/webpack/JobWizard/JobWizardConstants.js +44 -0
- data/webpack/JobWizard/JobWizardSelectors.js +32 -0
- data/webpack/JobWizard/__tests__/fixtures.js +89 -6
- data/webpack/JobWizard/__tests__/integration.test.js +29 -22
- data/webpack/JobWizard/__tests__/validation.test.js +141 -0
- data/webpack/JobWizard/autofill.js +38 -0
- data/webpack/JobWizard/index.js +7 -0
- data/webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js +23 -9
- data/webpack/JobWizard/steps/AdvancedFields/DescriptionField.js +32 -9
- data/webpack/JobWizard/steps/AdvancedFields/Fields.js +48 -1
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +242 -23
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +82 -0
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +5 -2
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js +3 -2
- data/webpack/JobWizard/steps/CategoryAndTemplate/index.js +3 -2
- data/webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js +62 -0
- data/webpack/JobWizard/steps/HostsAndInputs/HostSearch.js +54 -0
- data/webpack/JobWizard/steps/HostsAndInputs/SelectAPI.js +33 -0
- data/webpack/JobWizard/steps/HostsAndInputs/SelectGQL.js +52 -0
- data/webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js +100 -0
- data/webpack/JobWizard/steps/HostsAndInputs/TemplateInputs.js +23 -0
- data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +151 -0
- data/webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js +53 -0
- data/webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js +18 -0
- data/webpack/JobWizard/steps/HostsAndInputs/hostgroups.gql +8 -0
- data/webpack/JobWizard/steps/HostsAndInputs/hosts.gql +8 -0
- data/webpack/JobWizard/steps/HostsAndInputs/index.js +214 -0
- data/webpack/JobWizard/steps/ReviewDetails/index.js +193 -0
- data/webpack/JobWizard/steps/Schedule/PurposeField.js +31 -0
- data/webpack/JobWizard/steps/Schedule/QueryType.js +46 -43
- data/webpack/JobWizard/steps/Schedule/RepeatCron.js +53 -0
- data/webpack/JobWizard/steps/Schedule/RepeatDaily.js +37 -0
- data/webpack/JobWizard/steps/Schedule/RepeatHour.js +54 -0
- data/webpack/JobWizard/steps/Schedule/RepeatMonth.js +46 -0
- data/webpack/JobWizard/steps/Schedule/RepeatOn.js +95 -31
- data/webpack/JobWizard/steps/Schedule/RepeatWeek.js +70 -0
- data/webpack/JobWizard/steps/Schedule/ScheduleType.js +24 -21
- data/webpack/JobWizard/steps/Schedule/StartEndDates.js +78 -23
- data/webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js +402 -0
- data/webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js +20 -10
- data/webpack/JobWizard/steps/Schedule/index.js +166 -29
- data/webpack/JobWizard/steps/form/DateTimePicker.js +126 -0
- data/webpack/JobWizard/steps/form/FormHelpers.js +4 -0
- data/webpack/JobWizard/steps/form/Formatter.js +49 -17
- data/webpack/JobWizard/steps/form/NumberInput.js +5 -2
- data/webpack/JobWizard/steps/form/ResourceSelect.js +29 -0
- data/webpack/JobWizard/steps/form/SearchSelect.js +121 -0
- data/webpack/JobWizard/steps/form/SelectField.js +14 -3
- data/webpack/JobWizard/steps/form/WizardTitle.js +14 -0
- data/webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js +33 -0
- data/webpack/JobWizard/submit.js +120 -0
- data/webpack/JobWizard/validation.js +53 -0
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext/index.js +2 -0
- data/webpack/__mocks__/foremanReact/common/I18n.js +2 -0
- data/webpack/__mocks__/foremanReact/components/AutoComplete/AutoCompleteActions.js +1 -0
- data/webpack/__mocks__/foremanReact/components/AutoComplete/AutoCompleteConstants.js +1 -0
- data/webpack/__mocks__/foremanReact/routes/RouterSelector.js +1 -0
- data/webpack/helpers.js +1 -0
- data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +2 -1
- metadata +53 -7
- data/app/models/setting/remote_execution.rb +0 -88
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js +0 -23
- data/webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example +0 -76
@@ -0,0 +1,53 @@
|
|
1
|
+
import { useState, useEffect } from 'react';
|
2
|
+
import { useSelector } from 'react-redux';
|
3
|
+
import {
|
4
|
+
selectTemplateInputs,
|
5
|
+
selectAdvancedTemplateInputs,
|
6
|
+
} from './JobWizardSelectors';
|
7
|
+
import { isPositiveNumber, isValidDate } from './steps/form/FormHelpers';
|
8
|
+
import './JobWizard.scss';
|
9
|
+
|
10
|
+
export const useValidation = ({ advancedValues, templateValues }) => {
|
11
|
+
const [valid, setValid] = useState({});
|
12
|
+
const templateInputs = useSelector(selectTemplateInputs);
|
13
|
+
const advancedTemplateInputs = useSelector(selectAdvancedTemplateInputs);
|
14
|
+
useEffect(() => {
|
15
|
+
setValid({
|
16
|
+
hostsAndInputs: true,
|
17
|
+
advanced: true,
|
18
|
+
schedule: true,
|
19
|
+
});
|
20
|
+
const inputValidation = (inputs, values, setInvalid) => {
|
21
|
+
inputs.forEach(({ name, required, value_type: valueType }) => {
|
22
|
+
const value = values[name];
|
23
|
+
if (required && !value) {
|
24
|
+
setInvalid();
|
25
|
+
}
|
26
|
+
if (value && valueType === 'date') {
|
27
|
+
if (!isValidDate(value) && !isValidDate(new Date(value))) {
|
28
|
+
setInvalid();
|
29
|
+
}
|
30
|
+
}
|
31
|
+
});
|
32
|
+
};
|
33
|
+
inputValidation(templateInputs, templateValues, () =>
|
34
|
+
setValid(currValid => ({ ...currValid, hostsAndInputs: false }))
|
35
|
+
);
|
36
|
+
|
37
|
+
inputValidation(advancedTemplateInputs, advancedValues.templateValues, () =>
|
38
|
+
setValid(currValid => ({ ...currValid, advanced: false }))
|
39
|
+
);
|
40
|
+
[
|
41
|
+
advancedValues.timeoutToKill,
|
42
|
+
advancedValues.concurrencyLevel,
|
43
|
+
advancedValues.timeSpan,
|
44
|
+
].forEach(value => {
|
45
|
+
if (value && !isPositiveNumber(value)) {
|
46
|
+
setValid(currValid => ({ ...currValid, advanced: false }));
|
47
|
+
}
|
48
|
+
});
|
49
|
+
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
51
|
+
}, [advancedValues, templateValues]);
|
52
|
+
return [valid, setValid];
|
53
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export const resetData = payload => ({ type: 'REST_DATA', payload });
|
@@ -0,0 +1 @@
|
|
1
|
+
export const TRIGGERS = { INPUT_CHANGE: 'INPUT_CHANGE' };
|
@@ -0,0 +1 @@
|
|
1
|
+
export const selectRouterLocation = jest.fn(() => ({}));
|
data/webpack/helpers.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export const noop = Function.prototype;
|
@@ -21,7 +21,8 @@ const RecentJobsCard = ({ hostDetails: { name, id } }) => {
|
|
21
21
|
|
22
22
|
return (
|
23
23
|
<CardTemplate
|
24
|
-
|
24
|
+
overrideGridProps={{ xl2: 6, xl: 8, lg: 8, md: 12 }}
|
25
|
+
header={__('Recent jobs')}
|
25
26
|
dropdownItems={[
|
26
27
|
<DropdownItem
|
27
28
|
href={foremanUrl(`${JOB_BASE_URL}${name}`)}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Remote Execution team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 5.
|
53
|
+
version: 5.1.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 5.
|
60
|
+
version: 5.1.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: factory_bot_rails
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,12 @@ files:
|
|
136
136
|
- app/controllers/remote_execution_features_controller.rb
|
137
137
|
- app/controllers/template_invocations_controller.rb
|
138
138
|
- app/controllers/ui_job_wizard_controller.rb
|
139
|
+
- app/graphql/mutations/job_invocations/create.rb
|
139
140
|
- app/graphql/types/job_invocation.rb
|
141
|
+
- app/graphql/types/job_invocation_input.rb
|
142
|
+
- app/graphql/types/recurrence_input.rb
|
143
|
+
- app/graphql/types/scheduling_input.rb
|
144
|
+
- app/graphql/types/targeting_enum.rb
|
140
145
|
- app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
|
141
146
|
- app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb
|
142
147
|
- app/helpers/job_invocation_output_helper.rb
|
@@ -150,6 +155,7 @@ files:
|
|
150
155
|
- app/lib/foreman_remote_execution/renderer/scope/input.rb
|
151
156
|
- app/lib/proxy_api/remote_execution_ssh.rb
|
152
157
|
- app/mailers/.gitkeep
|
158
|
+
- app/mailers/rex_job_mailer.rb
|
153
159
|
- app/models/concerns/api/v2/interfaces_controller_extensions.rb
|
154
160
|
- app/models/concerns/foreman_remote_execution/bookmark_extensions.rb
|
155
161
|
- app/models/concerns/foreman_remote_execution/errors_flattener.rb
|
@@ -177,7 +183,7 @@ files:
|
|
177
183
|
- app/models/job_template_effective_user.rb
|
178
184
|
- app/models/remote_execution_feature.rb
|
179
185
|
- app/models/remote_execution_provider.rb
|
180
|
-
- app/models/
|
186
|
+
- app/models/rex_mail_notification.rb
|
181
187
|
- app/models/ssh_execution_provider.rb
|
182
188
|
- app/models/target_remote_execution_proxy.rb
|
183
189
|
- app/models/targeting.rb
|
@@ -216,6 +222,7 @@ files:
|
|
216
222
|
- app/views/api/v2/template_invocations/base.json.rabl
|
217
223
|
- app/views/api/v2/template_invocations/template_invocations.json.rabl
|
218
224
|
- app/views/dashboard/.gitkeep
|
225
|
+
- app/views/dashboard/_latest-jobs.html.erb
|
219
226
|
- app/views/job_invocation_task_groups/_job_invocation_task_groups.html.erb
|
220
227
|
- app/views/job_invocations/_card_results.html.erb
|
221
228
|
- app/views/job_invocations/_card_schedule.html.erb
|
@@ -249,6 +256,8 @@ files:
|
|
249
256
|
- app/views/remote_execution_features/_form.html.erb
|
250
257
|
- app/views/remote_execution_features/index.html.erb
|
251
258
|
- app/views/remote_execution_features/show.html.erb
|
259
|
+
- app/views/rex_job_mailer/job_finished.html.erb
|
260
|
+
- app/views/rex_job_mailer/job_finished.text.erb
|
252
261
|
- app/views/template_inputs/_foreign_input_set_form.html.erb
|
253
262
|
- app/views/template_invocations/_output_line_set.html.erb
|
254
263
|
- app/views/template_invocations/_refresh.js.erb
|
@@ -312,12 +321,14 @@ files:
|
|
312
321
|
- db/migrate/20200820122057_add_proxy_selector_override_to_remote_execution_feature.rb
|
313
322
|
- db/migrate/20210312074713_add_provider_inputs.rb
|
314
323
|
- db/migrate/2021051713291621250977_add_host_proxy_invocations.rb
|
324
|
+
- db/migrate/20210816100932_rex_setting_category_to_dsl.rb
|
315
325
|
- db/seeds.d/100-assign_features_with_templates.rb
|
316
326
|
- db/seeds.d/20-permissions.rb
|
317
327
|
- db/seeds.d/50-notification_blueprints.rb
|
318
328
|
- db/seeds.d/60-ssh_proxy_feature.rb
|
319
329
|
- db/seeds.d/70-job_templates.rb
|
320
330
|
- db/seeds.d/90-bookmarks.rb
|
331
|
+
- db/seeds.d/95-mail_notifications.rb
|
321
332
|
- extra/cockpit/cockpit.conf.example
|
322
333
|
- extra/cockpit/foreman-cockpit-session
|
323
334
|
- extra/cockpit/foreman-cockpit.service
|
@@ -367,6 +378,7 @@ files:
|
|
367
378
|
- test/functional/job_invocations_controller_test.rb
|
368
379
|
- test/functional/job_templates_controller_test.rb
|
369
380
|
- test/functional/ui_job_wizard_controller_test.rb
|
381
|
+
- test/graphql/mutations/job_invocations/create.rb
|
370
382
|
- test/graphql/queries/job_invocation_query_test.rb
|
371
383
|
- test/graphql/queries/job_invocations_query_test.rb
|
372
384
|
- test/helpers/remote_execution_helper_test.rb
|
@@ -396,30 +408,61 @@ files:
|
|
396
408
|
- webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap
|
397
409
|
- webpack/JobWizard/__tests__/fixtures.js
|
398
410
|
- webpack/JobWizard/__tests__/integration.test.js
|
411
|
+
- webpack/JobWizard/__tests__/validation.test.js
|
412
|
+
- webpack/JobWizard/autofill.js
|
399
413
|
- webpack/JobWizard/index.js
|
400
414
|
- webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js
|
401
415
|
- webpack/JobWizard/steps/AdvancedFields/DescriptionField.js
|
402
416
|
- webpack/JobWizard/steps/AdvancedFields/Fields.js
|
403
417
|
- webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js
|
404
|
-
- webpack/JobWizard/steps/AdvancedFields/__tests__/
|
418
|
+
- webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap
|
405
419
|
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js
|
406
420
|
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js
|
407
421
|
- webpack/JobWizard/steps/CategoryAndTemplate/index.js
|
422
|
+
- webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js
|
423
|
+
- webpack/JobWizard/steps/HostsAndInputs/HostSearch.js
|
424
|
+
- webpack/JobWizard/steps/HostsAndInputs/SelectAPI.js
|
425
|
+
- webpack/JobWizard/steps/HostsAndInputs/SelectGQL.js
|
426
|
+
- webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js
|
427
|
+
- webpack/JobWizard/steps/HostsAndInputs/TemplateInputs.js
|
428
|
+
- webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js
|
429
|
+
- webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js
|
430
|
+
- webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
|
431
|
+
- webpack/JobWizard/steps/HostsAndInputs/hostgroups.gql
|
432
|
+
- webpack/JobWizard/steps/HostsAndInputs/hosts.gql
|
433
|
+
- webpack/JobWizard/steps/HostsAndInputs/index.js
|
434
|
+
- webpack/JobWizard/steps/ReviewDetails/index.js
|
435
|
+
- webpack/JobWizard/steps/Schedule/PurposeField.js
|
408
436
|
- webpack/JobWizard/steps/Schedule/QueryType.js
|
437
|
+
- webpack/JobWizard/steps/Schedule/RepeatCron.js
|
438
|
+
- webpack/JobWizard/steps/Schedule/RepeatDaily.js
|
439
|
+
- webpack/JobWizard/steps/Schedule/RepeatHour.js
|
440
|
+
- webpack/JobWizard/steps/Schedule/RepeatMonth.js
|
409
441
|
- webpack/JobWizard/steps/Schedule/RepeatOn.js
|
442
|
+
- webpack/JobWizard/steps/Schedule/RepeatWeek.js
|
410
443
|
- webpack/JobWizard/steps/Schedule/ScheduleType.js
|
411
444
|
- webpack/JobWizard/steps/Schedule/StartEndDates.js
|
445
|
+
- webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js
|
412
446
|
- webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js
|
413
447
|
- webpack/JobWizard/steps/Schedule/index.js
|
448
|
+
- webpack/JobWizard/steps/form/DateTimePicker.js
|
414
449
|
- webpack/JobWizard/steps/form/FormHelpers.js
|
415
450
|
- webpack/JobWizard/steps/form/Formatter.js
|
416
451
|
- webpack/JobWizard/steps/form/GroupedSelectField.js
|
417
452
|
- webpack/JobWizard/steps/form/NumberInput.js
|
453
|
+
- webpack/JobWizard/steps/form/ResourceSelect.js
|
454
|
+
- webpack/JobWizard/steps/form/SearchSelect.js
|
418
455
|
- webpack/JobWizard/steps/form/SelectField.js
|
419
|
-
- webpack/JobWizard/steps/form/
|
456
|
+
- webpack/JobWizard/steps/form/WizardTitle.js
|
457
|
+
- webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
|
458
|
+
- webpack/JobWizard/submit.js
|
459
|
+
- webpack/JobWizard/validation.js
|
420
460
|
- webpack/Routes/routes.js
|
461
|
+
- webpack/__mocks__/foremanReact/Root/Context/ForemanContext/index.js
|
421
462
|
- webpack/__mocks__/foremanReact/common/I18n.js
|
422
463
|
- webpack/__mocks__/foremanReact/common/helpers.js
|
464
|
+
- webpack/__mocks__/foremanReact/components/AutoComplete/AutoCompleteActions.js
|
465
|
+
- webpack/__mocks__/foremanReact/components/AutoComplete/AutoCompleteConstants.js
|
423
466
|
- webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
|
424
467
|
- webpack/__mocks__/foremanReact/components/SearchBar.js
|
425
468
|
- webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js
|
@@ -428,8 +471,10 @@ files:
|
|
428
471
|
- webpack/__mocks__/foremanReact/redux/API/APISelectors.js
|
429
472
|
- webpack/__mocks__/foremanReact/redux/API/index.js
|
430
473
|
- webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors.js
|
474
|
+
- webpack/__mocks__/foremanReact/routes/RouterSelector.js
|
431
475
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
432
476
|
- webpack/global_index.js
|
477
|
+
- webpack/helpers.js
|
433
478
|
- webpack/index.js
|
434
479
|
- webpack/react_app/components/RecentJobsCard/JobStatusIcon.js
|
435
480
|
- webpack/react_app/components/RecentJobsCard/RecentJobsCard.js
|
@@ -511,6 +556,7 @@ test_files:
|
|
511
556
|
- test/functional/job_invocations_controller_test.rb
|
512
557
|
- test/functional/job_templates_controller_test.rb
|
513
558
|
- test/functional/ui_job_wizard_controller_test.rb
|
559
|
+
- test/graphql/mutations/job_invocations/create.rb
|
514
560
|
- test/graphql/queries/job_invocation_query_test.rb
|
515
561
|
- test/graphql/queries/job_invocations_query_test.rb
|
516
562
|
- test/helpers/remote_execution_helper_test.rb
|
@@ -1,88 +0,0 @@
|
|
1
|
-
class Setting::RemoteExecution < Setting
|
2
|
-
|
3
|
-
::Setting::BLANK_ATTRS.concat %w{remote_execution_ssh_password remote_execution_ssh_key_passphrase remote_execution_sudo_password remote_execution_effective_user_password remote_execution_cockpit_url remote_execution_form_job_template}
|
4
|
-
|
5
|
-
def self.default_settings
|
6
|
-
[
|
7
|
-
self.set('remote_execution_fallback_proxy',
|
8
|
-
N_('Search the host for any proxy with Remote Execution, useful when the host has no subnet or the subnet does not have an execution proxy'),
|
9
|
-
false,
|
10
|
-
N_('Fallback to Any Proxy')),
|
11
|
-
self.set('remote_execution_global_proxy',
|
12
|
-
N_('Search for remote execution proxy outside of the proxies assigned to the host. ' +
|
13
|
-
"The search will be limited to the host's organization and location."),
|
14
|
-
true,
|
15
|
-
N_('Enable Global Proxy')),
|
16
|
-
self.set('remote_execution_ssh_user',
|
17
|
-
N_('Default user to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_user.'),
|
18
|
-
'root',
|
19
|
-
N_('SSH User')),
|
20
|
-
self.set('remote_execution_effective_user',
|
21
|
-
N_('Default user to use for executing the script. If the user differs from the SSH user, su or sudo is used to switch the user.'),
|
22
|
-
'root',
|
23
|
-
N_('Effective User')),
|
24
|
-
self.set('remote_execution_effective_user_method',
|
25
|
-
N_('What command should be used to switch to the effective user. One of %s') % SSHExecutionProvider::EFFECTIVE_USER_METHODS.inspect,
|
26
|
-
'sudo',
|
27
|
-
N_('Effective User Method'),
|
28
|
-
nil,
|
29
|
-
{ :collection => proc { Hash[SSHExecutionProvider::EFFECTIVE_USER_METHODS.map { |method| [method, method] }] } }),
|
30
|
-
self.set('remote_execution_effective_user_password', N_("Effective user password"), '', N_("Effective user password"), nil, {:encrypted => true}),
|
31
|
-
self.set('remote_execution_sync_templates',
|
32
|
-
N_('Whether we should sync templates from disk when running db:seed.'),
|
33
|
-
true,
|
34
|
-
N_('Sync Job Templates')),
|
35
|
-
self.set('remote_execution_ssh_port',
|
36
|
-
N_('Port to use for SSH communication. Default port 22. You may override per host by setting a parameter called remote_execution_ssh_port.'),
|
37
|
-
'22',
|
38
|
-
N_('SSH Port')),
|
39
|
-
self.set('remote_execution_connect_by_ip',
|
40
|
-
N_('Should the ip addresses on host interfaces be preferred over the fqdn? '\
|
41
|
-
'It is useful when DNS not resolving the fqdns properly. You may override this per host by setting a parameter called remote_execution_connect_by_ip. '\
|
42
|
-
'This setting only applies to IPv4. When the host has only an IPv6 address on the interface used for remote execution, hostname will be used even if this setting is set to true.'),
|
43
|
-
false,
|
44
|
-
N_('Connect by IP')),
|
45
|
-
self.set('remote_execution_ssh_password',
|
46
|
-
N_('Default password to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_password'),
|
47
|
-
nil,
|
48
|
-
N_('Default SSH password'),
|
49
|
-
nil,
|
50
|
-
{ :encrypted => true }),
|
51
|
-
self.set('remote_execution_ssh_key_passphrase',
|
52
|
-
N_('Default key passphrase to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_key_passphrase'),
|
53
|
-
nil,
|
54
|
-
N_('Default SSH key passphrase'),
|
55
|
-
nil,
|
56
|
-
{ :encrypted => true }),
|
57
|
-
self.set('remote_execution_workers_pool_size',
|
58
|
-
N_('Amount of workers in the pool to handle the execution of the remote execution jobs. Restart of the dynflowd/foreman-tasks service is required.'),
|
59
|
-
5,
|
60
|
-
N_('Workers pool size')),
|
61
|
-
self.set('remote_execution_cleanup_working_dirs',
|
62
|
-
N_('When enabled, working directories will be removed after task completion. You may override this per host by setting a parameter called remote_execution_cleanup_working_dirs.'),
|
63
|
-
true,
|
64
|
-
N_('Cleanup working directories')),
|
65
|
-
self.set('remote_execution_cockpit_url',
|
66
|
-
N_('Where to find the Cockpit instance for the Web Console button. By default, no button is shown.'),
|
67
|
-
nil,
|
68
|
-
N_('Cockpit URL'),
|
69
|
-
nil),
|
70
|
-
self.set('remote_execution_form_job_template',
|
71
|
-
N_('Choose a job template that is pre-selected in job invocation form'),
|
72
|
-
'Run Command - SSH Default',
|
73
|
-
N_('Form Job Template'),
|
74
|
-
nil,
|
75
|
-
{ :collection => proc { Hash[JobTemplate.unscoped.map { |template| [template.name, template.name] }] } }),
|
76
|
-
self.set('remote_execution_job_invocation_report_template',
|
77
|
-
N_('Select a report template used for generating a report for a particular remote execution job'),
|
78
|
-
'Jobs - Invocation report template',
|
79
|
-
N_('Job Invocation Report Template'),
|
80
|
-
nil,
|
81
|
-
{ :collection => proc { self.job_invocation_report_templates_select } }),
|
82
|
-
]
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.job_invocation_report_templates_select
|
86
|
-
Hash[ReportTemplate.unscoped.joins(:template_inputs).where(template_inputs: TemplateInput.where(name: 'job_id')).map { |template| [template.name, template.name] }]
|
87
|
-
end
|
88
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { mount } from '@theforeman/test';
|
3
|
-
import { DescriptionField } from '../DescriptionField';
|
4
|
-
|
5
|
-
describe('DescriptionField', () => {
|
6
|
-
it('rendring', () => {
|
7
|
-
const component = mount(
|
8
|
-
<DescriptionField
|
9
|
-
inputs={[{ name: 'command' }]}
|
10
|
-
value="Run %{command}"
|
11
|
-
setValue={jest.fn()}
|
12
|
-
/>
|
13
|
-
);
|
14
|
-
const preview = component.find('#description-preview').hostNodes();
|
15
|
-
const findLink = () => component.find('.pf-m-link.pf-m-inline');
|
16
|
-
expect(findLink().text()).toEqual('Edit job description template');
|
17
|
-
expect(preview.props().value).toEqual('Run command');
|
18
|
-
findLink().simulate('click');
|
19
|
-
const description = component.find('#description').hostNodes();
|
20
|
-
expect(description.props().value).toEqual('Run %{command}');
|
21
|
-
expect(findLink().text()).toEqual('Preview job description');
|
22
|
-
});
|
23
|
-
});
|
@@ -1,76 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { Provider } from 'react-redux';
|
3
|
-
import configureMockStore from 'redux-mock-store';
|
4
|
-
import * as patternfly from '@patternfly/react-core';
|
5
|
-
import { mount, shallow } from '@theforeman/test';
|
6
|
-
import { formatter } from '../Formatter';
|
7
|
-
|
8
|
-
jest.spyOn(patternfly, 'Select');
|
9
|
-
jest.spyOn(patternfly, 'SelectOption');
|
10
|
-
jest.spyOn(patternfly, 'FormGroup');
|
11
|
-
patternfly.Select.mockImplementation(props => <div props={props} />);
|
12
|
-
patternfly.SelectOption.mockImplementation(props => <div props={props} />);
|
13
|
-
patternfly.FormGroup.mockImplementation(props => <div props={props} />);
|
14
|
-
const mockStore = configureMockStore([]);
|
15
|
-
const store = mockStore({});
|
16
|
-
|
17
|
-
describe('formatter', () => {
|
18
|
-
it('render date input', () => {
|
19
|
-
const props = {
|
20
|
-
name: 'date adv',
|
21
|
-
required: false,
|
22
|
-
options: '',
|
23
|
-
advanced: true,
|
24
|
-
value_type: 'date',
|
25
|
-
resource_type: 'ansible_roles',
|
26
|
-
default: '',
|
27
|
-
hidden_value: false,
|
28
|
-
};
|
29
|
-
expect(shallow(formatter(props, {}, jest.fn()))).toMatchSnapshot();
|
30
|
-
});
|
31
|
-
it('render text input', () => {
|
32
|
-
const props = {
|
33
|
-
name: 'plain adv hidden',
|
34
|
-
required: true,
|
35
|
-
description: 'some Description',
|
36
|
-
options: '',
|
37
|
-
advanced: true,
|
38
|
-
value_type: 'plain',
|
39
|
-
resource_type: 'ansible_roles',
|
40
|
-
default: 'Default val',
|
41
|
-
hidden_value: true,
|
42
|
-
};
|
43
|
-
expect(shallow(formatter(props, {}, jest.fn()))).toMatchSnapshot();
|
44
|
-
});
|
45
|
-
it('render select input', () => {
|
46
|
-
const props = {
|
47
|
-
name: 'adv plain search',
|
48
|
-
required: false,
|
49
|
-
input_type: 'user',
|
50
|
-
options: 'option 1\r\noption 2\r\noption 3\r\noption 4',
|
51
|
-
advanced: true,
|
52
|
-
value_type: 'plain',
|
53
|
-
resource_type: 'ansible_roles',
|
54
|
-
default: '',
|
55
|
-
hidden_value: false,
|
56
|
-
};
|
57
|
-
expect(shallow(formatter(props, {}, jest.fn()))).toMatchSnapshot();
|
58
|
-
});
|
59
|
-
it('render search input', () => {
|
60
|
-
const props = {
|
61
|
-
name: 'search adv',
|
62
|
-
required: false,
|
63
|
-
options: '',
|
64
|
-
advanced: true,
|
65
|
-
value_type: 'search',
|
66
|
-
resource_type: 'foreman_tasks/tasks',
|
67
|
-
default: '',
|
68
|
-
hidden_value: false,
|
69
|
-
};
|
70
|
-
expect(
|
71
|
-
mount(
|
72
|
-
<Provider store={store}>{formatter(props, {}, jest.fn())}</Provider>
|
73
|
-
)
|
74
|
-
).toMatchSnapshot();
|
75
|
-
});
|
76
|
-
});
|