foreman_remote_execution 11.1.3 → 12.0.0

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.rubocop_todo.yml +0 -8
  4. data/.tx/config +2 -2
  5. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +27 -21
  6. data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +24 -15
  7. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +27 -9
  8. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +27 -24
  9. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +27 -24
  10. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +27 -24
  11. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +1587 -0
  12. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +27 -15
  13. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +27 -24
  14. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +27 -15
  15. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +27 -24
  16. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +27 -15
  17. data/app/controllers/ui_job_wizard_controller.rb +1 -4
  18. data/app/helpers/remote_execution_helper.rb +10 -4
  19. data/app/lib/actions/remote_execution/event_helpers.rb +42 -0
  20. data/app/lib/actions/remote_execution/run_host_job.rb +3 -16
  21. data/app/lib/actions/remote_execution/run_hosts_job.rb +7 -5
  22. data/app/models/concerns/api/v2/hosts_controller_extensions.rb +12 -0
  23. data/app/models/job_invocation_composer.rb +0 -1
  24. data/app/views/api/v2/job_invocations/base.json.rabl +14 -0
  25. data/app/views/templates/script/convert2rhel_analyze.erb +0 -3
  26. data/config/routes.rb +2 -0
  27. data/db/migrate/20151215114631_add_host_id_to_template_invocation.rb +1 -1
  28. data/db/migrate/20151217092555_migrate_to_task_groups.rb +1 -1
  29. data/db/migrate/20160113162007_expand_all_template_invocations.rb +2 -2
  30. data/db/migrate/20160114125628_rename_job_name_to_job_category.rb +2 -2
  31. data/db/migrate/20200623073022_rename_sudo_password_to_effective_user_password.rb +2 -2
  32. data/db/migrate/20220321101835_rename_ssh_provider_to_script.rb +1 -1
  33. data/extra/cockpit/foreman-cockpit-session +1 -1
  34. data/foreman_remote_execution.gemspec +3 -1
  35. data/lib/foreman_remote_execution/engine.rb +14 -9
  36. data/lib/foreman_remote_execution/version.rb +1 -1
  37. data/locale/Makefile +3 -4
  38. data/locale/action_names.rb +0 -5
  39. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/de/foreman_remote_execution.po +24 -15
  41. data/locale/en/foreman_remote_execution.po +24 -15
  42. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  43. data/locale/en_GB/foreman_remote_execution.po +24 -15
  44. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  45. data/locale/es/foreman_remote_execution.po +24 -15
  46. data/locale/foreman_remote_execution.pot +82 -69
  47. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  48. data/locale/fr/foreman_remote_execution.po +24 -15
  49. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  50. data/locale/ja/foreman_remote_execution.po +24 -15
  51. data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  52. data/locale/ka/foreman_remote_execution.po +1576 -0
  53. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  54. data/locale/ko/foreman_remote_execution.po +24 -15
  55. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  56. data/locale/pt_BR/foreman_remote_execution.po +24 -15
  57. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  58. data/locale/ru/foreman_remote_execution.po +24 -15
  59. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  60. data/locale/zh_CN/foreman_remote_execution.po +24 -15
  61. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  62. data/locale/zh_TW/foreman_remote_execution.po +24 -15
  63. data/test/unit/actions/run_hosts_job_test.rb +1 -1
  64. data/test/unit/api_params_test.rb +2 -10
  65. data/webpack/JobInvocationDetail/JobInvocationActions.js +22 -0
  66. data/webpack/JobInvocationDetail/JobInvocationConstants.js +7 -0
  67. data/webpack/JobInvocationDetail/JobInvocationOverview.js +104 -0
  68. data/webpack/JobInvocationDetail/JobInvocationSelectors.js +5 -0
  69. data/webpack/JobInvocationDetail/index.js +77 -0
  70. data/webpack/JobWizard/JobWizardPageRerun.js +10 -25
  71. data/webpack/JobWizard/index.js +9 -18
  72. data/webpack/Routes/routes.js +6 -0
  73. data/webpack/react_app/components/FeaturesDropdown/actions.js +4 -2
  74. data/webpack/react_app/components/FeaturesDropdown/constants.js +5 -0
  75. data/webpack/react_app/components/FeaturesDropdown/index.js +53 -14
  76. data/webpack/react_app/components/FeaturesDropdown/index.scss +11 -0
  77. data/webpack/react_app/extend/Fills.js +6 -0
  78. metadata +24 -10
  79. data/webpack/react_app/components/FeaturesDropdown/constant.js +0 -3
  80. /data/test/graphql/mutations/job_invocations/{create.rb → create_test.rb} +0 -0
  81. /data/test/unit/{renderer_scope_input.rb → renderer_scope_input_test.rb} +0 -0
@@ -383,6 +383,12 @@
383
383
  "Try to abort the job without waiting for the results from the remote hosts": [
384
384
  ""
385
385
  ],
386
+ "New UI": [
387
+ ""
388
+ ],
389
+ "Switch to the new job invocation detail UI": [
390
+ ""
391
+ ],
386
392
  "Task Details": [
387
393
  "작업 자세히"
388
394
  ],
@@ -1095,6 +1101,9 @@
1095
1101
  "Job templates": [
1096
1102
  "작업 템플릿"
1097
1103
  ],
1104
+ "Job invocations detail": [
1105
+ ""
1106
+ ],
1098
1107
  "Run Puppet Once": [
1099
1108
  ""
1100
1109
  ],
@@ -1107,6 +1116,21 @@
1107
1116
  "Run a script": [
1108
1117
  ""
1109
1118
  ],
1119
+ "Not yet": [
1120
+ ""
1121
+ ],
1122
+ "Effective user:": [
1123
+ ""
1124
+ ],
1125
+ "Started at:": [
1126
+ ""
1127
+ ],
1128
+ "SSH user:": [
1129
+ ""
1130
+ ],
1131
+ "Template:": [
1132
+ ""
1133
+ ],
1110
1134
  "Submit": [
1111
1135
  ""
1112
1136
  ],
@@ -1545,29 +1569,17 @@
1545
1569
  "Active Filters:": [
1546
1570
  ""
1547
1571
  ],
1572
+ "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1573
+ "Foreman으로 원격 실행을 가져오는 플러그인입니다. 원격 관리 기능으로 구성 관리 기능을 완료합니다."
1574
+ ],
1548
1575
  "Action with sub plans": [
1549
1576
  "하위 계획이 있는 작업"
1550
1577
  ],
1551
- "Check for long running tasks": [
1552
- ""
1553
- ],
1554
- "Deliver notifications about long running tasks": [
1555
- ""
1556
- ],
1557
1578
  "Import Puppet classes": [
1558
1579
  "Puppet 클래스 가져오기"
1559
1580
  ],
1560
1581
  "Import facts": [
1561
1582
  "팩트 불러오기"
1562
- ],
1563
- "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1564
- "Foreman으로 원격 실행을 가져오는 플러그인입니다. 원격 관리 기능으로 구성 관리 기능을 완료합니다."
1565
- ],
1566
- "Distribute tasks over N seconds": [
1567
- "N초에 걸쳐 태스크 배분"
1568
- ],
1569
- "Time span": [
1570
- "기간"
1571
1583
  ]
1572
1584
  }
1573
1585
  }
@@ -383,6 +383,12 @@
383
383
  "Try to abort the job without waiting for the results from the remote hosts": [
384
384
  "Tente anular o trabalho sem esperar os resultados dos hosts remotos"
385
385
  ],
386
+ "New UI": [
387
+ ""
388
+ ],
389
+ "Switch to the new job invocation detail UI": [
390
+ ""
391
+ ],
386
392
  "Task Details": [
387
393
  "Detalhes da tarefa"
388
394
  ],
@@ -1097,6 +1103,9 @@
1097
1103
  "Job templates": [
1098
1104
  "Modelos de trabalho"
1099
1105
  ],
1106
+ "Job invocations detail": [
1107
+ ""
1108
+ ],
1100
1109
  "Run Puppet Once": [
1101
1110
  "Executar Puppet"
1102
1111
  ],
@@ -1109,6 +1118,21 @@
1109
1118
  "Run a script": [
1110
1119
  ""
1111
1120
  ],
1121
+ "Not yet": [
1122
+ ""
1123
+ ],
1124
+ "Effective user:": [
1125
+ ""
1126
+ ],
1127
+ "Started at:": [
1128
+ ""
1129
+ ],
1130
+ "SSH user:": [
1131
+ ""
1132
+ ],
1133
+ "Template:": [
1134
+ ""
1135
+ ],
1112
1136
  "Submit": [
1113
1137
  ""
1114
1138
  ],
@@ -1547,38 +1571,17 @@
1547
1571
  "Active Filters:": [
1548
1572
  ""
1549
1573
  ],
1574
+ "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1575
+ "Um plugin trazendo execução remota ao Foreman, completando a funcionalidade de gerenciamento de configuração com a funcionalidade de gerenciamento remoto. "
1576
+ ],
1550
1577
  "Action with sub plans": [
1551
1578
  "Ação com subplanos "
1552
1579
  ],
1553
- "Check for long running tasks": [
1554
- ""
1555
- ],
1556
- "Deliver notifications about long running tasks": [
1557
- ""
1558
- ],
1559
1580
  "Import Puppet classes": [
1560
1581
  "Importar classes de Puppet"
1561
1582
  ],
1562
1583
  "Import facts": [
1563
1584
  "Importar fatos"
1564
- ],
1565
- "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1566
- "Um plugin trazendo execução remota ao Foreman, completando a funcionalidade de gerenciamento de configuração com a funcionalidade de gerenciamento remoto. "
1567
- ],
1568
- "Cron line format 'a b c d e', where:": [
1569
- "Cron line format 'a b c d e', onde:"
1570
- ],
1571
- "#~ \"Distribute execution over N seconds. If this is set and proxy batch triggering\"#~ \" is enabled, then tasks are triggered on the smart proxy in batches of size 1.\"": [
1572
- "#~ \"Distribuir a execução ao longo de N segundos. Se essa opção estiver definida, \"#~ \"e o acionamento em lote de proxy estiver desabilitado, então, as tarefas serão\"#~ \" acionadas no proxy inteligente em lotes de tamanho 1.\""
1573
- ],
1574
- "Distribute tasks over N seconds": [
1575
- "Distribuir tarefas em N segundos "
1576
- ],
1577
- "Set to distribute over": [
1578
- "Definir para distribuir em"
1579
- ],
1580
- "Time span": [
1581
- "Período de tempo"
1582
1585
  ]
1583
1586
  }
1584
1587
  }
@@ -383,6 +383,12 @@
383
383
  "Try to abort the job without waiting for the results from the remote hosts": [
384
384
  ""
385
385
  ],
386
+ "New UI": [
387
+ ""
388
+ ],
389
+ "Switch to the new job invocation detail UI": [
390
+ ""
391
+ ],
386
392
  "Task Details": [
387
393
  "Описание задачи"
388
394
  ],
@@ -1098,6 +1104,9 @@
1098
1104
  "Job templates": [
1099
1105
  "Шаблоны заданий"
1100
1106
  ],
1107
+ "Job invocations detail": [
1108
+ ""
1109
+ ],
1101
1110
  "Run Puppet Once": [
1102
1111
  ""
1103
1112
  ],
@@ -1110,6 +1119,21 @@
1110
1119
  "Run a script": [
1111
1120
  ""
1112
1121
  ],
1122
+ "Not yet": [
1123
+ ""
1124
+ ],
1125
+ "Effective user:": [
1126
+ ""
1127
+ ],
1128
+ "Started at:": [
1129
+ ""
1130
+ ],
1131
+ "SSH user:": [
1132
+ ""
1133
+ ],
1134
+ "Template:": [
1135
+ ""
1136
+ ],
1113
1137
  "Submit": [
1114
1138
  ""
1115
1139
  ],
@@ -1548,29 +1572,17 @@
1548
1572
  "Active Filters:": [
1549
1573
  ""
1550
1574
  ],
1575
+ "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1576
+ "Дополнительный модуль Foreman для удаленного выполнения заданий, объединяющий функции управления конфигурацией и удаленного контроля."
1577
+ ],
1551
1578
  "Action with sub plans": [
1552
1579
  "Действия с подпланами"
1553
1580
  ],
1554
- "Check for long running tasks": [
1555
- ""
1556
- ],
1557
- "Deliver notifications about long running tasks": [
1558
- ""
1559
- ],
1560
1581
  "Import Puppet classes": [
1561
1582
  "Импорт классов Puppet"
1562
1583
  ],
1563
1584
  "Import facts": [
1564
1585
  "Импорт фактов"
1565
- ],
1566
- "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1567
- "Дополнительный модуль Foreman для удаленного выполнения заданий, объединяющий функции управления конфигурацией и удаленного контроля."
1568
- ],
1569
- "Distribute tasks over N seconds": [
1570
- "Распределить задачи в пределах заданного периода времени (в секундах)"
1571
- ],
1572
- "Time span": [
1573
- "Интервал"
1574
1586
  ]
1575
1587
  }
1576
1588
  }
@@ -383,6 +383,12 @@
383
383
  "Try to abort the job without waiting for the results from the remote hosts": [
384
384
  "尝试在不等待远程主机的结果情况下终止作业"
385
385
  ],
386
+ "New UI": [
387
+ ""
388
+ ],
389
+ "Switch to the new job invocation detail UI": [
390
+ ""
391
+ ],
386
392
  "Task Details": [
387
393
  "任务详情"
388
394
  ],
@@ -1094,6 +1100,9 @@
1094
1100
  "Job templates": [
1095
1101
  "作业模板"
1096
1102
  ],
1103
+ "Job invocations detail": [
1104
+ ""
1105
+ ],
1097
1106
  "Run Puppet Once": [
1098
1107
  "运行 Puppet 一次"
1099
1108
  ],
@@ -1106,6 +1115,21 @@
1106
1115
  "Run a script": [
1107
1116
  ""
1108
1117
  ],
1118
+ "Not yet": [
1119
+ ""
1120
+ ],
1121
+ "Effective user:": [
1122
+ ""
1123
+ ],
1124
+ "Started at:": [
1125
+ ""
1126
+ ],
1127
+ "SSH user:": [
1128
+ ""
1129
+ ],
1130
+ "Template:": [
1131
+ ""
1132
+ ],
1109
1133
  "Submit": [
1110
1134
  ""
1111
1135
  ],
@@ -1544,38 +1568,17 @@
1544
1568
  "Active Filters:": [
1545
1569
  ""
1546
1570
  ],
1571
+ "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1572
+ "一个将远程执行带到 Foreman 的插件,通过远程管理功能来完成配置管理功能。"
1573
+ ],
1547
1574
  "Action with sub plans": [
1548
1575
  "有子计划的操作"
1549
1576
  ],
1550
- "Check for long running tasks": [
1551
- ""
1552
- ],
1553
- "Deliver notifications about long running tasks": [
1554
- ""
1555
- ],
1556
1577
  "Import Puppet classes": [
1557
1578
  "导入 Puppet 类"
1558
1579
  ],
1559
1580
  "Import facts": [
1560
1581
  "导入事实"
1561
- ],
1562
- "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1563
- "一个将远程执行带到 Foreman 的插件,通过远程管理功能来完成配置管理功能。"
1564
- ],
1565
- "Cron line format 'a b c d e', where:": [
1566
- "Cron 行格式 'a b c d e', 其中:"
1567
- ],
1568
- "#~ \"Distribute execution over N seconds. If this is set and proxy batch triggering\"#~ \" is enabled, then tasks are triggered on the smart proxy in batches of size 1.\"": [
1569
- "在 N 秒内分配执行。如果设置了此选项并启用了代理批处理触发,则将在智能代理上以大小为 1 的批处理触发任务。"
1570
- ],
1571
- "Distribute tasks over N seconds": [
1572
- "在 N 秒内分配任务"
1573
- ],
1574
- "Set to distribute over": [
1575
- "设置为通过...分配"
1576
- ],
1577
- "Time span": [
1578
- "时间跨度"
1579
1582
  ]
1580
1583
  }
1581
1584
  }
@@ -383,6 +383,12 @@
383
383
  "Try to abort the job without waiting for the results from the remote hosts": [
384
384
  ""
385
385
  ],
386
+ "New UI": [
387
+ ""
388
+ ],
389
+ "Switch to the new job invocation detail UI": [
390
+ ""
391
+ ],
386
392
  "Task Details": [
387
393
  "工作詳細資料"
388
394
  ],
@@ -1096,6 +1102,9 @@
1096
1102
  "Job templates": [
1097
1103
  "工作範本"
1098
1104
  ],
1105
+ "Job invocations detail": [
1106
+ ""
1107
+ ],
1099
1108
  "Run Puppet Once": [
1100
1109
  ""
1101
1110
  ],
@@ -1108,6 +1117,21 @@
1108
1117
  "Run a script": [
1109
1118
  ""
1110
1119
  ],
1120
+ "Not yet": [
1121
+ ""
1122
+ ],
1123
+ "Effective user:": [
1124
+ ""
1125
+ ],
1126
+ "Started at:": [
1127
+ ""
1128
+ ],
1129
+ "SSH user:": [
1130
+ ""
1131
+ ],
1132
+ "Template:": [
1133
+ ""
1134
+ ],
1111
1135
  "Submit": [
1112
1136
  ""
1113
1137
  ],
@@ -1546,29 +1570,17 @@
1546
1570
  "Active Filters:": [
1547
1571
  ""
1548
1572
  ],
1573
+ "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1574
+ "將遠端執行帶入 Foreman 的外掛程式,搭配遠端管理功能來完成配置管理。"
1575
+ ],
1549
1576
  "Action with sub plans": [
1550
1577
  "有子計畫的動作"
1551
1578
  ],
1552
- "Check for long running tasks": [
1553
- ""
1554
- ],
1555
- "Deliver notifications about long running tasks": [
1556
- ""
1557
- ],
1558
1579
  "Import Puppet classes": [
1559
1580
  "匯入 Puppet 類別"
1560
1581
  ],
1561
1582
  "Import facts": [
1562
1583
  "匯入詳情"
1563
- ],
1564
- "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality.": [
1565
- "將遠端執行帶入 Foreman 的外掛程式,搭配遠端管理功能來完成配置管理。"
1566
- ],
1567
- "Distribute tasks over N seconds": [
1568
- "在幾秒間散佈工作"
1569
- ],
1570
- "Time span": [
1571
- "時間跨度"
1572
1584
  ]
1573
1585
  }
1574
1586
  }
@@ -64,10 +64,7 @@ class UiJobWizardController < ApplicationController
64
64
  job = JobInvocation.authorized.find(params[:id])
65
65
  composer = JobInvocationComposer.from_job_invocation(job, params).params
66
66
  job_template_inputs = JobTemplate.authorized.find(composer[:template_invocations][0][:template_id]).template_inputs_with_foreign
67
- job_template_inputs_hash = Hash[job_template_inputs.map { |input| ["inputs[#{input[:name]}]", {:advanced => input[:advanced], :value => (composer[:template_invocations][0][:input_values].find { |value| value[:template_input_id] == input[:id] }).try(:[], :value)}] }]
68
- provider_inputs = composer[:template_invocations][0][:provider_input_values]
69
- provider_inputs_hash = Hash[provider_inputs.map { |input| ["inputs[#{input[:name]}]", {:advanced => true, :value => input[:value]}] }]
70
- inputs = job_template_inputs_hash.merge(provider_inputs_hash)
67
+ inputs = Hash[job_template_inputs.map { |input| ["inputs[#{input[:name]}]", {:advanced => input[:advanced], :value => (composer[:template_invocations][0][:input_values].find { |value| value[:template_input_id] == input[:id] }).try(:[], :value)}] }]
71
68
  job_organization = Taxonomy.find_by(id: job.task.input[:current_organization_id])
72
69
  job_location = Taxonomy.find_by(id: job.task.input[:current_location_id])
73
70
  render :json => {
@@ -33,7 +33,8 @@ module RemoteExecutionHelper
33
33
  links << { title: _('Host detail'),
34
34
  action: { href: current_host_details_path(host), 'data-method': 'get', id: "#{host.name}-actions-detail" } }
35
35
  end
36
- if authorized_for(controller: :job_invocations, action: :create) && (!host.infrastructure_host? || User.current.can?(:execute_jobs_on_infrastructure_hosts))
36
+
37
+ if authorized_for(hash_for_rerun_job_invocation_path(id: job_invocation, host_ids: [ host.id ], authorizer: job_hosts_authorizer))
37
38
  links << { title: (_('Rerun on %s') % host.name),
38
39
  action: { href: rerun_job_invocation_path(job_invocation, host_ids: [ host.id ]),
39
40
  'data-method': 'get', id: "#{host.name}-actions-rerun" } }
@@ -55,7 +56,7 @@ module RemoteExecutionHelper
55
56
  def job_invocations_buttons
56
57
  [
57
58
  documentation_button_rex('3.2ExecutingaJob'),
58
- authorized_for(controller: :job_invocations, action: :create) ? link_to(_('Run Job'), hash_for_new_job_invocation_path, {:class => "btn btn-primary"}) : '',
59
+ display_link_if_authorized(_('Run Job'), hash_for_new_job_invocation_path, {:class => "btn btn-primary"}),
59
60
  ]
60
61
  end
61
62
 
@@ -69,12 +70,12 @@ module RemoteExecutionHelper
69
70
  title: _('Create report for this job'),
70
71
  disabled: task.pending?)
71
72
  end
72
- if authorized_for(controller: :job_invocations, action: :create)
73
+ if authorized_for(hash_for_new_job_invocation_path)
73
74
  buttons << link_to(_('Rerun'), rerun_job_invocation_path(:id => job_invocation.id),
74
75
  :class => 'btn btn-default',
75
76
  :title => _('Rerun the job'))
76
77
  end
77
- if authorized_for(controller: :job_invocations, action: :create)
78
+ if authorized_for(hash_for_new_job_invocation_path)
78
79
  buttons << link_to(_('Rerun failed'), rerun_job_invocation_path(:id => job_invocation.id, :failed_only => 1),
79
80
  :class => 'btn btn-default',
80
81
  :disabled => job_invocation.failed_hosts.none?,
@@ -97,6 +98,11 @@ module RemoteExecutionHelper
97
98
  :disabled => !task.cancellable?,
98
99
  :method => :post)
99
100
  end
101
+ if Setting[:lab_features]
102
+ buttons << link_to(_('New UI'), new_job_invocation_detail_path(:id => job_invocation.id),
103
+ class: 'btn btn-default',
104
+ title: _('Switch to the new job invocation detail UI'))
105
+ end
100
106
  return buttons
101
107
  end
102
108
 
@@ -0,0 +1,42 @@
1
+ module Actions
2
+ module RemoteExecution
3
+ module EventHelpers
4
+ module ClassEventHelpers
5
+ def event_states
6
+ []
7
+ end
8
+
9
+ def event_names
10
+ event_states.map do |state|
11
+ event_name_base + '_' + event_name_suffix(state).to_s
12
+ end
13
+ end
14
+
15
+ def feature_job_event_names(label)
16
+ event_states.map do |state|
17
+ ::Foreman::Observable.event_name_for("#{event_name_base}_#{label}_#{event_name_suffix(state)}")
18
+ end
19
+ end
20
+ end
21
+
22
+ def self.included(base)
23
+ base.extend ClassEventHelpers
24
+ end
25
+
26
+ def emit_event(execution_plan, hook)
27
+ return unless root_action?
28
+
29
+ payload = event_payload(execution_plan)
30
+ base = self.class.event_name_base
31
+ suffix = self.class.event_name_suffix(hook)
32
+ if input["job_features"]&.any?
33
+ input['job_features'].each do |feature|
34
+ name = "#{base}_#{feature}_#{suffix}"
35
+ trigger_hook name, payload: payload
36
+ end
37
+ end
38
+ trigger_hook("#{base}_#{suffix}", payload: payload)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -5,8 +5,7 @@ module Actions
5
5
  include ::Actions::Helpers::WithDelegatedAction
6
6
  include ::Actions::ObservableAction
7
7
  include ::Actions::RemoteExecution::TemplateInvocationProgressLogging
8
-
9
- execution_plan_hooks.use :emit_feature_event, :on => :success
8
+ include ::Actions::RemoteExecution::EventHelpers
10
9
 
11
10
  middleware.do_not_use Dynflow::Middleware::Common::Transaction
12
11
  middleware.use Actions::Middleware::HideSecrets
@@ -79,20 +78,8 @@ module Actions
79
78
  end
80
79
  end
81
80
 
82
- def self.feature_job_event_name(label, suffix = :success)
83
- ::Foreman::Observable.event_name_for("#{::Actions::RemoteExecution::RunHostJob.event_name_base}_#{label}_#{::Actions::RemoteExecution::RunHostJob.event_name_suffix(suffix)}")
84
- end
85
-
86
- def emit_feature_event(execution_plan, hook = :success)
87
- return unless root_action?
88
-
89
- payload = event_payload(execution_plan)
90
- if input["job_features"]&.any?
91
- input['job_features'].each do |feature|
92
- name = "#{self.class.event_name_base}_#{feature}_#{self.class.event_name_suffix(hook)}"
93
- trigger_hook name, payload: payload
94
- end
95
- end
81
+ def self.event_states
82
+ [:success, :failure]
96
83
  end
97
84
 
98
85
  def secrets(host, job_invocation, provider)
@@ -3,6 +3,7 @@ module Actions
3
3
  class RunHostsJob < Actions::ActionWithSubPlans
4
4
  include Actions::RecurringAction
5
5
  include Actions::ObservableAction
6
+ include Actions::RemoteExecution::EventHelpers
6
7
 
7
8
  middleware.use Actions::Middleware::BindJobInvocation
8
9
  middleware.use Actions::Middleware::RecurringLogic
@@ -10,7 +11,7 @@ module Actions
10
11
 
11
12
  execution_plan_hooks.use :notify_on_success, :on => :success
12
13
  execution_plan_hooks.use :notify_on_failure, :on => :failure
13
- execution_plan_hooks.use :emit_event_running, :on => :running
14
+ execution_plan_hooks.use :emit_running_event, :on => :running
14
15
 
15
16
  class CheckOnProxyActions; end
16
17
 
@@ -28,7 +29,8 @@ module Actions
28
29
  def plan(job_invocation)
29
30
  job_invocation.task_group.save! if job_invocation.task_group.try(:new_record?)
30
31
  task.add_missing_task_groups(job_invocation.task_group) if job_invocation.task_group
31
- action_subject(job_invocation)
32
+ features = job_invocation.pattern_templates.flat_map { |t| t.remote_execution_features.pluck(:label) }.uniq
33
+ action_subject(job_invocation, job_features: features)
32
34
  job_invocation.targeting.resolve_hosts! if job_invocation.targeting.dynamic? || !job_invocation.targeting.resolved?
33
35
  set_up_concurrency_control job_invocation
34
36
  input.update(:job_category => job_invocation.job_category)
@@ -158,11 +160,11 @@ module Actions
158
160
  input[:proxy_batch_size]
159
161
  end
160
162
 
161
- def self.event_names
162
- super + [event_name_base + '_' + event_name_suffix('running')]
163
+ def self.event_states
164
+ [:success, :failure, :running]
163
165
  end
164
166
 
165
- def emit_event_running(plan)
167
+ def emit_running_event(plan)
166
168
  emit_event(plan, :running)
167
169
  end
168
170
 
@@ -0,0 +1,12 @@
1
+ module Api
2
+ module V2
3
+ module HostsControllerExtensions
4
+ extend ActiveSupport::Concern
5
+ def index_node_permissions
6
+ super.merge({
7
+ :can_create_job_invocations => authorized_for(:controller => 'job_invocations', :action => 'create'),
8
+ })
9
+ end
10
+ end
11
+ end
12
+ end
@@ -271,7 +271,6 @@ class JobInvocationComposer
271
271
  job_invocation.pattern_template_invocations.map do |template_invocation|
272
272
  params = template_invocation.attributes.slice('template_id', 'effective_user')
273
273
  params['input_values'] = template_invocation.input_values.map { |v| v.attributes.slice('template_input_id', 'value') }
274
- params['provider_input_values'] = template_invocation.provider_input_values.map { |v| v.attributes.slice('name', 'value') }
275
274
  params
276
275
  end
277
276
  end
@@ -3,7 +3,11 @@ object @job_invocation
3
3
  attributes :id, :description, :job_category, :targeting_id, :status, :start_at, :status_label, :ssh_user, :time_to_pickup
4
4
 
5
5
  node do |invocation|
6
+ pattern_template = invocation.pattern_template_invocations.first
6
7
  {
8
+ :template_id => pattern_template&.template_id,
9
+ :template_name => pattern_template&.template_name,
10
+ :effective_user => pattern_template&.effective_user,
7
11
  :succeeded => invocation_count(invocation, :output_key => :success_count),
8
12
  :failed => invocation_count(invocation, :output_key => :failed_count),
9
13
  :pending => invocation_count(invocation, :output_key => :pending_count),
@@ -15,3 +19,13 @@ end
15
19
  child :task => :dynflow_task do
16
20
  attributes :id, :state
17
21
  end
22
+
23
+ if params.key?(:include_permissions)
24
+ node :permissions do |invocation|
25
+ authorizer = Authorizer.new(User.current)
26
+ edit_job_templates_permission = Permission.where(name: "edit_job_templates", resource_type: "JobTemplate").first
27
+ {
28
+ "edit_job_templates" => (edit_job_templates_permission && authorizer.can?("edit_job_templates", invocation, false)),
29
+ }
30
+ end
31
+ end
@@ -31,9 +31,6 @@ export CONVERT2RHEL_DISABLE_TELEMETRY=1
31
31
 
32
32
  /usr/bin/convert2rhel analyze -y
33
33
 
34
- # Workaround for https://issues.redhat.com/browse/RHELC-1280
35
- subscription-manager facts --update
36
-
37
34
  if grep -q ERROR /var/log/convert2rhel/convert2rhel-pre-conversion.json; then
38
35
  echo "Error: Some error(s) have been found."
39
36
  echo "Exiting ..."
data/config/routes.rb CHANGED
@@ -22,6 +22,8 @@ Rails.application.routes.draw do
22
22
  match 'job_invocations/:id/rerun', to: 'react#index', :via => [:get], as: 'rerun_job_invocation'
23
23
  match 'old/job_invocations/new', to: 'job_invocations#new', via: [:get], as: 'form_new_job_invocation'
24
24
  match 'old/job_invocations/:id/rerun', to: 'job_invocations#rerun', via: [:get, :post], as: 'form_rerun_job_invocation'
25
+ match 'experimental/job_invocations_detail/:id', to: 'react#index', :via => [:get], as: 'new_job_invocation_detail'
26
+
25
27
  resources :job_invocations, :only => [:create, :show, :index] do
26
28
  collection do
27
29
  get 'preview_job_invocations_per_host'
@@ -9,7 +9,7 @@ class AddHostIdToTemplateInvocation < ActiveRecord::Migration[4.2]
9
9
  FakeTemplateInvocation.reset_column_information
10
10
 
11
11
  say 'Migrating existing execution locks to explicit relations, this may take a while'
12
- FakeTemplateInvocation.all.each do |template_invocation|
12
+ FakeTemplateInvocation.all.find_each do |template_invocation|
13
13
  task = ForemanTasks::Task.for_action_types('Actions::RemoteExecution::RunHostJob').joins(:locks).where(
14
14
  :'foreman_tasks_locks.resource_type' => 'TemplateInvocation',
15
15
  :'foreman_tasks_locks.resource_id' => template_invocation.id
@@ -5,7 +5,7 @@ class MigrateToTaskGroups < ActiveRecord::Migration[4.2]
5
5
 
6
6
  def up
7
7
  say 'Migrating from locks to task groups'
8
- FakeJobInvocation.where('task_group_id IS NULL AND task_id IS NOT NULL').each do |job_invocation|
8
+ FakeJobInvocation.where('task_group_id IS NULL AND task_id IS NOT NULL').find_each do |job_invocation|
9
9
  task_group = JobInvocationTaskGroup.new
10
10
  task_group.task_ids = [job_invocation.task_id]
11
11
  task_group.save!