foreman_ansible 11.1.1 → 11.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/foreman_ansible/ansible_hostgroups_helper.rb +28 -8
  3. data/app/views/foreman_ansible/job_templates/convert_to_rhel.erb +20 -0
  4. data/db/migrate/20221003153000_add_ansible_callback_enabled_to_templates.rb +1 -1
  5. data/db/migrate/20230416170000_enable_ansible_callback_for_rex_feature.rb +5 -0
  6. data/lib/foreman_ansible/version.rb +1 -1
  7. data/test/integration/hostgroup_js_test.rb +4 -2
  8. metadata +15 -51
  9. data/locale/ca/foreman_ansible.edit.po +0 -1162
  10. data/locale/ca/foreman_ansible.po.time_stamp +0 -0
  11. data/locale/cs_CZ/foreman_ansible.edit.po +0 -1207
  12. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  13. data/locale/de/foreman_ansible.edit.po +0 -1148
  14. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  15. data/locale/en/foreman_ansible.edit.po +0 -1146
  16. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  17. data/locale/en_GB/foreman_ansible.edit.po +0 -1155
  18. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  19. data/locale/es/foreman_ansible.edit.po +0 -1148
  20. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  21. data/locale/fr/foreman_ansible.edit.po +0 -1148
  22. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  23. data/locale/gl/foreman_ansible.edit.po +0 -1156
  24. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  25. data/locale/it/foreman_ansible.edit.po +0 -1148
  26. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  27. data/locale/ja/foreman_ansible.edit.po +0 -1148
  28. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  29. data/locale/ko/foreman_ansible.edit.po +0 -1148
  30. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  31. data/locale/nl_NL/foreman_ansible.edit.po +0 -1168
  32. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  33. data/locale/pl/foreman_ansible.edit.po +0 -1180
  34. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  35. data/locale/pt_BR/foreman_ansible.edit.po +0 -1148
  36. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  37. data/locale/ru/foreman_ansible.edit.po +0 -1149
  38. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  39. data/locale/sv_SE/foreman_ansible.edit.po +0 -1180
  40. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  41. data/locale/zh_CN/foreman_ansible.edit.po +0 -1148
  42. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  43. data/locale/zh_TW/foreman_ansible.edit.po +0 -1148
  44. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  45. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +0 -151
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d240da772a37f88926b90ead02fae80bea4f14e257cff99873c805c7ff171a92
4
- data.tar.gz: 00e38d4208388c1893e29f440f1afc6f4988fc31a9c1d9e1107bb337f34e14a2
3
+ metadata.gz: bf610471f0b7c4357d630471f3f34f4d99f84d91060904ebc7baee85a0a26162
4
+ data.tar.gz: 1bf0b29be5c77f3942fd0ec3f1e00b22bdb9d4dc04deda4cb119763a25c1e042
5
5
  SHA512:
6
- metadata.gz: b1af6d0d6eee6c4f7ef48c22d795c6480516c1f8fa80539d64b6c6184b945af1a8a6350cfa963963b486a1b169a907efffa6573528547e1e386d47b819d96967
7
- data.tar.gz: 2e8f162c2ec013b1bee7be62f06b77a55b0d22d57e40449e3cdb7312ff3a532fa3bb61a0b083fb7a5421d5ad33a1d7811d749e0ec4c6e95741d36bd49644da46
6
+ metadata.gz: 16c9980e47104205c17326496bf12c2bbf3913db2c80155395b20f0b35f78e7d94c25ad763778431ad11b25ae894a1c5e4c92a14483efe769012fafcc1dbf084
7
+ data.tar.gz: cba6767ef45ff810159320b9351e89f9e984234364e9d2206aa72ec172d2dd5878111e2ff7febd058ae6ba9aa3642b31e9aad446997117dd799138699b0c5d1d
@@ -4,18 +4,38 @@ module ForemanAnsible
4
4
  module AnsibleHostgroupsHelper
5
5
  def ansible_hostgroups_actions(hostgroup)
6
6
  actions = []
7
- play_roles = if hostgroup.all_ansible_roles.empty?
8
- { action: { content: (link_to _('Run all Ansible roles'), 'javascript:void(0);', disabled: true, title: 'No roles assigned', class: 'disabled'), options: { class: 'disabled' } }, priority: 31 }
9
- else
10
- { action: display_link_if_authorized(_('Run all Ansible roles'), hash_for_play_roles_hostgroup_path(id: hostgroup), 'data-no-turbolink': true, title: _('Run all Ansible roles on hosts belonging to this host group')), priority: 31 }
11
- end
7
+ is_hostgroup_empty = hostgroup.all_ansible_roles.empty? || hostgroup.hosts_count.zero?
12
8
 
13
- assign_jobs = { action: { content: (link_to _('Configure Ansible Job'), "/ansible/hostgroups/#{hostgroup.id}", class: 'la') }, priority: 32 }
9
+ if User.current.can?(:create_job_invocations)
10
+ actions << {
11
+ action: if is_hostgroup_empty
12
+ disabled_action_link(_('Run all Ansible roles'))
13
+ else
14
+ display_link_if_authorized(_('Run all Ansible roles'), hash_for_play_roles_hostgroup_path(id: hostgroup), 'data-no-turbolink': true, title: _('Run all Ansible roles on hosts belonging to this host group'))
15
+ end,
16
+ priority: 31
17
+ }
18
+ end
14
19
 
15
- actions.push play_roles if User.current.can?(:create_job_invocations)
16
- actions.push assign_jobs if User.current.can?(:view_job_invocations) && User.current.can?(:view_recurring_logics)
20
+ if User.current.can?(:view_job_invocations) && User.current.can?(:view_recurring_logics)
21
+ actions << {
22
+ action: if is_hostgroup_empty
23
+ disabled_action_link(_('Configure Ansible Job'))
24
+ else
25
+ link_to(_('Configure Ansible Job'), "/ansible/hostgroups/#{hostgroup.id}", class: 'la')
26
+ end,
27
+ priority: 32
28
+ }
29
+ end
17
30
 
18
31
  actions
19
32
  end
33
+
34
+ def disabled_action_link(text)
35
+ {
36
+ content: link_to(text, 'javascript:void(0);', disabled: true, title: _('No roles/hosts assigned'), class: 'disabled'),
37
+ options: { class: 'disabled' }
38
+ }
39
+ end
20
40
  end
21
41
  end
@@ -21,6 +21,21 @@ template_inputs:
21
21
  value_type: plain
22
22
  resource_type: Katello::ActivationKey
23
23
  hidden_value: false
24
+ - name: Data telemetry
25
+ required: true
26
+ input_type: user
27
+ description: "The convert2rhel utility uploads the following data about the system
28
+ conversion to Red Hat servers for the purpose of the utility usage analysis:<br>\r\n-
29
+ The conver2rhel command as executed<br>\r\n- The convert2rhel RPM version and
30
+ GPG signature<br>\r\n- Success or failure status of the conversion<br>\r\n- Conversion
31
+ start and end timestamps<br>\r\n- Source OS vendor and version<br>\r\n- Target
32
+ RHEL version<br>\r\n- convert2rhel related environment variables<br>"
33
+ options: "yes\r\nno"
34
+ advanced: false
35
+ value_type: plain
36
+ resource_type: Katello::ActivationKey
37
+ default: 'yes'
38
+ hidden_value: false
24
39
  model: JobTemplate
25
40
  job_category: Convert 2 RHEL
26
41
  provider_type: Ansible
@@ -28,6 +43,10 @@ kind: job_template
28
43
  %>
29
44
  ---
30
45
  - hosts: all
46
+ <%- if input('Data telemetry') != "yes" -%>
47
+ environment:
48
+ CONVERT2RHEL_DISABLE_TELEMETRY: 1
49
+ <%- end -%>
31
50
  tasks:
32
51
  - name: Install convert2rhel
33
52
  ansible.builtin.package:
@@ -44,5 +63,6 @@ kind: job_template
44
63
  reboot:
45
64
  reboot_timeout: 1800
46
65
  <%- end -%>
66
+ <%- # This will update system facts in Satellite and link the correct OS of the host %->
47
67
  - name: Update system facts
48
68
  command: subscription-manager facts --update
@@ -4,7 +4,7 @@ class AddAnsibleCallbackEnabledToTemplates < ActiveRecord::Migration[6.0]
4
4
  def change
5
5
  add_column :templates, :ansible_callback_enabled, :boolean, default: false
6
6
  RemoteExecutionFeature.where(label: 'ansible_run_host').each do |rex_feature|
7
- Template.find(rex_feature.job_template_id).update(ansible_callback_enabled: true)
7
+ Template.where(id: rex_feature.job_template_id).update_all(ansible_callback_enabled: true)
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,5 @@
1
+ class EnableAnsibleCallbackForRexFeature < ActiveRecord::Migration[6.0]
2
+ def change
3
+ Template.where(id: RemoteExecutionFeature.select(:job_template_id).where(label: 'ansible_run_host')).update_all(ansible_callback_enabled: true)
4
+ end
5
+ end
@@ -4,5 +4,5 @@
4
4
  # This way other parts of Foreman can just call ForemanAnsible::VERSION
5
5
  # and detect what version the plugin is running.
6
6
  module ForemanAnsible
7
- VERSION = '11.1.1'
7
+ VERSION = '11.2.0'
8
8
  end
@@ -10,21 +10,23 @@ class HostgroupJsTest < IntegrationTestWithJavascript
10
10
  FactoryBot.create(:host, :hostgroup_id => hostgroup_with_roles.id)
11
11
  end
12
12
 
13
- test 'hostgroup without roles should have disabled link' do
13
+ test 'hostgroup without roles should have disabled links' do
14
14
  visit hostgroups_path(search: hostgroup.name)
15
15
 
16
16
  first_row = page.find('table > tbody > tr:nth-child(1)')
17
17
  first_row.find('td:nth-child(4) > div > a').click
18
18
 
19
19
  assert_includes first(:link, 'Run all Ansible roles')[:class], 'disabled'
20
+ assert_includes first(:link, 'Configure Ansible Job')[:class], 'disabled'
20
21
  end
21
22
 
22
- test 'hostgroup with roles should have clickable link' do
23
+ test 'hostgroup with roles should have clickable links' do
23
24
  visit hostgroups_path(search: hostgroup_with_roles.name)
24
25
 
25
26
  first_row = page.find('table > tbody > tr:nth-child(1)')
26
27
  first_row.find('td:nth-child(4) > div > a').click
27
28
 
28
29
  assert_not first(:link, 'Run all Ansible roles')[:class].include?('disabled')
30
+ assert_not first(:link, 'Configure Ansible Job')[:class].include?('disabled')
29
31
  end
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.1
4
+ version: 11.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Lobato Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-07 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -225,6 +225,7 @@ files:
225
225
  - db/migrate/20210818083407_fix_ansible_setting_category_to_dsl.rb
226
226
  - db/migrate/20221003153000_add_ansible_callback_enabled_to_templates.rb
227
227
  - db/migrate/20221031114720_rename_capsule_upgrade_playbook.rb
228
+ - db/migrate/20230416170000_enable_ansible_callback_for_rex_feature.rb
228
229
  - db/seeds.d/100_common_parameters.rb
229
230
  - db/seeds.d/62_ansible_proxy_feature.rb
230
231
  - db/seeds.d/75_job_templates.rb
@@ -237,81 +238,45 @@ files:
237
238
  - locale/Makefile
238
239
  - locale/action_names.rb
239
240
  - locale/ca/LC_MESSAGES/foreman_ansible.mo
240
- - locale/ca/foreman_ansible.edit.po
241
241
  - locale/ca/foreman_ansible.po
242
- - locale/ca/foreman_ansible.po.time_stamp
243
242
  - locale/cs_CZ/LC_MESSAGES/foreman_ansible.mo
244
- - locale/cs_CZ/foreman_ansible.edit.po
245
243
  - locale/cs_CZ/foreman_ansible.po
246
- - locale/cs_CZ/foreman_ansible.po.time_stamp
247
244
  - locale/de/LC_MESSAGES/foreman_ansible.mo
248
- - locale/de/foreman_ansible.edit.po
249
245
  - locale/de/foreman_ansible.po
250
- - locale/de/foreman_ansible.po.time_stamp
251
246
  - locale/en/LC_MESSAGES/foreman_ansible.mo
252
- - locale/en/foreman_ansible.edit.po
253
247
  - locale/en/foreman_ansible.po
254
- - locale/en/foreman_ansible.po.time_stamp
255
248
  - locale/en_GB/LC_MESSAGES/foreman_ansible.mo
256
- - locale/en_GB/foreman_ansible.edit.po
257
249
  - locale/en_GB/foreman_ansible.po
258
- - locale/en_GB/foreman_ansible.po.time_stamp
259
250
  - locale/es/LC_MESSAGES/foreman_ansible.mo
260
- - locale/es/foreman_ansible.edit.po
261
251
  - locale/es/foreman_ansible.po
262
- - locale/es/foreman_ansible.po.time_stamp
263
252
  - locale/foreman_ansible.pot
264
253
  - locale/fr/LC_MESSAGES/foreman_ansible.mo
265
- - locale/fr/foreman_ansible.edit.po
266
254
  - locale/fr/foreman_ansible.po
267
- - locale/fr/foreman_ansible.po.time_stamp
268
255
  - locale/gemspec.rb
269
256
  - locale/gl/LC_MESSAGES/foreman_ansible.mo
270
- - locale/gl/foreman_ansible.edit.po
271
257
  - locale/gl/foreman_ansible.po
272
- - locale/gl/foreman_ansible.po.time_stamp
273
258
  - locale/it/LC_MESSAGES/foreman_ansible.mo
274
- - locale/it/foreman_ansible.edit.po
275
259
  - locale/it/foreman_ansible.po
276
- - locale/it/foreman_ansible.po.time_stamp
277
260
  - locale/ja/LC_MESSAGES/foreman_ansible.mo
278
- - locale/ja/foreman_ansible.edit.po
279
261
  - locale/ja/foreman_ansible.po
280
- - locale/ja/foreman_ansible.po.time_stamp
281
262
  - locale/ka/LC_MESSAGES/foreman_ansible.mo
282
263
  - locale/ka/foreman_ansible.po
283
264
  - locale/ko/LC_MESSAGES/foreman_ansible.mo
284
- - locale/ko/foreman_ansible.edit.po
285
265
  - locale/ko/foreman_ansible.po
286
- - locale/ko/foreman_ansible.po.time_stamp
287
266
  - locale/nl_NL/LC_MESSAGES/foreman_ansible.mo
288
- - locale/nl_NL/foreman_ansible.edit.po
289
267
  - locale/nl_NL/foreman_ansible.po
290
- - locale/nl_NL/foreman_ansible.po.time_stamp
291
268
  - locale/pl/LC_MESSAGES/foreman_ansible.mo
292
- - locale/pl/foreman_ansible.edit.po
293
269
  - locale/pl/foreman_ansible.po
294
- - locale/pl/foreman_ansible.po.time_stamp
295
270
  - locale/pt_BR/LC_MESSAGES/foreman_ansible.mo
296
- - locale/pt_BR/foreman_ansible.edit.po
297
271
  - locale/pt_BR/foreman_ansible.po
298
- - locale/pt_BR/foreman_ansible.po.time_stamp
299
272
  - locale/ru/LC_MESSAGES/foreman_ansible.mo
300
- - locale/ru/foreman_ansible.edit.po
301
273
  - locale/ru/foreman_ansible.po
302
- - locale/ru/foreman_ansible.po.time_stamp
303
274
  - locale/sv_SE/LC_MESSAGES/foreman_ansible.mo
304
- - locale/sv_SE/foreman_ansible.edit.po
305
275
  - locale/sv_SE/foreman_ansible.po
306
- - locale/sv_SE/foreman_ansible.po.time_stamp
307
276
  - locale/zh_CN/LC_MESSAGES/foreman_ansible.mo
308
- - locale/zh_CN/foreman_ansible.edit.po
309
277
  - locale/zh_CN/foreman_ansible.po
310
- - locale/zh_CN/foreman_ansible.po.time_stamp
311
278
  - locale/zh_TW/LC_MESSAGES/foreman_ansible.mo
312
- - locale/zh_TW/foreman_ansible.edit.po
313
279
  - locale/zh_TW/foreman_ansible.po
314
- - locale/zh_TW/foreman_ansible.po.time_stamp
315
280
  - package.json
316
281
  - test/factories/ansible_proxy.rb
317
282
  - test/factories/ansible_roles.rb
@@ -384,7 +349,6 @@ files:
384
349
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js
385
350
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss
386
351
  - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js
387
- - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig
388
352
  - webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js
389
353
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js
390
354
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js
@@ -505,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
505
469
  - !ruby/object:Gem::Version
506
470
  version: '0'
507
471
  requirements: []
508
- rubygems_version: 3.3.26
472
+ rubygems_version: 3.1.4
509
473
  signing_key:
510
474
  specification_version: 4
511
475
  summary: Ansible integration with Foreman (theforeman.org)
@@ -520,23 +484,31 @@ test_files:
520
484
  - test/fixtures/sample_playbooks.json
521
485
  - test/fixtures/report.json
522
486
  - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
487
+ - test/functional/ansible_roles_controller_test.rb
488
+ - test/functional/ansible_variables_controller_test.rb
523
489
  - test/functional/api/v2/ansible_playbooks_controller_test.rb
524
490
  - test/functional/api/v2/ansible_roles_controller_test.rb
525
491
  - test/functional/api/v2/ansible_variables_controller_test.rb
526
492
  - test/functional/api/v2/hostgroups_controller_test.rb
527
493
  - test/functional/api/v2/hosts_controller_test.rb
528
494
  - test/functional/api/v2/ansible_inventories_controller_test.rb
529
- - test/functional/ansible_roles_controller_test.rb
530
- - test/functional/ansible_variables_controller_test.rb
531
495
  - test/functional/hosts_controller_test.rb
532
496
  - test/functional/ui_ansible_roles_controller_test.rb
533
497
  - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
534
498
  - test/graphql/queries/ansible_roles_query_test.rb
535
499
  - test/graphql/queries/host_ansible_roles_query_test.rb
500
+ - test/test_plugin_helper.rb
501
+ - test/unit/ansible_role_test.rb
502
+ - test/unit/ansible_variable_test.rb
503
+ - test/unit/concerns/config_reports_extensions_test.rb
536
504
  - test/unit/concerns/host_managed_extensions_test.rb
537
505
  - test/unit/concerns/hostgroup_extensions_test.rb
538
- - test/unit/concerns/config_reports_extensions_test.rb
539
506
  - test/unit/helpers/ansible_reports_helper_test.rb
507
+ - test/unit/host_ansible_role_test.rb
508
+ - test/unit/hostgroup_ansible_role_test.rb
509
+ - test/unit/ignore_roles_test.rb
510
+ - test/unit/import_playbooks_test.rb
511
+ - test/unit/import_roles_and_variables.rb
540
512
  - test/unit/lib/proxy_api/ansible_test.rb
541
513
  - test/unit/services/ansible_report_importer_test.rb
542
514
  - test/unit/services/ansible_variables_importer_test.rb
@@ -546,13 +518,5 @@ test_files:
546
518
  - test/unit/services/override_resolver_test.rb
547
519
  - test/unit/services/roles_importer_test.rb
548
520
  - test/unit/services/ui_roles_importer_test.rb
549
- - test/unit/ansible_role_test.rb
550
- - test/unit/ansible_variable_test.rb
551
- - test/unit/host_ansible_role_test.rb
552
- - test/unit/hostgroup_ansible_role_test.rb
553
- - test/unit/ignore_roles_test.rb
554
- - test/unit/import_playbooks_test.rb
555
- - test/unit/import_roles_and_variables.rb
556
521
  - test/unit/ansible_provider_test.rb
557
- - test/test_plugin_helper.rb
558
522
  - test/integration/hostgroup_js_test.rb