foreman_remote_execution 13.2.6 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +77 -77
  3. data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +1667 -2
  4. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +7 -7
  5. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +33 -33
  6. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +131 -131
  7. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +131 -131
  8. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +38 -38
  9. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +16 -16
  10. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +33 -33
  11. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +7 -7
  12. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +134 -134
  13. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +6 -6
  14. data/app/controllers/ui_job_wizard_controller.rb +1 -1
  15. data/app/lib/foreman_remote_execution/renderer_methods.rb +14 -0
  16. data/config/initializers/inflections.rb +6 -0
  17. data/lib/foreman_remote_execution/engine.rb +243 -250
  18. data/lib/foreman_remote_execution/version.rb +1 -1
  19. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  20. data/locale/de/foreman_remote_execution.po +80 -81
  21. data/locale/en/foreman_remote_execution.po +1675 -0
  22. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  23. data/locale/en_GB/foreman_remote_execution.po +7 -7
  24. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  25. data/locale/es/foreman_remote_execution.po +33 -33
  26. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  27. data/locale/fr/foreman_remote_execution.po +132 -132
  28. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  29. data/locale/ja/foreman_remote_execution.po +131 -131
  30. data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  31. data/locale/ka/foreman_remote_execution.po +38 -38
  32. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  33. data/locale/ko/foreman_remote_execution.po +16 -16
  34. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  35. data/locale/pt_BR/foreman_remote_execution.po +33 -33
  36. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  37. data/locale/ru/foreman_remote_execution.po +7 -7
  38. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  39. data/locale/zh_CN/foreman_remote_execution.po +134 -136
  40. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  41. data/locale/zh_TW/foreman_remote_execution.po +6 -6
  42. data/test/functional/ui_job_wizard_controller_test.rb +1 -1
  43. metadata +4 -3
  44. data/app/services/renderer_methods.rb +0 -12
@@ -3,11 +3,11 @@
3
3
  "locale_data": {
4
4
  "foreman_remote_execution": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_remote_execution 14.0.0",
6
+ "Project-Id-Version": "foreman_remote_execution 9.0.1",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-02-15 13:54+0000",
9
9
  "Last-Translator": "FULL NAME <EMAIL@ADDRESS>",
10
- "Language-Team": "Chinese (Taiwan) (http://app.transifex.com/foreman/foreman/language/zh_TW/)",
10
+ "Language-Team": "Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/language/zh_TW/)",
11
11
  "MIME-Version": "1.0",
12
12
  "Content-Type": "text/plain; charset=UTF-8",
13
13
  "Content-Transfer-Encoding": "8bit",
@@ -85,7 +85,7 @@
85
85
  ""
86
86
  ],
87
87
  "Access denied": [
88
- "拒絕存取"
88
+ ""
89
89
  ],
90
90
  "Actions": [
91
91
  "動作"
@@ -136,7 +136,7 @@
136
136
  ""
137
137
  ],
138
138
  "Back": [
139
- "上一步"
139
+ ""
140
140
  ],
141
141
  "Back to Job": [
142
142
  "回到工作"
@@ -775,7 +775,7 @@
775
775
  ""
776
776
  ],
777
777
  "Next": [
778
- "下一步"
778
+ ""
779
779
  ],
780
780
  "No (override)": [
781
781
  ""
@@ -1553,7 +1553,7 @@
1553
1553
  "您不能看到目前指定的範本。現在儲存表單會取消指定範本。"
1554
1554
  ],
1555
1555
  "You are not authorized to perform this action.": [
1556
- "您未經許可執行這項動作。"
1556
+ ""
1557
1557
  ],
1558
1558
  "You have %s results to display. Showing first %s results": [
1559
1559
  ""
@@ -1,4 +1,4 @@
1
- class UiJobWizardController < Api::V2::BaseController
1
+ class UIJobWizardController < Api::V2::BaseController
2
2
  include FiltersHelper
3
3
  def categories
4
4
  job_categories = resource_scope(permission: action_permission)
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # macros to fetch information about invoked jobs
4
+ module ForemanRemoteExecution
5
+ module RendererMethods
6
+ extend ActiveSupport::Concern
7
+
8
+ def find_job_invocation_by_id(job_id, preload: nil)
9
+ JobInvocation.preload(preload).find_by(id: job_id)
10
+ rescue ActiveRecord::NotFound => _e
11
+ raise ::Foreman::Exception.new(N_("Can't find Job Invocation for an id %s"), job_id)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ Rails.autoloaders.each do |autoloader|
2
+ autoloader.inflector.inflect(
3
+ 'ssh_execution_provider' => 'SSHExecutionProvider',
4
+ 'remote_execution_ssh' => 'RemoteExecutionSSH'
5
+ )
6
+ end
@@ -26,15 +26,6 @@ module ForemanRemoteExecution
26
26
  end
27
27
  end
28
28
 
29
- # A workaround for https://projects.theforeman.org/issues/30685
30
- initializer 'foreman_remote_execution.rails_loading_workaround' do
31
- # Without this, in production environment the module gets prepended too
32
- # late and the extensions do not get applied
33
- # TODO: Remove this and from config.to_prepare once there is an extension
34
- # point in Foreman
35
- ProvisioningTemplatesHelper.prepend ForemanRemoteExecution::JobTemplatesExtensions
36
- end
37
-
38
29
  initializer 'foreman_remote_execution.apipie' do
39
30
  Apipie.configuration.checksum_path += ['/api/']
40
31
  end
@@ -45,257 +36,259 @@ module ForemanRemoteExecution
45
36
  ForemanTasks.dynflow.config.eager_load_paths << File.join(ForemanRemoteExecution::Engine.root, 'app/lib/actions')
46
37
  end
47
38
 
48
- initializer 'foreman_remote_execution.register_plugin', before: :finisher_hook do |_app|
49
- Foreman::Plugin.register :foreman_remote_execution do
50
- requires_foreman '>= 3.10'
51
- register_global_js_file 'global'
52
- register_gettext
53
-
54
- apipie_documented_controllers ["#{ForemanRemoteExecution::Engine.root}/app/controllers/api/v2/*.rb"]
55
- ApipieDSL.configuration.dsl_classes_matchers += [
56
- "#{ForemanRemoteExecution::Engine.root}/app/lib/foreman_remote_execution/renderer/**/*.rb",
57
- ]
58
- automatic_assets(false)
59
- precompile_assets(*assets_to_precompile)
60
-
61
- # Add settings to a Remote Execution category
62
- settings do
63
- category :remote_execution, N_('Remote Execution') do
64
- setting 'remote_execution_fallback_proxy',
65
- type: :boolean,
66
- description: 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'),
67
- default: false,
68
- full_name: N_('Fallback to Any Proxy')
69
- setting 'remote_execution_global_proxy',
70
- type: :boolean,
71
- description: N_('Search for remote execution proxy outside of the proxies assigned to the host. The search will be limited to the host\'s organization and location.'),
72
- default: true,
73
- full_name: N_('Enable Global Proxy')
74
- setting 'remote_execution_ssh_user',
75
- type: :string,
76
- description: N_('Default user to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_user.'),
77
- default: 'root',
78
- full_name: N_('SSH User')
79
- setting 'remote_execution_effective_user',
80
- type: :string,
81
- description: 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.'),
82
- default: 'root',
83
- full_name: N_('Effective User')
84
- setting 'remote_execution_effective_user_method',
85
- type: :string,
86
- description: N_('What command should be used to switch to the effective user. One of %s') % SSHExecutionProvider::EFFECTIVE_USER_METHODS.inspect,
87
- default: 'sudo',
88
- full_name: N_('Effective User Method'),
89
- collection: proc { Hash[SSHExecutionProvider::EFFECTIVE_USER_METHODS.map { |method| [method, method] }] }
90
- setting 'remote_execution_effective_user_password',
91
- type: :string,
92
- description: N_('Effective user password'),
93
- default: '',
94
- full_name: N_('Effective user password'),
95
- encrypted: true
96
- setting 'remote_execution_sync_templates',
97
- type: :boolean,
98
- description: N_('Whether we should sync templates from disk when running db:seed.'),
99
- default: true,
100
- full_name: N_('Sync Job Templates')
101
- setting 'remote_execution_ssh_port',
102
- type: :integer,
103
- description: N_('Port to use for SSH communication. Default port 22. You may override per host by setting a parameter called remote_execution_ssh_port.'),
104
- default: 22,
105
- full_name: N_('SSH Port')
106
- setting 'remote_execution_connect_by_ip',
107
- type: :boolean,
108
- description: N_('Should the ip addresses on host interfaces be preferred over the fqdn? '\
109
- '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. '\
110
- 'For dual-stacked hosts you should consider the remote_execution_connect_by_ip_prefer_ipv6 setting'),
111
- default: false,
112
- full_name: N_('Connect by IP')
113
- setting 'remote_execution_connect_by_ip_prefer_ipv6',
114
- type: :boolean,
115
- description: N_('When connecting using ip address, should the IPv6 addresses be preferred? '\
116
- 'If no IPv6 address is set, it falls back to IPv4 automatically. You may override this per host by setting a parameter called remote_execution_connect_by_ip_prefer_ipv6. '\
117
- 'By default and for compatibility, IPv4 will be preferred over IPv6 by default'),
118
- default: false,
119
- full_name: N_('Prefer IPv6 over IPv4')
120
- setting 'remote_execution_ssh_password',
121
- type: :string,
122
- description: N_('Default password to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_password'),
123
- default: nil,
124
- full_name: N_('Default SSH password'),
125
- encrypted: true
126
- setting 'remote_execution_ssh_key_passphrase',
127
- type: :string,
128
- description: N_('Default key passphrase to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_key_passphrase'),
129
- default: nil,
130
- full_name: N_('Default SSH key passphrase'),
131
- encrypted: true
132
- setting 'remote_execution_workers_pool_size',
133
- type: :integer,
134
- description: 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.'),
135
- default: 5,
136
- full_name: N_('Workers pool size')
137
- setting 'remote_execution_cleanup_working_dirs',
138
- type: :boolean,
139
- description: 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.'),
140
- default: true,
141
- full_name: N_('Cleanup working directories')
142
- setting 'remote_execution_cockpit_url',
143
- type: :string,
144
- description: N_('Where to find the Cockpit instance for the Web Console button. By default, no button is shown.'),
145
- default: nil,
146
- full_name: N_('Cockpit URL')
147
- setting 'remote_execution_form_job_template',
148
- type: :string,
149
- description: N_('Choose a job template that is pre-selected in job invocation form'),
150
- default: 'Run Command - Script Default',
151
- full_name: N_('Form Job Template'),
152
- collection: proc { Hash[JobTemplate.unscoped.map { |template| [template.name, template.name] }] }
153
- setting 'remote_execution_job_invocation_report_template',
154
- type: :string,
155
- description: N_('Select a report template used for generating a report for a particular remote execution job'),
156
- default: 'Job - Invocation Report',
157
- full_name: N_('Job Invocation Report Template'),
158
- collection: proc { ForemanRemoteExecution.job_invocation_report_templates_select }
159
- setting 'remote_execution_time_to_pickup',
160
- type: :integer,
161
- description: N_('Time in seconds within which the host has to pick up a job. If the job is not picked up within this limit, the job will be cancelled. Defaults to 1 day. Applies only to pull-mqtt based jobs.'),
162
- default: 24 * 60 * 60,
163
- full_name: N_('Time to pickup')
39
+ initializer 'foreman_remote_execution.register_plugin', before: :finisher_hook do |app|
40
+ app.reloader.to_prepare do
41
+ Foreman::Plugin.register :foreman_remote_execution do
42
+ requires_foreman '>= 3.13'
43
+ register_global_js_file 'global'
44
+ register_gettext
45
+
46
+ apipie_documented_controllers ["#{ForemanRemoteExecution::Engine.root}/app/controllers/api/v2/*.rb"]
47
+ ApipieDSL.configuration.dsl_classes_matchers += [
48
+ "#{ForemanRemoteExecution::Engine.root}/app/lib/foreman_remote_execution/renderer/**/*.rb",
49
+ ]
50
+ automatic_assets(false)
51
+ precompile_assets(*assets_to_precompile)
52
+
53
+ # Add settings to a Remote Execution category
54
+ settings do
55
+ category :remote_execution, N_('Remote Execution') do
56
+ setting 'remote_execution_fallback_proxy',
57
+ type: :boolean,
58
+ description: 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'),
59
+ default: false,
60
+ full_name: N_('Fallback to Any Proxy')
61
+ setting 'remote_execution_global_proxy',
62
+ type: :boolean,
63
+ description: N_('Search for remote execution proxy outside of the proxies assigned to the host. The search will be limited to the host\'s organization and location.'),
64
+ default: true,
65
+ full_name: N_('Enable Global Proxy')
66
+ setting 'remote_execution_ssh_user',
67
+ type: :string,
68
+ description: N_('Default user to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_user.'),
69
+ default: 'root',
70
+ full_name: N_('SSH User')
71
+ setting 'remote_execution_effective_user',
72
+ type: :string,
73
+ description: 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.'),
74
+ default: 'root',
75
+ full_name: N_('Effective User')
76
+ setting 'remote_execution_effective_user_method',
77
+ type: :string,
78
+ description: N_('What command should be used to switch to the effective user. One of %s') % ::SSHExecutionProvider::EFFECTIVE_USER_METHODS.inspect,
79
+ default: 'sudo',
80
+ full_name: N_('Effective User Method'),
81
+ collection: proc { Hash[::SSHExecutionProvider::EFFECTIVE_USER_METHODS.map { |method| [method, method] }] }
82
+ setting 'remote_execution_effective_user_password',
83
+ type: :string,
84
+ description: N_('Effective user password'),
85
+ default: '',
86
+ full_name: N_('Effective user password'),
87
+ encrypted: true
88
+ setting 'remote_execution_sync_templates',
89
+ type: :boolean,
90
+ description: N_('Whether we should sync templates from disk when running db:seed.'),
91
+ default: true,
92
+ full_name: N_('Sync Job Templates')
93
+ setting 'remote_execution_ssh_port',
94
+ type: :integer,
95
+ description: N_('Port to use for SSH communication. Default port 22. You may override per host by setting a parameter called remote_execution_ssh_port.'),
96
+ default: 22,
97
+ full_name: N_('SSH Port')
98
+ setting 'remote_execution_connect_by_ip',
99
+ type: :boolean,
100
+ description: N_('Should the ip addresses on host interfaces be preferred over the fqdn? '\
101
+ '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. '\
102
+ 'For dual-stacked hosts you should consider the remote_execution_connect_by_ip_prefer_ipv6 setting'),
103
+ default: false,
104
+ full_name: N_('Connect by IP')
105
+ setting 'remote_execution_connect_by_ip_prefer_ipv6',
106
+ type: :boolean,
107
+ description: N_('When connecting using ip address, should the IPv6 addresses be preferred? '\
108
+ 'If no IPv6 address is set, it falls back to IPv4 automatically. You may override this per host by setting a parameter called remote_execution_connect_by_ip_prefer_ipv6. '\
109
+ 'By default and for compatibility, IPv4 will be preferred over IPv6 by default'),
110
+ default: false,
111
+ full_name: N_('Prefer IPv6 over IPv4')
112
+ setting 'remote_execution_ssh_password',
113
+ type: :string,
114
+ description: N_('Default password to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_password'),
115
+ default: nil,
116
+ full_name: N_('Default SSH password'),
117
+ encrypted: true
118
+ setting 'remote_execution_ssh_key_passphrase',
119
+ type: :string,
120
+ description: N_('Default key passphrase to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_key_passphrase'),
121
+ default: nil,
122
+ full_name: N_('Default SSH key passphrase'),
123
+ encrypted: true
124
+ setting 'remote_execution_workers_pool_size',
125
+ type: :integer,
126
+ description: 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.'),
127
+ default: 5,
128
+ full_name: N_('Workers pool size')
129
+ setting 'remote_execution_cleanup_working_dirs',
130
+ type: :boolean,
131
+ description: 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.'),
132
+ default: true,
133
+ full_name: N_('Cleanup working directories')
134
+ setting 'remote_execution_cockpit_url',
135
+ type: :string,
136
+ description: N_('Where to find the Cockpit instance for the Web Console button. By default, no button is shown.'),
137
+ default: nil,
138
+ full_name: N_('Cockpit URL')
139
+ setting 'remote_execution_form_job_template',
140
+ type: :string,
141
+ description: N_('Choose a job template that is pre-selected in job invocation form'),
142
+ default: 'Run Command - Script Default',
143
+ full_name: N_('Form Job Template'),
144
+ collection: proc { Hash[JobTemplate.unscoped.map { |template| [template.name, template.name] }] }
145
+ setting 'remote_execution_job_invocation_report_template',
146
+ type: :string,
147
+ description: N_('Select a report template used for generating a report for a particular remote execution job'),
148
+ default: 'Job - Invocation Report',
149
+ full_name: N_('Job Invocation Report Template'),
150
+ collection: proc { ForemanRemoteExecution.job_invocation_report_templates_select }
151
+ setting 'remote_execution_time_to_pickup',
152
+ type: :integer,
153
+ description: N_('Time in seconds within which the host has to pick up a job. If the job is not picked up within this limit, the job will be cancelled. Defaults to 1 day. Applies only to pull-mqtt based jobs.'),
154
+ default: 24 * 60 * 60,
155
+ full_name: N_('Time to pickup')
156
+ end
164
157
  end
165
- end
166
158
 
167
- # Add permissions
168
- security_block :foreman_remote_execution do
169
- permission :view_job_templates, { :job_templates => [:index, :show, :revision, :auto_complete_search, :auto_complete_job_category, :preview, :export],
170
- :'api/v2/job_templates' => [:index, :show, :revision, :export],
171
- :'api/v2/template_inputs' => [:index, :show],
172
- :'api/v2/foreign_input_sets' => [:index, :show],
173
- :ui_job_wizard => [:categories, :template, :resources, :job_invocation]}, :resource_type => 'JobTemplate'
174
- permission :create_job_templates, { :job_templates => [:new, :create, :clone_template, :import],
175
- :'api/v2/job_templates' => [:create, :clone, :import] }, :resource_type => 'JobTemplate'
176
- permission :edit_job_templates, { :job_templates => [:edit, :update],
177
- :'api/v2/job_templates' => [:update],
178
- :'api/v2/template_inputs' => [:create, :update, :destroy],
179
- :'api/v2/foreign_input_sets' => [:create, :update, :destroy]}, :resource_type => 'JobTemplate'
180
- permission :view_remote_execution_features, { :remote_execution_features => [:index, :show],
181
- :'api/v2/remote_execution_features' => [:index, :show, :available_remote_execution_features]},
182
- :resource_type => 'RemoteExecutionFeature'
183
- permission :edit_remote_execution_features, { :remote_execution_features => [:update],
184
- :'api/v2/remote_execution_features' => [:update ]}, :resource_type => 'RemoteExecutionFeature'
185
- permission :destroy_job_templates, { :job_templates => [:destroy],
186
- :'api/v2/job_templates' => [:destroy] }, :resource_type => 'JobTemplate'
187
- permission :lock_job_templates, { :job_templates => [:lock, :unlock] }, :resource_type => 'JobTemplate'
188
- permission :create_job_invocations, { :job_invocations => [:new, :create, :legacy_create, :refresh, :rerun, :preview_hosts],
189
- 'api/v2/job_invocations' => [:create, :rerun] }, :resource_type => 'JobInvocation'
190
- permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search, :preview_job_invocations_per_host], :template_invocations => [:show],
191
- 'api/v2/job_invocations' => [:index, :show, :output, :raw_output, :outputs] }, :resource_type => 'JobInvocation'
192
- permission :view_template_invocations, { :template_invocations => [:show],
193
- 'api/v2/template_invocations' => [:template_invocations], :ui_job_wizard => [:job_invocation] }, :resource_type => 'TemplateInvocation'
194
- permission :create_template_invocations, {}, :resource_type => 'TemplateInvocation'
195
- permission :execute_jobs_on_infrastructure_hosts, {}, :resource_type => 'JobInvocation'
196
- permission :cancel_job_invocations, { :job_invocations => [:cancel], 'api/v2/job_invocations' => [:cancel] }, :resource_type => 'JobInvocation'
197
- # this permissions grants user to get auto completion hints when setting up filters
198
- permission :filter_autocompletion_for_template_invocation, { :template_invocations => [ :auto_complete_search, :index ] },
199
- :resource_type => 'TemplateInvocation'
200
- permission :cockpit_hosts, { 'cockpit' => [:redirect, :host_ssh_params] }, :resource_type => 'Host'
201
- end
159
+ # Add permissions
160
+ security_block :foreman_remote_execution do
161
+ permission :view_job_templates, { :job_templates => [:index, :show, :revision, :auto_complete_search, :auto_complete_job_category, :preview, :export],
162
+ :'api/v2/job_templates' => [:index, :show, :revision, :export],
163
+ :'api/v2/template_inputs' => [:index, :show],
164
+ :'api/v2/foreign_input_sets' => [:index, :show],
165
+ :ui_job_wizard => [:categories, :template, :resources, :job_invocation]}, :resource_type => 'JobTemplate'
166
+ permission :create_job_templates, { :job_templates => [:new, :create, :clone_template, :import],
167
+ :'api/v2/job_templates' => [:create, :clone, :import] }, :resource_type => 'JobTemplate'
168
+ permission :edit_job_templates, { :job_templates => [:edit, :update],
169
+ :'api/v2/job_templates' => [:update],
170
+ :'api/v2/template_inputs' => [:create, :update, :destroy],
171
+ :'api/v2/foreign_input_sets' => [:create, :update, :destroy]}, :resource_type => 'JobTemplate'
172
+ permission :view_remote_execution_features, { :remote_execution_features => [:index, :show],
173
+ :'api/v2/remote_execution_features' => [:index, :show, :available_remote_execution_features]},
174
+ :resource_type => 'RemoteExecutionFeature'
175
+ permission :edit_remote_execution_features, { :remote_execution_features => [:update],
176
+ :'api/v2/remote_execution_features' => [:update ]}, :resource_type => 'RemoteExecutionFeature'
177
+ permission :destroy_job_templates, { :job_templates => [:destroy],
178
+ :'api/v2/job_templates' => [:destroy] }, :resource_type => 'JobTemplate'
179
+ permission :lock_job_templates, { :job_templates => [:lock, :unlock] }, :resource_type => 'JobTemplate'
180
+ permission :create_job_invocations, { :job_invocations => [:new, :create, :legacy_create, :refresh, :rerun, :preview_hosts],
181
+ 'api/v2/job_invocations' => [:create, :rerun] }, :resource_type => 'JobInvocation'
182
+ permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search, :preview_job_invocations_per_host], :template_invocations => [:show],
183
+ 'api/v2/job_invocations' => [:index, :show, :output, :raw_output, :outputs] }, :resource_type => 'JobInvocation'
184
+ permission :view_template_invocations, { :template_invocations => [:show],
185
+ 'api/v2/template_invocations' => [:template_invocations], :ui_job_wizard => [:job_invocation] }, :resource_type => 'TemplateInvocation'
186
+ permission :create_template_invocations, {}, :resource_type => 'TemplateInvocation'
187
+ permission :execute_jobs_on_infrastructure_hosts, {}, :resource_type => 'JobInvocation'
188
+ permission :cancel_job_invocations, { :job_invocations => [:cancel], 'api/v2/job_invocations' => [:cancel] }, :resource_type => 'JobInvocation'
189
+ # this permissions grants user to get auto completion hints when setting up filters
190
+ permission :filter_autocompletion_for_template_invocation, { :template_invocations => [ :auto_complete_search, :index ] },
191
+ :resource_type => 'TemplateInvocation'
192
+ permission :cockpit_hosts, { 'cockpit' => [:redirect, :host_ssh_params] }, :resource_type => 'Host'
193
+ end
202
194
 
203
- USER_PERMISSIONS = [
204
- :view_job_templates,
205
- :view_job_invocations,
206
- :create_job_invocations,
207
- :create_template_invocations,
208
- :view_hosts,
209
- :view_smart_proxies,
210
- :view_remote_execution_features,
211
- ].freeze
212
- MANAGER_PERMISSIONS = USER_PERMISSIONS + [
213
- :cancel_job_invocations,
214
- :destroy_job_templates,
215
- :edit_job_templates,
216
- :create_job_templates,
217
- :lock_job_templates,
218
- :view_audit_logs,
219
- :filter_autocompletion_for_template_invocation,
220
- :edit_remote_execution_features,
221
- ]
222
-
223
- # Add a new role called 'Remote Execution User ' if it doesn't exist
224
- role 'Remote Execution User', USER_PERMISSIONS, 'Role with permissions to run remote execution jobs against hosts'
225
- role 'Remote Execution Manager', MANAGER_PERMISSIONS, 'Role with permissions to manage job templates, remote execution features, cancel jobs and view audit logs'
226
-
227
- add_all_permissions_to_default_roles(except: [:execute_jobs_on_infrastructure_hosts])
228
- add_permissions_to_default_roles({
229
- Role::MANAGER => [:execute_jobs_on_infrastructure_hosts],
230
- Role::SITE_MANAGER => USER_PERMISSIONS + [:execute_jobs_on_infrastructure_hosts],
231
- })
232
-
233
- # add menu entry
234
- menu :top_menu, :job_templates,
235
- url_hash: { controller: :job_templates, action: :index },
236
- caption: N_('Job templates'),
237
- parent: :hosts_menu,
238
- after: :provisioning_templates
239
- menu :admin_menu, :remote_execution_features,
240
- url_hash: { controller: :remote_execution_features, action: :index },
241
- caption: N_('Remote Execution Features'),
242
- parent: :administer_menu,
243
- after: :bookmarks
244
-
245
- menu :top_menu, :job_invocations,
246
- url_hash: { controller: :job_invocations, action: :index },
247
- caption: N_('Jobs'),
248
- parent: :monitor_menu,
249
- after: :audits
250
-
251
- menu :labs_menu, :job_invocations_detail,
252
- url_hash: { controller: :job_invocations, action: :show },
253
- caption: N_('Job invocations detail'),
254
- parent: :lab_features_menu,
255
- url: '/experimental/job_invocations_detail/1'
256
-
257
- register_custom_status HostStatus::ExecutionStatus
258
- # add dashboard widget
259
- # widget 'foreman_remote_execution_widget', name: N_('Foreman plugin template widget'), sizex: 4, sizey: 1
260
- widget 'dashboard/latest-jobs', :name => N_('Latest Jobs'), :sizex => 6, :sizey => 1
261
-
262
- parameter_filter Subnet, :remote_execution_proxies, :remote_execution_proxy_ids => []
263
- parameter_filter Nic::Interface do |ctx|
264
- ctx.permit :execution
265
- end
195
+ USER_PERMISSIONS = [
196
+ :view_job_templates,
197
+ :view_job_invocations,
198
+ :create_job_invocations,
199
+ :create_template_invocations,
200
+ :view_hosts,
201
+ :view_smart_proxies,
202
+ :view_remote_execution_features,
203
+ ].freeze
204
+ MANAGER_PERMISSIONS = USER_PERMISSIONS + [
205
+ :cancel_job_invocations,
206
+ :destroy_job_templates,
207
+ :edit_job_templates,
208
+ :create_job_templates,
209
+ :lock_job_templates,
210
+ :view_audit_logs,
211
+ :filter_autocompletion_for_template_invocation,
212
+ :edit_remote_execution_features,
213
+ ]
214
+
215
+ # Add a new role called 'Remote Execution User ' if it doesn't exist
216
+ role 'Remote Execution User', USER_PERMISSIONS, 'Role with permissions to run remote execution jobs against hosts'
217
+ role 'Remote Execution Manager', MANAGER_PERMISSIONS, 'Role with permissions to manage job templates, remote execution features, cancel jobs and view audit logs'
218
+
219
+ add_all_permissions_to_default_roles(except: [:execute_jobs_on_infrastructure_hosts])
220
+ add_permissions_to_default_roles({
221
+ Role::MANAGER => [:execute_jobs_on_infrastructure_hosts],
222
+ Role::SITE_MANAGER => USER_PERMISSIONS + [:execute_jobs_on_infrastructure_hosts],
223
+ })
224
+
225
+ # add menu entry
226
+ menu :top_menu, :job_templates,
227
+ url_hash: { controller: :job_templates, action: :index },
228
+ caption: N_('Job templates'),
229
+ parent: :hosts_menu,
230
+ after: :provisioning_templates
231
+ menu :admin_menu, :remote_execution_features,
232
+ url_hash: { controller: :remote_execution_features, action: :index },
233
+ caption: N_('Remote Execution Features'),
234
+ parent: :administer_menu,
235
+ after: :bookmarks
236
+
237
+ menu :top_menu, :job_invocations,
238
+ url_hash: { controller: :job_invocations, action: :index },
239
+ caption: N_('Jobs'),
240
+ parent: :monitor_menu,
241
+ after: :audits
242
+
243
+ menu :labs_menu, :job_invocations_detail,
244
+ url_hash: { controller: :job_invocations, action: :show },
245
+ caption: N_('Job invocations detail'),
246
+ parent: :lab_features_menu,
247
+ url: '/experimental/job_invocations_detail/1'
248
+
249
+ register_custom_status HostStatus::ExecutionStatus
250
+ # add dashboard widget
251
+ # widget 'foreman_remote_execution_widget', name: N_('Foreman plugin template widget'), sizex: 4, sizey: 1
252
+ widget 'dashboard/latest-jobs', :name => N_('Latest Jobs'), :sizex => 6, :sizey => 1
253
+
254
+ parameter_filter Subnet, :remote_execution_proxies, :remote_execution_proxy_ids => []
255
+ parameter_filter Nic::Interface do |ctx|
256
+ ctx.permit :execution
257
+ end
266
258
 
267
- register_graphql_query_field :job_invocations, '::Types::JobInvocation', :collection_field
268
- register_graphql_query_field :job_invocation, '::Types::JobInvocation', :record_field
259
+ register_graphql_query_field :job_invocations, '::Types::JobInvocation', :collection_field
260
+ register_graphql_query_field :job_invocation, '::Types::JobInvocation', :record_field
269
261
 
270
- register_graphql_mutation_field :create_job_invocation, ::Mutations::JobInvocations::Create
262
+ register_graphql_mutation_field :create_job_invocation, ::Mutations::JobInvocations::Create
271
263
 
272
- extend_template_helpers ForemanRemoteExecution::RendererMethods
264
+ extend_template_helpers ForemanRemoteExecution::RendererMethods
273
265
 
274
- extend_rabl_template 'api/v2/smart_proxies/main', 'api/v2/smart_proxies/pubkey'
275
- extend_rabl_template 'api/v2/interfaces/main', 'api/v2/interfaces/execution_flag'
276
- extend_rabl_template 'api/v2/subnets/show', 'api/v2/subnets/remote_execution_proxies'
277
- extend_rabl_template 'api/v2/hosts/main', 'api/v2/host/main'
278
- parameter_filter ::Subnet, :remote_execution_proxy_ids
266
+ extend_rabl_template 'api/v2/smart_proxies/main', 'api/v2/smart_proxies/pubkey'
267
+ extend_rabl_template 'api/v2/interfaces/main', 'api/v2/interfaces/execution_flag'
268
+ extend_rabl_template 'api/v2/subnets/show', 'api/v2/subnets/remote_execution_proxies'
269
+ extend_rabl_template 'api/v2/hosts/main', 'api/v2/host/main'
270
+ parameter_filter ::Subnet, :remote_execution_proxy_ids
279
271
 
280
- describe_host do
281
- multiple_actions_provider :rex_hosts_multiple_actions
282
- overview_buttons_provider :rex_host_overview_buttons
283
- end
272
+ describe_host do
273
+ multiple_actions_provider :rex_hosts_multiple_actions
274
+ overview_buttons_provider :rex_host_overview_buttons
275
+ end
284
276
 
285
- # Extend Registration module
286
- extend_allowed_registration_vars :remote_execution_interface
287
- extend_allowed_registration_vars :setup_remote_execution_pull
288
- ForemanTasks.dynflow.eager_load_actions!
289
- extend_observable_events(
290
- ::Dynflow::Action.descendants.select do |klass|
291
- klass <= ::Actions::ObservableAction
292
- end.map(&:namespaced_event_names) +
293
- RemoteExecutionFeature.all.pluck(:label).flat_map do |label|
294
- [::Actions::RemoteExecution::RunHostJob, ::Actions::RemoteExecution::RunHostsJob].map do |klass|
295
- klass.feature_job_event_names(label)
277
+ # Extend Registration module
278
+ extend_allowed_registration_vars :remote_execution_interface
279
+ extend_allowed_registration_vars :setup_remote_execution_pull
280
+ ForemanTasks.dynflow.eager_load_actions!
281
+ extend_observable_events(
282
+ ::Dynflow::Action.descendants.select do |klass|
283
+ klass <= ::Actions::ObservableAction
284
+ end.map(&:namespaced_event_names) +
285
+ RemoteExecutionFeature.all.pluck(:label).flat_map do |label|
286
+ [::Actions::RemoteExecution::RunHostJob, ::Actions::RemoteExecution::RunHostsJob].map do |klass|
287
+ klass.feature_job_event_names(label)
288
+ end
296
289
  end
297
- end
298
- )
290
+ )
291
+ end
299
292
  end
300
293
  end
301
294
 
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '13.2.6'.freeze
2
+ VERSION = '14.0.0'.freeze
3
3
  end