foreman_remote_execution 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +1000 -973
  3. data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +553 -526
  4. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +584 -557
  5. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +1043 -1016
  6. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +1047 -1020
  7. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +1041 -1014
  8. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +1015 -988
  9. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +886 -859
  10. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +1047 -1020
  11. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +901 -874
  12. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +1041 -1014
  13. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +886 -859
  14. data/app/controllers/api/v2/job_invocations_controller.rb +1 -0
  15. data/app/models/job_invocation.rb +23 -0
  16. data/app/models/job_invocation_composer.rb +2 -0
  17. data/app/views/api/v2/job_invocations/base.json.rabl +3 -2
  18. data/app/views/templates/script/package_action.erb +5 -2
  19. data/lib/foreman_remote_execution/version.rb +1 -1
  20. data/locale/de/foreman_remote_execution.po +27 -0
  21. data/locale/en/foreman_remote_execution.po +27 -0
  22. data/locale/en_GB/foreman_remote_execution.po +27 -0
  23. data/locale/es/foreman_remote_execution.po +27 -0
  24. data/locale/foreman_remote_execution.pot +177 -141
  25. data/locale/fr/foreman_remote_execution.po +27 -0
  26. data/locale/ja/foreman_remote_execution.po +27 -0
  27. data/locale/ka/foreman_remote_execution.po +27 -0
  28. data/locale/ko/foreman_remote_execution.po +27 -0
  29. data/locale/pt_BR/foreman_remote_execution.po +27 -0
  30. data/locale/ru/foreman_remote_execution.po +27 -0
  31. data/locale/zh_CN/foreman_remote_execution.po +27 -0
  32. data/locale/zh_TW/foreman_remote_execution.po +27 -0
  33. data/package.json +2 -1
  34. data/webpack/JobInvocationDetail/JobInvocationActions.js +134 -3
  35. data/webpack/JobInvocationDetail/JobInvocationConstants.js +14 -0
  36. data/webpack/JobInvocationDetail/JobInvocationDetail.scss +5 -2
  37. data/webpack/JobInvocationDetail/JobInvocationSelectors.js +5 -0
  38. data/webpack/JobInvocationDetail/JobInvocationSystemStatusChart.js +13 -9
  39. data/webpack/JobInvocationDetail/JobInvocationToolbarButtons.js +268 -0
  40. data/webpack/JobInvocationDetail/__tests__/MainInformation.test.js +259 -0
  41. data/webpack/JobInvocationDetail/__tests__/fixtures.js +117 -0
  42. data/webpack/JobInvocationDetail/index.js +58 -38
  43. data/webpack/JobWizard/JobWizardPageRerun.js +16 -11
  44. data/webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js +8 -6
  45. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext/index.js +2 -0
  46. data/webpack/__mocks__/foremanReact/components/BreadcrumbBar/index.js +4 -0
  47. data/webpack/__mocks__/foremanReact/components/Head/index.js +10 -0
  48. data/webpack/__mocks__/foremanReact/components/HostDetails/DetailsCard/DefaultLoaderEmptyState.js +8 -0
  49. data/webpack/__mocks__/foremanReact/components/ToastsList/index.js +3 -0
  50. data/webpack/__mocks__/foremanReact/redux/API/APIActions.js +21 -0
  51. data/webpack/__mocks__/foremanReact/redux/API/APIConstants.js +7 -0
  52. data/webpack/__mocks__/foremanReact/redux/API/index.js +14 -0
  53. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware/index.js +9 -0
  54. metadata +12 -2
@@ -139,6 +139,7 @@ module Api
139
139
  api :POST, '/job_invocations/:id/rerun', N_('Rerun job on failed hosts')
140
140
  param :id, :identifier, :required => true
141
141
  param :failed_only, :bool
142
+ param :succeeded_only, :bool
142
143
  def rerun
143
144
  composer = JobInvocationComposer.from_job_invocation(@job_invocation, params)
144
145
  if composer.rerun_possible?
@@ -194,6 +194,10 @@ class JobInvocation < ApplicationRecord
194
194
  failed_hosts.pluck(:id)
195
195
  end
196
196
 
197
+ def succeeded_host_ids
198
+ succeeded_hosts.pluck(:id)
199
+ end
200
+
197
201
  def failed_hosts
198
202
  base = targeting.hosts
199
203
  if finished?
@@ -203,6 +207,15 @@ class JobInvocation < ApplicationRecord
203
207
  end
204
208
  end
205
209
 
210
+ def succeeded_hosts
211
+ base = targeting.hosts
212
+ if finished?
213
+ base.where.not(:id => not_succeeded_template_invocations.select(:host_id))
214
+ else
215
+ base.where(:id => succeeded_template_invocations.select(:host_id))
216
+ end
217
+ end
218
+
206
219
  def total_hosts_count
207
220
  count = _('N/A')
208
221
 
@@ -290,4 +303,14 @@ class JobInvocation < ApplicationRecord
290
303
  results = [:cancelled, :failed].map { |state| TemplateInvocation::TaskResultMap.status_to_task_result(state) }.flatten
291
304
  template_invocations.joins(:run_host_job_task).where.not(ForemanTasks::Task.table_name => { :result => results })
292
305
  end
306
+
307
+ def succeeded_template_invocations
308
+ result = TemplateInvocation::TaskResultMap.status_to_task_result(:success)
309
+ template_invocations.joins(:run_host_job_task).where(ForemanTasks::Task.table_name => { :result => result })
310
+ end
311
+
312
+ def not_succeeded_template_invocations
313
+ result = TemplateInvocation::TaskResultMap.status_to_task_result(:success)
314
+ template_invocations.joins(:run_host_job_task).where.not(ForemanTasks::Task.table_name => { :result => result })
315
+ end
293
316
  end
@@ -232,6 +232,8 @@ class JobInvocationComposer
232
232
  @host_ids = params[:host_ids]
233
233
  elsif params[:failed_only]
234
234
  @host_ids = job_invocation.failed_host_ids
235
+ elsif params[:succeeded_only]
236
+ @host_ids = job_invocation.succeeded_host_ids
235
237
  end
236
238
  end
237
239
 
@@ -25,9 +25,10 @@ end
25
25
  if params.key?(:include_permissions)
26
26
  node :permissions do |invocation|
27
27
  authorizer = Authorizer.new(User.current)
28
- edit_job_templates_permission = Permission.where(name: "edit_job_templates", resource_type: "JobTemplate").first
29
28
  {
30
- "edit_job_templates" => (edit_job_templates_permission && authorizer.can?("edit_job_templates", invocation, false)),
29
+ "edit_job_templates" => authorizer.can?("edit_job_templates", invocation, false),
30
+ "view_foreman_tasks" => authorizer.can?("view_foreman_tasks", invocation.task, false),
31
+ "edit_recurring_logics" => authorizer.can?("edit_recurring_logics", invocation.recurring_logic, false),
31
32
  }
32
33
  end
33
34
  end
@@ -66,6 +66,7 @@ exit_with_message () {
66
66
  <% if package_manager == 'zypper' -%>
67
67
  handle_zypp_res_codes () {
68
68
  RETVAL=$1
69
+ ACTION=$2
69
70
 
70
71
  # See https://github.com/openSUSE/zypper/blob/master/src/main.h
71
72
  declare -A ZYPP_RES_CODES
@@ -83,6 +84,8 @@ handle_zypp_res_codes () {
83
84
  fi
84
85
  if [[ $RETVAL -ge 100 && $RETVAL -le 103 ]]; then
85
86
  RETVAL=0
87
+ elif [ "$ACTION" = "remove" ] && [ "$RETVAL" -eq 104 ]; then
88
+ RETVAL=0
86
89
  fi
87
90
 
88
91
  return $RETVAL
@@ -122,7 +125,7 @@ handle_zypp_res_codes () {
122
125
  apt-get -y update
123
126
  LANG=C apt-get -o APT::Get::Upgrade-Allow-New="true" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y <%= input("options") %> <%= action %> <%= input("package") %> 2>&1 | tee $OUTFILE
124
127
  RETVAL=$?
125
- if grep -q "Unable to locate" $OUTFILE; then
128
+ if grep -q "Unable to locate" $OUTFILE && [ "$action" = "remove" ]; then
126
129
  true
127
130
  else
128
131
  setReturnValue() { RETVAL=$1; return $RETVAL; }
@@ -138,7 +141,7 @@ handle_zypp_res_codes () {
138
141
  -%>
139
142
  zypper refresh
140
143
  zypper -n <%= action %> <%= input("options") %> <%= input("package") %>
141
- handle_zypp_res_codes $?
144
+ handle_zypp_res_codes $? $action
142
145
  <% end -%>
143
146
  RETVAL=$?
144
147
  [ $RETVAL -eq 0 ] || exit_with_message "Package action failed" $RETVAL
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '13.1.0'.freeze
2
+ VERSION = '13.2.0'.freeze
3
3
  end
@@ -22,6 +22,9 @@ msgstr ""
22
22
  "Language: de\n"
23
23
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
24
24
 
25
+ msgid "${d.title} ${d.count} hosts"
26
+ msgstr ""
27
+
25
28
  msgid "%s"
26
29
  msgstr "%s"
27
30
 
@@ -156,6 +159,9 @@ msgstr "Job abbrechen"
156
159
  msgid "Cancel job invocation"
157
160
  msgstr "Job-Aufruf abbrechen"
158
161
 
162
+ msgid "Canceled:"
163
+ msgstr ""
164
+
159
165
  msgid "Cancelled"
160
166
  msgstr "Abgebrochen"
161
167
 
@@ -441,6 +447,9 @@ msgstr ""
441
447
  msgid "Failed rendering template: %s"
442
448
  msgstr "Rendern der Vorlage fehlgeschlagen: %s"
443
449
 
450
+ msgid "Failed:"
451
+ msgstr ""
452
+
444
453
  msgid "Fallback to Any Proxy"
445
454
  msgstr "Fallback auf einen beliebigen Proxy"
446
455
 
@@ -543,6 +552,9 @@ msgstr "Import"
543
552
  msgid "Import a job template from ERB"
544
553
  msgstr "Job-Vorlage aus ERB importieren"
545
554
 
555
+ msgid "In Progress:"
556
+ msgstr ""
557
+
546
558
  msgid "Include all inputs from the foreign template"
547
559
  msgstr "Alle Eingaben aus Fremdvorlage einschließen"
548
560
 
@@ -1040,12 +1052,18 @@ msgstr ""
1040
1052
  msgid "Scheduled"
1041
1053
  msgstr "Geplant"
1042
1054
 
1055
+ msgid "Scheduled at:"
1056
+ msgstr ""
1057
+
1043
1058
  msgid "Scheduled to start at"
1044
1059
  msgstr "Geplanter Start um"
1045
1060
 
1046
1061
  msgid "Scheduled to start before"
1047
1062
  msgstr "Geplanter Start vor"
1048
1063
 
1064
+ msgid "Scheduled: ${totalHosts} hosts"
1065
+ msgstr ""
1066
+
1049
1067
  msgid "Script"
1050
1068
  msgstr "Skript"
1051
1069
 
@@ -1190,6 +1208,9 @@ msgstr ""
1190
1208
  msgid "Succeeded"
1191
1209
  msgstr "Erfolgreich"
1192
1210
 
1211
+ msgid "Succeeded:"
1212
+ msgstr ""
1213
+
1193
1214
  msgid "Success"
1194
1215
  msgstr "Erfolg"
1195
1216
 
@@ -1199,6 +1220,12 @@ msgstr ""
1199
1220
  msgid "Sync Job Templates"
1200
1221
  msgstr "Synchronisations Job-Vorlage"
1201
1222
 
1223
+ msgid "System status"
1224
+ msgstr ""
1225
+
1226
+ msgid "Systems"
1227
+ msgstr ""
1228
+
1202
1229
  msgid "Target hosts"
1203
1230
  msgstr "Zielhosts"
1204
1231
 
@@ -17,6 +17,9 @@ msgstr ""
17
17
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
18
  "\n"
19
19
 
20
+ msgid "${d.title} ${d.count} hosts"
21
+ msgstr ""
22
+
20
23
  msgid "%s"
21
24
  msgstr ""
22
25
 
@@ -151,6 +154,9 @@ msgstr ""
151
154
  msgid "Cancel job invocation"
152
155
  msgstr ""
153
156
 
157
+ msgid "Canceled:"
158
+ msgstr ""
159
+
154
160
  msgid "Cancelled"
155
161
  msgstr ""
156
162
 
@@ -436,6 +442,9 @@ msgstr ""
436
442
  msgid "Failed rendering template: %s"
437
443
  msgstr ""
438
444
 
445
+ msgid "Failed:"
446
+ msgstr ""
447
+
439
448
  msgid "Fallback to Any Proxy"
440
449
  msgstr ""
441
450
 
@@ -538,6 +547,9 @@ msgstr ""
538
547
  msgid "Import a job template from ERB"
539
548
  msgstr ""
540
549
 
550
+ msgid "In Progress:"
551
+ msgstr ""
552
+
541
553
  msgid "Include all inputs from the foreign template"
542
554
  msgstr ""
543
555
 
@@ -1033,12 +1045,18 @@ msgstr ""
1033
1045
  msgid "Scheduled"
1034
1046
  msgstr ""
1035
1047
 
1048
+ msgid "Scheduled at:"
1049
+ msgstr ""
1050
+
1036
1051
  msgid "Scheduled to start at"
1037
1052
  msgstr ""
1038
1053
 
1039
1054
  msgid "Scheduled to start before"
1040
1055
  msgstr ""
1041
1056
 
1057
+ msgid "Scheduled: ${totalHosts} hosts"
1058
+ msgstr ""
1059
+
1042
1060
  msgid "Script"
1043
1061
  msgstr ""
1044
1062
 
@@ -1183,6 +1201,9 @@ msgstr ""
1183
1201
  msgid "Succeeded"
1184
1202
  msgstr ""
1185
1203
 
1204
+ msgid "Succeeded:"
1205
+ msgstr ""
1206
+
1186
1207
  msgid "Success"
1187
1208
  msgstr ""
1188
1209
 
@@ -1192,6 +1213,12 @@ msgstr ""
1192
1213
  msgid "Sync Job Templates"
1193
1214
  msgstr ""
1194
1215
 
1216
+ msgid "System status"
1217
+ msgstr ""
1218
+
1219
+ msgid "Systems"
1220
+ msgstr ""
1221
+
1195
1222
  msgid "Target hosts"
1196
1223
  msgstr ""
1197
1224
 
@@ -18,6 +18,9 @@ msgstr ""
18
18
  "Language: en_GB\n"
19
19
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
20
 
21
+ msgid "${d.title} ${d.count} hosts"
22
+ msgstr ""
23
+
21
24
  msgid "%s"
22
25
  msgstr ""
23
26
 
@@ -152,6 +155,9 @@ msgstr ""
152
155
  msgid "Cancel job invocation"
153
156
  msgstr ""
154
157
 
158
+ msgid "Canceled:"
159
+ msgstr ""
160
+
155
161
  msgid "Cancelled"
156
162
  msgstr ""
157
163
 
@@ -437,6 +443,9 @@ msgstr ""
437
443
  msgid "Failed rendering template: %s"
438
444
  msgstr ""
439
445
 
446
+ msgid "Failed:"
447
+ msgstr ""
448
+
440
449
  msgid "Fallback to Any Proxy"
441
450
  msgstr ""
442
451
 
@@ -539,6 +548,9 @@ msgstr ""
539
548
  msgid "Import a job template from ERB"
540
549
  msgstr ""
541
550
 
551
+ msgid "In Progress:"
552
+ msgstr ""
553
+
542
554
  msgid "Include all inputs from the foreign template"
543
555
  msgstr ""
544
556
 
@@ -1034,12 +1046,18 @@ msgstr ""
1034
1046
  msgid "Scheduled"
1035
1047
  msgstr ""
1036
1048
 
1049
+ msgid "Scheduled at:"
1050
+ msgstr ""
1051
+
1037
1052
  msgid "Scheduled to start at"
1038
1053
  msgstr ""
1039
1054
 
1040
1055
  msgid "Scheduled to start before"
1041
1056
  msgstr ""
1042
1057
 
1058
+ msgid "Scheduled: ${totalHosts} hosts"
1059
+ msgstr ""
1060
+
1043
1061
  msgid "Script"
1044
1062
  msgstr ""
1045
1063
 
@@ -1184,6 +1202,9 @@ msgstr ""
1184
1202
  msgid "Succeeded"
1185
1203
  msgstr ""
1186
1204
 
1205
+ msgid "Succeeded:"
1206
+ msgstr ""
1207
+
1187
1208
  msgid "Success"
1188
1209
  msgstr "Success"
1189
1210
 
@@ -1193,6 +1214,12 @@ msgstr ""
1193
1214
  msgid "Sync Job Templates"
1194
1215
  msgstr ""
1195
1216
 
1217
+ msgid "System status"
1218
+ msgstr ""
1219
+
1220
+ msgid "Systems"
1221
+ msgstr ""
1222
+
1196
1223
  msgid "Target hosts"
1197
1224
  msgstr ""
1198
1225
 
@@ -18,6 +18,9 @@ msgstr ""
18
18
  "Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 :"
19
19
  " 2;\n"
20
20
 
21
+ msgid "${d.title} ${d.count} hosts"
22
+ msgstr ""
23
+
21
24
  msgid "%s"
22
25
  msgstr "%s"
23
26
 
@@ -152,6 +155,9 @@ msgstr "Cancelar tarea"
152
155
  msgid "Cancel job invocation"
153
156
  msgstr "Cancelar invocación de trabajo"
154
157
 
158
+ msgid "Canceled:"
159
+ msgstr ""
160
+
155
161
  msgid "Cancelled"
156
162
  msgstr "Cancelado"
157
163
 
@@ -437,6 +443,9 @@ msgstr "Anfitriones fallidos"
437
443
  msgid "Failed rendering template: %s"
438
444
  msgstr "Falló la reproducción de la plantilla: %s."
439
445
 
446
+ msgid "Failed:"
447
+ msgstr ""
448
+
440
449
  msgid "Fallback to Any Proxy"
441
450
  msgstr "Acción de reserva en cualquier proxy"
442
451
 
@@ -539,6 +548,9 @@ msgstr "Importar"
539
548
  msgid "Import a job template from ERB"
540
549
  msgstr "Importar una plantilla de trabajo desde ERB"
541
550
 
551
+ msgid "In Progress:"
552
+ msgstr ""
553
+
542
554
  msgid "Include all inputs from the foreign template"
543
555
  msgstr "Incluir todas las entradas de la plantilla externa"
544
556
 
@@ -1034,12 +1046,18 @@ msgstr "Tipo de horario"
1034
1046
  msgid "Scheduled"
1035
1047
  msgstr "Programado"
1036
1048
 
1049
+ msgid "Scheduled at:"
1050
+ msgstr ""
1051
+
1037
1052
  msgid "Scheduled to start at"
1038
1053
  msgstr "Programado para comenzar a las"
1039
1054
 
1040
1055
  msgid "Scheduled to start before"
1041
1056
  msgstr "Programado para iniciar antes"
1042
1057
 
1058
+ msgid "Scheduled: ${totalHosts} hosts"
1059
+ msgstr ""
1060
+
1043
1061
  msgid "Script"
1044
1062
  msgstr "Guión"
1045
1063
 
@@ -1184,6 +1202,9 @@ msgstr "Suscríbase a mis trabajos con éxito"
1184
1202
  msgid "Succeeded"
1185
1203
  msgstr "exitoso"
1186
1204
 
1205
+ msgid "Succeeded:"
1206
+ msgstr ""
1207
+
1187
1208
  msgid "Success"
1188
1209
  msgstr "Éxito"
1189
1210
 
@@ -1193,6 +1214,12 @@ msgstr ""
1193
1214
  msgid "Sync Job Templates"
1194
1215
  msgstr "Sincronizar plantillas de trabajo"
1195
1216
 
1217
+ msgid "System status"
1218
+ msgstr ""
1219
+
1220
+ msgid "Systems"
1221
+ msgstr ""
1222
+
1196
1223
  msgid "Target hosts"
1197
1224
  msgstr "Hosts de destino"
1198
1225