foreman_remote_execution 4.3.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/job_invocations_controller.rb +27 -22
- data/app/controllers/foreman_remote_execution/concerns/api/v2/registration_commands_controller_extensions.rb +19 -0
- data/app/controllers/job_invocations_controller.rb +1 -1
- data/app/controllers/job_templates_controller.rb +4 -4
- data/app/controllers/ui_job_wizard_controller.rb +19 -0
- data/app/helpers/job_invocations_helper.rb +2 -2
- data/app/helpers/remote_execution_helper.rb +40 -9
- data/app/lib/actions/remote_execution/run_host_job.rb +36 -6
- data/app/lib/foreman_remote_execution/provider_input.rb +29 -0
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +7 -5
- data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +6 -0
- data/app/models/host_proxy_invocation.rb +4 -0
- data/app/models/host_status/execution_status.rb +5 -5
- data/app/models/invocation_provider_input_value.rb +12 -0
- data/app/models/job_invocation.rb +35 -12
- data/app/models/job_invocation_composer.rb +74 -19
- data/app/models/remote_execution_provider.rb +18 -3
- data/app/models/setting/remote_execution.rb +11 -1
- data/app/models/ssh_execution_provider.rb +4 -4
- data/app/models/targeting.rb +5 -1
- data/app/models/template_invocation.rb +2 -0
- data/app/overrides/execution_interface.rb +8 -8
- data/app/overrides/subnet_proxies.rb +6 -6
- data/app/services/renderer_methods.rb +12 -0
- data/app/views/job_invocations/_form.html.erb +8 -0
- data/app/views/job_invocations/index.html.erb +1 -1
- data/app/views/templates/ssh/module_action.erb +1 -0
- data/app/views/templates/ssh/puppet_run_once.erb +1 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20180110104432_rename_template_invocation_permission.rb +1 -1
- data/db/migrate/20190111153330_remove_remote_execution_without_proxy_setting.rb +4 -4
- data/db/migrate/20210312074713_add_provider_inputs.rb +10 -0
- data/db/migrate/2021051713291621250977_add_host_proxy_invocations.rb +12 -0
- data/extra/cockpit/foreman-cockpit-session +6 -6
- data/foreman_remote_execution.gemspec +1 -1
- data/lib/foreman_remote_execution/engine.rb +14 -12
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/action_names.rb +1 -0
- data/locale/de/foreman_remote_execution.po +77 -27
- data/locale/en/foreman_remote_execution.po +77 -27
- data/locale/en_GB/foreman_remote_execution.po +77 -27
- data/locale/es/foreman_remote_execution.po +77 -27
- data/locale/foreman_remote_execution.pot +241 -163
- data/locale/fr/foreman_remote_execution.po +77 -27
- data/locale/ja/foreman_remote_execution.po +77 -27
- data/locale/ko/foreman_remote_execution.po +77 -27
- data/locale/pt_BR/foreman_remote_execution.po +77 -27
- data/locale/ru/foreman_remote_execution.po +77 -27
- data/locale/zh_CN/foreman_remote_execution.po +77 -27
- data/locale/zh_TW/foreman_remote_execution.po +77 -27
- data/package.json +4 -2
- data/test/functional/api/v2/job_invocations_controller_test.rb +14 -1
- data/test/helpers/remote_execution_helper_test.rb +16 -0
- data/test/unit/job_invocation_composer_test.rb +100 -3
- data/test/unit/job_invocation_report_template_test.rb +57 -0
- data/test/unit/job_invocation_test.rb +1 -1
- data/webpack/JobWizard/JobWizard.js +95 -11
- data/webpack/JobWizard/JobWizard.scss +53 -0
- data/webpack/JobWizard/JobWizardConstants.js +16 -0
- data/webpack/JobWizard/JobWizardSelectors.js +47 -0
- data/webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap +43 -0
- data/webpack/JobWizard/__tests__/fixtures.js +128 -0
- data/webpack/JobWizard/__tests__/integration.test.js +84 -0
- data/webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js +110 -0
- data/webpack/JobWizard/steps/AdvancedFields/DescriptionField.js +67 -0
- data/webpack/JobWizard/steps/AdvancedFields/Fields.js +195 -0
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +144 -0
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js +23 -0
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +109 -0
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js +123 -0
- data/webpack/JobWizard/steps/CategoryAndTemplate/index.js +94 -0
- data/webpack/JobWizard/steps/Schedule/QueryType.js +48 -0
- data/webpack/JobWizard/steps/Schedule/RepeatOn.js +61 -0
- data/webpack/JobWizard/steps/Schedule/ScheduleType.js +25 -0
- data/webpack/JobWizard/steps/Schedule/StartEndDates.js +51 -0
- data/webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js +22 -0
- data/webpack/JobWizard/steps/Schedule/index.js +41 -0
- data/webpack/JobWizard/steps/form/FormHelpers.js +20 -0
- data/webpack/JobWizard/steps/form/Formatter.js +149 -0
- data/webpack/JobWizard/steps/form/GroupedSelectField.js +91 -0
- data/webpack/JobWizard/steps/form/NumberInput.js +33 -0
- data/webpack/JobWizard/steps/form/SelectField.js +60 -0
- data/webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example +76 -0
- data/webpack/__mocks__/foremanReact/common/helpers.js +1 -0
- data/webpack/__mocks__/foremanReact/components/SearchBar.js +18 -1
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +21 -2
- data/webpack/__mocks__/foremanReact/redux/API/index.js +5 -0
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
- data/webpack/global_index.js +6 -0
- data/webpack/index.js +3 -4
- data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +83 -0
- data/webpack/react_app/components/RecentJobsCard/constants.js +1 -0
- data/webpack/react_app/components/RecentJobsCard/index.js +1 -0
- data/webpack/react_app/components/RecentJobsCard/styles.css +15 -0
- data/webpack/react_app/components/RegistrationExtension/RexInterface.js +50 -0
- data/webpack/react_app/components/RegistrationExtension/__tests__/RexInterface.test.js +9 -0
- data/webpack/react_app/components/RegistrationExtension/__tests__/__snapshots__/RexInterface.test.js.snap +35 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHostsSelectors.test.js +8 -3
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsSelectors.test.js.snap +7 -2
- data/webpack/react_app/extend/fillRecentJobsCard.js +11 -0
- data/webpack/react_app/extend/fillregistrationAdvanced.js +11 -0
- data/webpack/react_app/extend/reducers.js +5 -0
- metadata +52 -8
- data/app/models/concerns/foreman_remote_execution/orchestration/ssh.rb +0 -70
- data/app/views/api/v2/registration/_form.html.erb +0 -12
- data/test/models/orchestration/ssh_test.rb +0 -56
|
@@ -9,9 +9,14 @@ import {
|
|
|
9
9
|
} from '../TargetingHostsSelectors';
|
|
10
10
|
|
|
11
11
|
const state = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
TARGETING_HOSTS: {
|
|
13
|
+
status: 'RESOLVED',
|
|
14
|
+
response: {
|
|
15
|
+
hosts: [1, 2],
|
|
16
|
+
total_hosts: 2,
|
|
17
|
+
autoRefresh: 'true',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
const fixtures = {
|
|
@@ -4,8 +4,13 @@ exports[`TargetingHostsSelectors should return apiStatus 1`] = `"RESOLVED"`;
|
|
|
4
4
|
|
|
5
5
|
exports[`TargetingHostsSelectors should return autoRefresh 1`] = `"true"`;
|
|
6
6
|
|
|
7
|
-
exports[`TargetingHostsSelectors should return hosts 1`] = `
|
|
7
|
+
exports[`TargetingHostsSelectors should return hosts 1`] = `
|
|
8
|
+
Array [
|
|
9
|
+
1,
|
|
10
|
+
2,
|
|
11
|
+
]
|
|
12
|
+
`;
|
|
8
13
|
|
|
9
14
|
exports[`TargetingHostsSelectors should return intervalExists 1`] = `false`;
|
|
10
15
|
|
|
11
|
-
exports[`TargetingHostsSelectors should return totalHosts 1`] = `
|
|
16
|
+
exports[`TargetingHostsSelectors should return totalHosts 1`] = `2`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
|
|
3
|
+
import RecentJobsCard from '../components/RecentJobsCard';
|
|
4
|
+
|
|
5
|
+
export default () =>
|
|
6
|
+
addGlobalFill(
|
|
7
|
+
'details-cards',
|
|
8
|
+
'rex-host-details-latest-jobs',
|
|
9
|
+
<RecentJobsCard />,
|
|
10
|
+
1000
|
|
11
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
|
|
3
|
+
import RexInterface from '../components/RegistrationExtension/RexInterface';
|
|
4
|
+
|
|
5
|
+
export default () =>
|
|
6
|
+
addGlobalFill(
|
|
7
|
+
'registrationAdvanced',
|
|
8
|
+
'foreman-remote-exectuion-rex-interface',
|
|
9
|
+
<RexInterface key="registration-rex-interface" />,
|
|
10
|
+
100
|
|
11
|
+
);
|
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.
|
|
4
|
+
version: 4.5.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: 2021-
|
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: deface
|
|
@@ -64,14 +64,14 @@ dependencies:
|
|
|
64
64
|
requirements:
|
|
65
65
|
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 4.
|
|
67
|
+
version: 4.1.0
|
|
68
68
|
type: :runtime
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - ">="
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 4.
|
|
74
|
+
version: 4.1.0
|
|
75
75
|
- !ruby/object:Gem::Dependency
|
|
76
76
|
name: factory_bot_rails
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,6 +142,7 @@ files:
|
|
|
142
142
|
- app/controllers/concerns/foreman/controller/parameters/job_template.rb
|
|
143
143
|
- app/controllers/concerns/foreman/controller/parameters/remote_execution_feature.rb
|
|
144
144
|
- app/controllers/concerns/foreman/controller/parameters/targeting.rb
|
|
145
|
+
- app/controllers/foreman_remote_execution/concerns/api/v2/registration_commands_controller_extensions.rb
|
|
145
146
|
- app/controllers/foreman_remote_execution/concerns/api/v2/registration_controller_extensions.rb
|
|
146
147
|
- app/controllers/foreman_remote_execution/concerns/api/v2/subnets_controller_extensions.rb
|
|
147
148
|
- app/controllers/job_invocations_controller.rb
|
|
@@ -158,6 +159,7 @@ files:
|
|
|
158
159
|
- app/lib/actions/middleware/bind_job_invocation.rb
|
|
159
160
|
- app/lib/actions/remote_execution/run_host_job.rb
|
|
160
161
|
- app/lib/actions/remote_execution/run_hosts_job.rb
|
|
162
|
+
- app/lib/foreman_remote_execution/provider_input.rb
|
|
161
163
|
- app/lib/foreman_remote_execution/renderer/scope/input.rb
|
|
162
164
|
- app/lib/proxy_api/remote_execution_ssh.rb
|
|
163
165
|
- app/mailers/.gitkeep
|
|
@@ -169,7 +171,6 @@ files:
|
|
|
169
171
|
- app/models/concerns/foreman_remote_execution/foreman_tasks_triggering_extensions.rb
|
|
170
172
|
- app/models/concerns/foreman_remote_execution/host_extensions.rb
|
|
171
173
|
- app/models/concerns/foreman_remote_execution/nic_extensions.rb
|
|
172
|
-
- app/models/concerns/foreman_remote_execution/orchestration/ssh.rb
|
|
173
174
|
- app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
|
|
174
175
|
- app/models/concerns/foreman_remote_execution/subnet_extensions.rb
|
|
175
176
|
- app/models/concerns/foreman_remote_execution/taxonomy_extensions.rb
|
|
@@ -178,8 +179,10 @@ files:
|
|
|
178
179
|
- app/models/concerns/foreman_remote_execution/template_overrides.rb
|
|
179
180
|
- app/models/concerns/foreman_remote_execution/user_extensions.rb
|
|
180
181
|
- app/models/foreign_input_set.rb
|
|
182
|
+
- app/models/host_proxy_invocation.rb
|
|
181
183
|
- app/models/host_status/execution_status.rb
|
|
182
184
|
- app/models/input_template_renderer.rb
|
|
185
|
+
- app/models/invocation_provider_input_value.rb
|
|
183
186
|
- app/models/job_invocation.rb
|
|
184
187
|
- app/models/job_invocation_composer.rb
|
|
185
188
|
- app/models/job_invocation_task_group.rb
|
|
@@ -198,6 +201,7 @@ files:
|
|
|
198
201
|
- app/overrides/subnet_proxies.rb
|
|
199
202
|
- app/services/default_proxy_proxy_selector.rb
|
|
200
203
|
- app/services/remote_execution_proxy_selector.rb
|
|
204
|
+
- app/services/renderer_methods.rb
|
|
201
205
|
- app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
|
|
202
206
|
- app/views/api/v2/foreign_input_sets/base.json.rabl
|
|
203
207
|
- app/views/api/v2/foreign_input_sets/create.json.rabl
|
|
@@ -216,7 +220,6 @@ files:
|
|
|
216
220
|
- app/views/api/v2/job_templates/main.json.rabl
|
|
217
221
|
- app/views/api/v2/job_templates/show.json.rabl
|
|
218
222
|
- app/views/api/v2/job_templates/update.json.rabl
|
|
219
|
-
- app/views/api/v2/registration/_form.html.erb
|
|
220
223
|
- app/views/api/v2/remote_execution_features/base.json.rabl
|
|
221
224
|
- app/views/api/v2/remote_execution_features/index.json.rabl
|
|
222
225
|
- app/views/api/v2/remote_execution_features/main.json.rabl
|
|
@@ -320,6 +323,8 @@ files:
|
|
|
320
323
|
- db/migrate/20190111153330_remove_remote_execution_without_proxy_setting.rb
|
|
321
324
|
- db/migrate/20200623073022_rename_sudo_password_to_effective_user_password.rb
|
|
322
325
|
- db/migrate/20200820122057_add_proxy_selector_override_to_remote_execution_feature.rb
|
|
326
|
+
- db/migrate/20210312074713_add_provider_inputs.rb
|
|
327
|
+
- db/migrate/2021051713291621250977_add_host_proxy_invocations.rb
|
|
323
328
|
- db/seeds.d/100-assign_features_with_templates.rb
|
|
324
329
|
- db/seeds.d/20-permissions.rb
|
|
325
330
|
- db/seeds.d/50-notification_blueprints.rb
|
|
@@ -376,7 +381,6 @@ files:
|
|
|
376
381
|
- test/functional/job_templates_controller_test.rb
|
|
377
382
|
- test/functional/ui_job_wizard_controller_test.rb
|
|
378
383
|
- test/helpers/remote_execution_helper_test.rb
|
|
379
|
-
- test/models/orchestration/ssh_test.rb
|
|
380
384
|
- test/support/remote_execution_helper.rb
|
|
381
385
|
- test/test_plugin_helper.rb
|
|
382
386
|
- test/unit/actions/run_host_job_test.rb
|
|
@@ -387,6 +391,7 @@ files:
|
|
|
387
391
|
- test/unit/execution_task_status_mapper_test.rb
|
|
388
392
|
- test/unit/input_template_renderer_test.rb
|
|
389
393
|
- test/unit/job_invocation_composer_test.rb
|
|
394
|
+
- test/unit/job_invocation_report_template_test.rb
|
|
390
395
|
- test/unit/job_invocation_test.rb
|
|
391
396
|
- test/unit/job_template_effective_user_test.rb
|
|
392
397
|
- test/unit/job_template_test.rb
|
|
@@ -396,18 +401,54 @@ files:
|
|
|
396
401
|
- test/unit/targeting_test.rb
|
|
397
402
|
- test/unit/template_invocation_input_value_test.rb
|
|
398
403
|
- webpack/JobWizard/JobWizard.js
|
|
404
|
+
- webpack/JobWizard/JobWizard.scss
|
|
405
|
+
- webpack/JobWizard/JobWizardConstants.js
|
|
406
|
+
- webpack/JobWizard/JobWizardSelectors.js
|
|
407
|
+
- webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap
|
|
408
|
+
- webpack/JobWizard/__tests__/fixtures.js
|
|
409
|
+
- webpack/JobWizard/__tests__/integration.test.js
|
|
399
410
|
- webpack/JobWizard/index.js
|
|
411
|
+
- webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js
|
|
412
|
+
- webpack/JobWizard/steps/AdvancedFields/DescriptionField.js
|
|
413
|
+
- webpack/JobWizard/steps/AdvancedFields/Fields.js
|
|
414
|
+
- webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js
|
|
415
|
+
- webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js
|
|
416
|
+
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js
|
|
417
|
+
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js
|
|
418
|
+
- webpack/JobWizard/steps/CategoryAndTemplate/index.js
|
|
419
|
+
- webpack/JobWizard/steps/Schedule/QueryType.js
|
|
420
|
+
- webpack/JobWizard/steps/Schedule/RepeatOn.js
|
|
421
|
+
- webpack/JobWizard/steps/Schedule/ScheduleType.js
|
|
422
|
+
- webpack/JobWizard/steps/Schedule/StartEndDates.js
|
|
423
|
+
- webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js
|
|
424
|
+
- webpack/JobWizard/steps/Schedule/index.js
|
|
425
|
+
- webpack/JobWizard/steps/form/FormHelpers.js
|
|
426
|
+
- webpack/JobWizard/steps/form/Formatter.js
|
|
427
|
+
- webpack/JobWizard/steps/form/GroupedSelectField.js
|
|
428
|
+
- webpack/JobWizard/steps/form/NumberInput.js
|
|
429
|
+
- webpack/JobWizard/steps/form/SelectField.js
|
|
430
|
+
- webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example
|
|
400
431
|
- webpack/Routes/routes.js
|
|
401
432
|
- webpack/__mocks__/foremanReact/common/I18n.js
|
|
433
|
+
- webpack/__mocks__/foremanReact/common/helpers.js
|
|
402
434
|
- webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
|
|
403
435
|
- webpack/__mocks__/foremanReact/components/SearchBar.js
|
|
404
436
|
- webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js
|
|
405
437
|
- webpack/__mocks__/foremanReact/constants.js
|
|
406
438
|
- webpack/__mocks__/foremanReact/history.js
|
|
407
439
|
- webpack/__mocks__/foremanReact/redux/API/APISelectors.js
|
|
440
|
+
- webpack/__mocks__/foremanReact/redux/API/index.js
|
|
408
441
|
- webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors.js
|
|
442
|
+
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
|
409
443
|
- webpack/global_index.js
|
|
410
444
|
- webpack/index.js
|
|
445
|
+
- webpack/react_app/components/RecentJobsCard/RecentJobsCard.js
|
|
446
|
+
- webpack/react_app/components/RecentJobsCard/constants.js
|
|
447
|
+
- webpack/react_app/components/RecentJobsCard/index.js
|
|
448
|
+
- webpack/react_app/components/RecentJobsCard/styles.css
|
|
449
|
+
- webpack/react_app/components/RegistrationExtension/RexInterface.js
|
|
450
|
+
- webpack/react_app/components/RegistrationExtension/__tests__/RexInterface.test.js
|
|
451
|
+
- webpack/react_app/components/RegistrationExtension/__tests__/__snapshots__/RexInterface.test.js.snap
|
|
411
452
|
- webpack/react_app/components/TargetingHosts/TargetingHosts.js
|
|
412
453
|
- webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js
|
|
413
454
|
- webpack/react_app/components/TargetingHosts/TargetingHostsHelpers.js
|
|
@@ -431,6 +472,9 @@ files:
|
|
|
431
472
|
- webpack/react_app/components/jobInvocations/AggregateStatus/index.js
|
|
432
473
|
- webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js
|
|
433
474
|
- webpack/react_app/components/jobInvocations/index.js
|
|
475
|
+
- webpack/react_app/extend/fillRecentJobsCard.js
|
|
476
|
+
- webpack/react_app/extend/fillregistrationAdvanced.js
|
|
477
|
+
- webpack/react_app/extend/reducers.js
|
|
434
478
|
- webpack/react_app/redux/actions/jobInvocations/index.js
|
|
435
479
|
- webpack/react_app/redux/consts.js
|
|
436
480
|
- webpack/react_app/redux/reducers/index.js
|
|
@@ -477,7 +521,6 @@ test_files:
|
|
|
477
521
|
- test/functional/job_templates_controller_test.rb
|
|
478
522
|
- test/functional/ui_job_wizard_controller_test.rb
|
|
479
523
|
- test/helpers/remote_execution_helper_test.rb
|
|
480
|
-
- test/models/orchestration/ssh_test.rb
|
|
481
524
|
- test/support/remote_execution_helper.rb
|
|
482
525
|
- test/test_plugin_helper.rb
|
|
483
526
|
- test/unit/actions/run_host_job_test.rb
|
|
@@ -488,6 +531,7 @@ test_files:
|
|
|
488
531
|
- test/unit/execution_task_status_mapper_test.rb
|
|
489
532
|
- test/unit/input_template_renderer_test.rb
|
|
490
533
|
- test/unit/job_invocation_composer_test.rb
|
|
534
|
+
- test/unit/job_invocation_report_template_test.rb
|
|
491
535
|
- test/unit/job_invocation_test.rb
|
|
492
536
|
- test/unit/job_template_effective_user_test.rb
|
|
493
537
|
- test/unit/job_template_test.rb
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
module ForemanRemoteExecution
|
|
2
|
-
module Orchestration::SSH
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
included do
|
|
6
|
-
before_destroy :ssh_destroy
|
|
7
|
-
after_validation :queue_ssh_destroy
|
|
8
|
-
register_rebuild(:queue_ssh_destroy, N_("SSH_#{self.to_s.split('::').first}"))
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def drop_from_known_hosts(proxy_id)
|
|
12
|
-
_, _, target = host_kind_target
|
|
13
|
-
return true if target.nil?
|
|
14
|
-
|
|
15
|
-
proxy = ::SmartProxy.find(proxy_id)
|
|
16
|
-
begin
|
|
17
|
-
proxy.drop_host_from_known_hosts(target)
|
|
18
|
-
rescue ::ProxyAPI::ProxyException => e
|
|
19
|
-
if e.wrapped_exception.is_a?(RestClient::NotFound)
|
|
20
|
-
# ignore 404 when known_hosts entry is missing or the module was not enabled
|
|
21
|
-
Foreman::Logging.exception "Proxy failed to delete SSH known_hosts for #{name}, #{ip}", e, :level => :error
|
|
22
|
-
else
|
|
23
|
-
raise e
|
|
24
|
-
end
|
|
25
|
-
rescue => e
|
|
26
|
-
Rails.logger.warn e.message
|
|
27
|
-
return false
|
|
28
|
-
end
|
|
29
|
-
true
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def ssh_destroy
|
|
33
|
-
logger.debug "Scheduling SSH known_hosts cleanup"
|
|
34
|
-
|
|
35
|
-
host, _kind, _target = host_kind_target
|
|
36
|
-
# #remote_execution_proxies may not be defined on the host object in some case
|
|
37
|
-
# for example Host::Discovered does not have it defined, even though these hosts
|
|
38
|
-
# have Nic::Managed interfaces associated with them
|
|
39
|
-
proxies = (host.try(:remote_execution_proxies, 'SSH') || {}).values
|
|
40
|
-
proxies.flatten.uniq.each do |proxy|
|
|
41
|
-
queue.create(id: queue_id(proxy.id), name: _("Remove SSH known hosts for %s") % self,
|
|
42
|
-
priority: 200, action: [self, :drop_from_known_hosts, proxy.id])
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def queue_ssh_destroy
|
|
47
|
-
should_drop_from_known_hosts? && ssh_destroy
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def should_drop_from_known_hosts?
|
|
51
|
-
host, = host_kind_target
|
|
52
|
-
host && !host.new_record? && host.build && host.changes.key?('build')
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
private
|
|
56
|
-
|
|
57
|
-
def host_kind_target
|
|
58
|
-
if self.is_a?(::Host::Base)
|
|
59
|
-
[self, 'host', name]
|
|
60
|
-
else
|
|
61
|
-
[self.host, 'interface', ip]
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def queue_id(proxy_id)
|
|
66
|
-
_, kind, id = host_kind_target
|
|
67
|
-
"ssh_remove_known_hosts_#{kind}_#{id}_#{proxy_id}"
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<div class='form-group'>
|
|
2
|
-
<label class='col-md-2 control-label'>
|
|
3
|
-
<%= _('Remote Execution Interface') %>
|
|
4
|
-
<% help = _('Identifier of the Host interface for Remote execution') %>
|
|
5
|
-
<a rel="popover" data-content="<%= help %>" data-trigger="focus" data-container="body" data-html="true" tabindex="-1">
|
|
6
|
-
<span class="pficon pficon-info "></span>
|
|
7
|
-
</a>
|
|
8
|
-
</label>
|
|
9
|
-
<div class='col-md-4'>
|
|
10
|
-
<%= text_field_tag 'remote_execution_interface', params[:remote_execution_interface], class: 'form-control' %>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
require 'test_plugin_helper'
|
|
2
|
-
|
|
3
|
-
class SSHOrchestrationTest < ActiveSupport::TestCase
|
|
4
|
-
let(:host) { FactoryBot.create(:host, :managed, :with_subnet) }
|
|
5
|
-
let(:proxy) { FactoryBot.create(:smart_proxy, :ssh) }
|
|
6
|
-
let(:interface) { host.interfaces.first }
|
|
7
|
-
|
|
8
|
-
before { interface.subnet.remote_execution_proxies = [proxy] }
|
|
9
|
-
|
|
10
|
-
it 'attempts to drop IP address and hostname from smart proxies on destroy' do
|
|
11
|
-
host.stubs(:skip_orchestration?).returns false
|
|
12
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(interface.ip)
|
|
13
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(host.name)
|
|
14
|
-
host.destroy
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'attempts to drop IP address and hostname from smart proxies on rebuild' do
|
|
18
|
-
host.stubs(:skip_orchestration?).returns false
|
|
19
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(interface.ip)
|
|
20
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(host.name)
|
|
21
|
-
|
|
22
|
-
host.build = true
|
|
23
|
-
host.save!
|
|
24
|
-
|
|
25
|
-
ids = ["ssh_remove_known_hosts_interface_#{interface.ip}_#{proxy.id}",
|
|
26
|
-
"ssh_remove_known_hosts_host_#{host.name}_#{proxy.id}"]
|
|
27
|
-
_(host.queue.task_ids).must_equal ids
|
|
28
|
-
_(host.queue.items.map(&:status)).must_equal %w(completed completed)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'does not fail on 404 from the smart proxy' do
|
|
32
|
-
host.stubs(:skip_orchestration?).returns false
|
|
33
|
-
::ProxyAPI::RemoteExecutionSSH.any_instance.expects(:delete).raises(RestClient::ResourceNotFound).twice
|
|
34
|
-
host.build = true
|
|
35
|
-
host.save!
|
|
36
|
-
ids = ["ssh_remove_known_hosts_interface_#{interface.ip}_#{proxy.id}",
|
|
37
|
-
"ssh_remove_known_hosts_host_#{host.name}_#{proxy.id}"]
|
|
38
|
-
_(host.queue.task_ids).must_equal ids
|
|
39
|
-
_(host.queue.items.map(&:status)).must_equal %w(completed completed)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it 'does not trigger the removal when creating a new host' do
|
|
43
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).never
|
|
44
|
-
host = Host::Managed.new(:name => 'test', :ip => '127.0.0.1')
|
|
45
|
-
host.stubs(:skip_orchestration?).returns false
|
|
46
|
-
_(host.queue.task_ids).must_equal []
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'does not call to the proxy when target is nil' do
|
|
50
|
-
host.stubs(:skip_orchestration?).returns false
|
|
51
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(host.name)
|
|
52
|
-
host.interfaces.first.stubs(:ip)
|
|
53
|
-
host.destroy
|
|
54
|
-
_(host.queue.items.map(&:status)).must_equal %w(completed completed)
|
|
55
|
-
end
|
|
56
|
-
end
|