foreman_remote_execution 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/job_invocations_controller.rb +1 -0
  3. data/app/controllers/foreman_remote_execution/concerns/api/v2/registration_controller_extensions.rb +5 -0
  4. data/app/controllers/ui_job_wizard_controller.rb +1 -1
  5. data/app/helpers/hosts_extensions_helper.rb +62 -0
  6. data/app/helpers/remote_execution_helper.rb +4 -3
  7. data/app/lib/actions/remote_execution/run_host_job.rb +5 -1
  8. data/app/lib/actions/remote_execution/run_hosts_job.rb +4 -0
  9. data/app/models/concerns/foreman_remote_execution/host_extensions.rb +5 -1
  10. data/app/models/concerns/foreman_remote_execution/nic_extensions.rb +6 -4
  11. data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +1 -1
  12. data/app/models/job_invocation_composer.rb +7 -3
  13. data/app/models/job_template.rb +4 -1
  14. data/app/models/remote_execution_provider.rb +10 -1
  15. data/app/models/ssh_execution_provider.rb +20 -7
  16. data/app/services/default_proxy_proxy_selector.rb +1 -1
  17. data/app/services/remote_execution_proxy_selector.rb +7 -2
  18. data/app/views/api/v2/host/main.rabl +1 -0
  19. data/app/views/api/v2/job_invocations/base.json.rabl +1 -1
  20. data/app/views/dashboard/_latest-jobs.html.erb +1 -1
  21. data/app/views/job_invocations/_card_target_hosts.html.erb +8 -0
  22. data/app/views/job_invocations/_form.html.erb +2 -0
  23. data/app/views/templates/{ssh → script}/check_update.erb +2 -2
  24. data/app/views/templates/{ssh → script}/module_action.erb +2 -2
  25. data/app/views/templates/{ssh → script}/package_action.erb +5 -2
  26. data/app/views/templates/{ssh → script}/power_action.erb +2 -2
  27. data/app/views/templates/{ssh → script}/puppet_agent_disable.erb +2 -2
  28. data/app/views/templates/{ssh → script}/puppet_agent_enable.erb +2 -2
  29. data/app/views/templates/{ssh → script}/puppet_install_modules_from_forge.erb +2 -2
  30. data/app/views/templates/{ssh → script}/puppet_install_modules_from_git.erb +2 -2
  31. data/app/views/templates/{ssh → script}/puppet_run_once.erb +2 -2
  32. data/app/views/templates/{ssh → script}/run_command.erb +2 -2
  33. data/app/views/templates/{ssh → script}/service_action.erb +2 -2
  34. data/db/migrate/20220321101835_rename_ssh_provider_to_script.rb +29 -0
  35. data/db/migrate/20220331112719_add_ssh_user_to_job_invocation.rb +5 -0
  36. data/db/seeds.d/60-ssh_proxy_feature.rb +3 -0
  37. data/jsconfig.json +8 -0
  38. data/lib/foreman_remote_execution/engine.rb +10 -5
  39. data/lib/foreman_remote_execution/version.rb +1 -1
  40. data/locale/action_names.rb +3 -3
  41. data/locale/de/foreman_remote_execution.po +23 -23
  42. data/locale/en/foreman_remote_execution.po +23 -23
  43. data/locale/en_GB/foreman_remote_execution.po +23 -23
  44. data/locale/es/foreman_remote_execution.po +23 -23
  45. data/locale/foreman_remote_execution.pot +64 -66
  46. data/locale/fr/foreman_remote_execution.po +23 -23
  47. data/locale/ja/foreman_remote_execution.po +23 -23
  48. data/locale/ko/foreman_remote_execution.po +23 -23
  49. data/locale/pt_BR/foreman_remote_execution.po +23 -23
  50. data/locale/ru/foreman_remote_execution.po +23 -23
  51. data/locale/zh_CN/foreman_remote_execution.po +23 -23
  52. data/locale/zh_TW/foreman_remote_execution.po +23 -23
  53. data/package.json +6 -7
  54. data/test/unit/concerns/host_extensions_test.rb +2 -1
  55. data/test/unit/remote_execution_provider_test.rb +2 -0
  56. data/webpack/JobWizard/JobWizard.js +8 -2
  57. data/webpack/JobWizard/JobWizardConstants.js +2 -2
  58. data/webpack/JobWizard/__tests__/fixtures.js +8 -4
  59. data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +2 -2
  60. data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +24 -15
  61. data/webpack/JobWizard/steps/HostsAndInputs/SelectGQL.js +2 -1
  62. data/webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js +1 -1
  63. data/webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js +1 -1
  64. data/webpack/JobWizard/steps/HostsAndInputs/hostgroups.gql +1 -0
  65. data/webpack/JobWizard/steps/HostsAndInputs/hosts.gql +1 -0
  66. data/webpack/JobWizard/steps/ReviewDetails/index.js +1 -1
  67. data/webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js +15 -15
  68. data/webpack/JobWizard/steps/form/GroupedSelectField.js +7 -1
  69. data/webpack/JobWizard/steps/form/SearchSelect.js +0 -1
  70. data/webpack/__mocks__/foremanReact/common/globalIdHelpers.js +1 -0
  71. data/webpack/global_index.js +2 -4
  72. data/webpack/react_app/components/FeaturesDropdown/actions.js +13 -0
  73. data/webpack/react_app/components/FeaturesDropdown/constant.js +2 -0
  74. data/webpack/react_app/components/FeaturesDropdown/index.js +74 -0
  75. data/webpack/react_app/components/HostKebab/KebabItems.js +27 -0
  76. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +10 -5
  77. data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -2
  78. data/webpack/react_app/components/RecentJobsCard/constants.js +1 -0
  79. data/webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js +1 -0
  80. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +8 -3
  81. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +9 -1
  82. data/webpack/react_app/components/TargetingHosts/__tests__/fixtures.js +1 -4
  83. data/webpack/react_app/components/TargetingHosts/index.js +1 -0
  84. data/webpack/react_app/extend/Fills.js +48 -0
  85. metadata +25 -17
  86. data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +0 -62
  87. data/webpack/react_app/extend/fillRecentJobsCard.js +0 -11
  88. data/webpack/react_app/extend/fillregistrationAdvanced.js +0 -11
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
3
+
4
+ import FeaturesDropdown from '../components/FeaturesDropdown';
5
+ import RexInterface from '../components/RegistrationExtension/RexInterface';
6
+ import RecentJobsCard from '../components/RecentJobsCard';
7
+ import KebabItems from '../components/HostKebab/KebabItems';
8
+
9
+ const fills = [
10
+ {
11
+ slot: 'host-details-kebab',
12
+ name: 'kebab-items',
13
+ component: props => <KebabItems {...props} />,
14
+ weight: 500,
15
+ },
16
+ {
17
+ slot: 'host-overview-cards',
18
+ name: 'latest-jobs',
19
+ component: props => <RecentJobsCard {...props} />,
20
+ weight: 500,
21
+ },
22
+ {
23
+ slot: 'registrationAdvanced',
24
+ name: 'interface',
25
+ component: props => <RexInterface {...props} />,
26
+ weight: 500,
27
+ },
28
+ {
29
+ slot: '_rex-host-features',
30
+ name: '_rex-host-features',
31
+ component: props => <FeaturesDropdown {...props} />,
32
+ weight: 1000,
33
+ },
34
+ ];
35
+
36
+ const registerFills = () => {
37
+ fills.forEach(({ slot, id, component: Component, weight, metadata }) =>
38
+ addGlobalFill(
39
+ slot,
40
+ id,
41
+ <Component key={`rex-fill-${id}`} />,
42
+ weight,
43
+ metadata
44
+ )
45
+ );
46
+ };
47
+
48
+ export default registerFills;
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: 6.0.0
4
+ version: 7.0.0
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: 2022-02-17 00:00:00.000000000 Z
11
+ date: 2022-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -142,8 +142,8 @@ files:
142
142
  - app/graphql/types/recurrence_input.rb
143
143
  - app/graphql/types/scheduling_input.rb
144
144
  - app/graphql/types/targeting_enum.rb
145
- - app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
146
145
  - app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb
146
+ - app/helpers/hosts_extensions_helper.rb
147
147
  - app/helpers/job_invocation_output_helper.rb
148
148
  - app/helpers/job_invocations_chart_helper.rb
149
149
  - app/helpers/job_invocations_helper.rb
@@ -201,6 +201,7 @@ files:
201
201
  - app/views/api/v2/foreign_input_sets/index.json.rabl
202
202
  - app/views/api/v2/foreign_input_sets/main.json.rabl
203
203
  - app/views/api/v2/foreign_input_sets/show.json.rabl
204
+ - app/views/api/v2/host/main.rabl
204
205
  - app/views/api/v2/interfaces/execution_flag.json.rabl
205
206
  - app/views/api/v2/job_invocations/base.json.rabl
206
207
  - app/views/api/v2/job_invocations/create.json.rabl
@@ -263,17 +264,17 @@ files:
263
264
  - app/views/template_invocations/_refresh.js.erb
264
265
  - app/views/template_invocations/show.html.erb
265
266
  - app/views/template_invocations/show.js.erb
266
- - app/views/templates/ssh/check_update.erb
267
- - app/views/templates/ssh/module_action.erb
268
- - app/views/templates/ssh/package_action.erb
269
- - app/views/templates/ssh/power_action.erb
270
- - app/views/templates/ssh/puppet_agent_disable.erb
271
- - app/views/templates/ssh/puppet_agent_enable.erb
272
- - app/views/templates/ssh/puppet_install_modules_from_forge.erb
273
- - app/views/templates/ssh/puppet_install_modules_from_git.erb
274
- - app/views/templates/ssh/puppet_run_once.erb
275
- - app/views/templates/ssh/run_command.erb
276
- - app/views/templates/ssh/service_action.erb
267
+ - app/views/templates/script/check_update.erb
268
+ - app/views/templates/script/module_action.erb
269
+ - app/views/templates/script/package_action.erb
270
+ - app/views/templates/script/power_action.erb
271
+ - app/views/templates/script/puppet_agent_disable.erb
272
+ - app/views/templates/script/puppet_agent_enable.erb
273
+ - app/views/templates/script/puppet_install_modules_from_forge.erb
274
+ - app/views/templates/script/puppet_install_modules_from_git.erb
275
+ - app/views/templates/script/puppet_run_once.erb
276
+ - app/views/templates/script/run_command.erb
277
+ - app/views/templates/script/service_action.erb
277
278
  - config/routes.rb
278
279
  - db/migrate/20150612121541_add_job_template_to_template.rb
279
280
  - db/migrate/20150708133241_add_targeting.rb
@@ -321,6 +322,8 @@ files:
321
322
  - db/migrate/20210312074713_add_provider_inputs.rb
322
323
  - db/migrate/2021051713291621250977_add_host_proxy_invocations.rb
323
324
  - db/migrate/20210816100932_rex_setting_category_to_dsl.rb
325
+ - db/migrate/20220321101835_rename_ssh_provider_to_script.rb
326
+ - db/migrate/20220331112719_add_ssh_user_to_job_invocation.rb
324
327
  - db/seeds.d/100-assign_features_with_templates.rb
325
328
  - db/seeds.d/20-permissions.rb
326
329
  - db/seeds.d/50-notification_blueprints.rb
@@ -333,6 +336,7 @@ files:
333
336
  - extra/cockpit/foreman-cockpit.service
334
337
  - extra/cockpit/settings.yml.example
335
338
  - foreman_remote_execution.gemspec
339
+ - jsconfig.json
336
340
  - lib/foreman_remote_execution.rb
337
341
  - lib/foreman_remote_execution/engine.rb
338
342
  - lib/foreman_remote_execution/version.rb
@@ -459,6 +463,7 @@ files:
459
463
  - webpack/Routes/routes.js
460
464
  - webpack/__mocks__/foremanReact/Root/Context/ForemanContext/index.js
461
465
  - webpack/__mocks__/foremanReact/common/I18n.js
466
+ - webpack/__mocks__/foremanReact/common/globalIdHelpers.js
462
467
  - webpack/__mocks__/foremanReact/common/helpers.js
463
468
  - webpack/__mocks__/foremanReact/components/AutoComplete/AutoCompleteActions.js
464
469
  - webpack/__mocks__/foremanReact/components/AutoComplete/AutoCompleteConstants.js
@@ -475,6 +480,10 @@ files:
475
480
  - webpack/global_index.js
476
481
  - webpack/helpers.js
477
482
  - webpack/index.js
483
+ - webpack/react_app/components/FeaturesDropdown/actions.js
484
+ - webpack/react_app/components/FeaturesDropdown/constant.js
485
+ - webpack/react_app/components/FeaturesDropdown/index.js
486
+ - webpack/react_app/components/HostKebab/KebabItems.js
478
487
  - webpack/react_app/components/RecentJobsCard/JobStatusIcon.js
479
488
  - webpack/react_app/components/RecentJobsCard/RecentJobsCard.js
480
489
  - webpack/react_app/components/RecentJobsCard/RecentJobsTable.js
@@ -507,8 +516,7 @@ files:
507
516
  - webpack/react_app/components/jobInvocations/AggregateStatus/index.js
508
517
  - webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js
509
518
  - webpack/react_app/components/jobInvocations/index.js
510
- - webpack/react_app/extend/fillRecentJobsCard.js
511
- - webpack/react_app/extend/fillregistrationAdvanced.js
519
+ - webpack/react_app/extend/Fills.js
512
520
  - webpack/react_app/extend/reducers.js
513
521
  - webpack/react_app/redux/actions/jobInvocations/index.js
514
522
  - webpack/react_app/redux/consts.js
@@ -536,7 +544,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
536
544
  - !ruby/object:Gem::Version
537
545
  version: '0'
538
546
  requirements: []
539
- rubygems_version: 3.1.2
547
+ rubygems_version: 3.1.4
540
548
  signing_key:
541
549
  specification_version: 4
542
550
  summary: A plugin bringing remote execution to the Foreman, completing the config
@@ -1,62 +0,0 @@
1
- module ForemanRemoteExecution
2
- module HostsHelperExtensions
3
- def host_overview_buttons(host)
4
- [
5
- { :button => link_to_if_authorized(_("Jobs"), hash_for_job_invocations_path(search: "host=#{host.name}"), :title => _("Job invocations"), :class => 'btn btn-default'), :priority => 200 },
6
- ]
7
- end
8
-
9
- def multiple_actions
10
- res = super
11
- res += [ [_('Schedule Remote Job'), new_job_invocation_path, false] ] if can_schedule_jobs?
12
- res
13
- end
14
-
15
- def schedule_job_multi_button(*args)
16
- host_features = rex_host_features(*args)
17
-
18
- if host_features.present?
19
- action_buttons(schedule_job_button(*args), *host_features)
20
- else
21
- schedule_job_button(*args)
22
- end
23
- end
24
-
25
- def rex_host_features(host, *_rest)
26
- return [] unless can_execute_on_host?(host)
27
- RemoteExecutionFeature.with_host_action_button.order(:label).map do |feature|
28
- link_to(_('%s') % feature.name, job_invocations_path(:host_ids => [host.id], :feature => feature.label), :method => :post)
29
- end
30
- end
31
-
32
- def schedule_job_button(host, *_rest)
33
- return unless can_execute_on_host?(host)
34
- link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [host.id]), :id => :run_button, :class => 'btn btn-default')
35
- end
36
-
37
- def web_console_button(host, *args)
38
- return if !authorized_for(permission: 'cockpit_hosts', auth_object: host) || !can_execute_on_infrastructure_host?(host)
39
-
40
- url = SSHExecutionProvider.cockpit_url_for_host(host.name)
41
- url ? link_to(_('Web Console'), url, :class => 'btn btn-default', :id => :'web-console-button', :target => '_new') : nil
42
- end
43
-
44
- def host_title_actions(*args)
45
- title_actions(button_group(schedule_job_multi_button(*args)),
46
- button_group(web_console_button(*args)))
47
- super(*args)
48
- end
49
-
50
- def can_schedule_jobs?
51
- authorized_for(controller: :job_invocations, action: :create)
52
- end
53
-
54
- def can_execute_on_host?(host)
55
- can_schedule_jobs? && can_execute_on_infrastructure_host?(host)
56
- end
57
-
58
- def can_execute_on_infrastructure_host?(host)
59
- !host.infrastructure_host? || User.current.can?(:execute_jobs_on_infrastructure_hosts)
60
- end
61
- end
62
- end
@@ -1,11 +0,0 @@
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 key="rex-host-details-latest-jobs" />,
10
- 1000
11
- );
@@ -1,11 +0,0 @@
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
- );