foreman_ansible 11.1.1 → 11.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/foreman_ansible/ansible_hostgroups_helper.rb +28 -8
  3. data/lib/foreman_ansible/version.rb +1 -1
  4. data/test/integration/hostgroup_js_test.rb +4 -2
  5. metadata +14 -51
  6. data/locale/ca/foreman_ansible.edit.po +0 -1162
  7. data/locale/ca/foreman_ansible.po.time_stamp +0 -0
  8. data/locale/cs_CZ/foreman_ansible.edit.po +0 -1207
  9. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  10. data/locale/de/foreman_ansible.edit.po +0 -1148
  11. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  12. data/locale/en/foreman_ansible.edit.po +0 -1146
  13. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  14. data/locale/en_GB/foreman_ansible.edit.po +0 -1155
  15. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  16. data/locale/es/foreman_ansible.edit.po +0 -1148
  17. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  18. data/locale/fr/foreman_ansible.edit.po +0 -1148
  19. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  20. data/locale/gl/foreman_ansible.edit.po +0 -1156
  21. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  22. data/locale/it/foreman_ansible.edit.po +0 -1148
  23. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  24. data/locale/ja/foreman_ansible.edit.po +0 -1148
  25. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  26. data/locale/ko/foreman_ansible.edit.po +0 -1148
  27. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  28. data/locale/nl_NL/foreman_ansible.edit.po +0 -1168
  29. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  30. data/locale/pl/foreman_ansible.edit.po +0 -1180
  31. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  32. data/locale/pt_BR/foreman_ansible.edit.po +0 -1148
  33. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  34. data/locale/ru/foreman_ansible.edit.po +0 -1149
  35. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  36. data/locale/sv_SE/foreman_ansible.edit.po +0 -1180
  37. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  38. data/locale/zh_CN/foreman_ansible.edit.po +0 -1148
  39. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  40. data/locale/zh_TW/foreman_ansible.edit.po +0 -1148
  41. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  42. 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: 7a38c12c105eac8039a45829e0f05e766b91be42e5ed014b1bd83cf7ba6f96e0
4
+ data.tar.gz: 6482567cf6c8c10f20d14783270c12c2dcb137f05001d54e834ec50472789739
5
5
  SHA512:
6
- metadata.gz: b1af6d0d6eee6c4f7ef48c22d795c6480516c1f8fa80539d64b6c6184b945af1a8a6350cfa963963b486a1b169a907efffa6573528547e1e386d47b819d96967
7
- data.tar.gz: 2e8f162c2ec013b1bee7be62f06b77a55b0d22d57e40449e3cdb7312ff3a532fa3bb61a0b083fb7a5421d5ad33a1d7811d749e0ec4c6e95741d36bd49644da46
6
+ metadata.gz: 640d6cd564a0a4b6b61d58a571a30365a85d1c6905944c5a6fcbd4db8fde689072100e308e5d9579f577f2ec9129da197c2d829640e6b4d5bcf018771ea5a1fc
7
+ data.tar.gz: 7d0748946cff9d8541ed08fa0fc8c006376f109816f20edbfd43969aac3115d7feba28ea6ae4c634ea616663e0c289e92bd7036bb767545994dc66353d361168
@@ -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
@@ -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.1.2'
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.1.2
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-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -237,81 +237,45 @@ files:
237
237
  - locale/Makefile
238
238
  - locale/action_names.rb
239
239
  - locale/ca/LC_MESSAGES/foreman_ansible.mo
240
- - locale/ca/foreman_ansible.edit.po
241
240
  - locale/ca/foreman_ansible.po
242
- - locale/ca/foreman_ansible.po.time_stamp
243
241
  - locale/cs_CZ/LC_MESSAGES/foreman_ansible.mo
244
- - locale/cs_CZ/foreman_ansible.edit.po
245
242
  - locale/cs_CZ/foreman_ansible.po
246
- - locale/cs_CZ/foreman_ansible.po.time_stamp
247
243
  - locale/de/LC_MESSAGES/foreman_ansible.mo
248
- - locale/de/foreman_ansible.edit.po
249
244
  - locale/de/foreman_ansible.po
250
- - locale/de/foreman_ansible.po.time_stamp
251
245
  - locale/en/LC_MESSAGES/foreman_ansible.mo
252
- - locale/en/foreman_ansible.edit.po
253
246
  - locale/en/foreman_ansible.po
254
- - locale/en/foreman_ansible.po.time_stamp
255
247
  - locale/en_GB/LC_MESSAGES/foreman_ansible.mo
256
- - locale/en_GB/foreman_ansible.edit.po
257
248
  - locale/en_GB/foreman_ansible.po
258
- - locale/en_GB/foreman_ansible.po.time_stamp
259
249
  - locale/es/LC_MESSAGES/foreman_ansible.mo
260
- - locale/es/foreman_ansible.edit.po
261
250
  - locale/es/foreman_ansible.po
262
- - locale/es/foreman_ansible.po.time_stamp
263
251
  - locale/foreman_ansible.pot
264
252
  - locale/fr/LC_MESSAGES/foreman_ansible.mo
265
- - locale/fr/foreman_ansible.edit.po
266
253
  - locale/fr/foreman_ansible.po
267
- - locale/fr/foreman_ansible.po.time_stamp
268
254
  - locale/gemspec.rb
269
255
  - locale/gl/LC_MESSAGES/foreman_ansible.mo
270
- - locale/gl/foreman_ansible.edit.po
271
256
  - locale/gl/foreman_ansible.po
272
- - locale/gl/foreman_ansible.po.time_stamp
273
257
  - locale/it/LC_MESSAGES/foreman_ansible.mo
274
- - locale/it/foreman_ansible.edit.po
275
258
  - locale/it/foreman_ansible.po
276
- - locale/it/foreman_ansible.po.time_stamp
277
259
  - locale/ja/LC_MESSAGES/foreman_ansible.mo
278
- - locale/ja/foreman_ansible.edit.po
279
260
  - locale/ja/foreman_ansible.po
280
- - locale/ja/foreman_ansible.po.time_stamp
281
261
  - locale/ka/LC_MESSAGES/foreman_ansible.mo
282
262
  - locale/ka/foreman_ansible.po
283
263
  - locale/ko/LC_MESSAGES/foreman_ansible.mo
284
- - locale/ko/foreman_ansible.edit.po
285
264
  - locale/ko/foreman_ansible.po
286
- - locale/ko/foreman_ansible.po.time_stamp
287
265
  - locale/nl_NL/LC_MESSAGES/foreman_ansible.mo
288
- - locale/nl_NL/foreman_ansible.edit.po
289
266
  - locale/nl_NL/foreman_ansible.po
290
- - locale/nl_NL/foreman_ansible.po.time_stamp
291
267
  - locale/pl/LC_MESSAGES/foreman_ansible.mo
292
- - locale/pl/foreman_ansible.edit.po
293
268
  - locale/pl/foreman_ansible.po
294
- - locale/pl/foreman_ansible.po.time_stamp
295
269
  - locale/pt_BR/LC_MESSAGES/foreman_ansible.mo
296
- - locale/pt_BR/foreman_ansible.edit.po
297
270
  - locale/pt_BR/foreman_ansible.po
298
- - locale/pt_BR/foreman_ansible.po.time_stamp
299
271
  - locale/ru/LC_MESSAGES/foreman_ansible.mo
300
- - locale/ru/foreman_ansible.edit.po
301
272
  - locale/ru/foreman_ansible.po
302
- - locale/ru/foreman_ansible.po.time_stamp
303
273
  - locale/sv_SE/LC_MESSAGES/foreman_ansible.mo
304
- - locale/sv_SE/foreman_ansible.edit.po
305
274
  - locale/sv_SE/foreman_ansible.po
306
- - locale/sv_SE/foreman_ansible.po.time_stamp
307
275
  - locale/zh_CN/LC_MESSAGES/foreman_ansible.mo
308
- - locale/zh_CN/foreman_ansible.edit.po
309
276
  - locale/zh_CN/foreman_ansible.po
310
- - locale/zh_CN/foreman_ansible.po.time_stamp
311
277
  - locale/zh_TW/LC_MESSAGES/foreman_ansible.mo
312
- - locale/zh_TW/foreman_ansible.edit.po
313
278
  - locale/zh_TW/foreman_ansible.po
314
- - locale/zh_TW/foreman_ansible.po.time_stamp
315
279
  - package.json
316
280
  - test/factories/ansible_proxy.rb
317
281
  - test/factories/ansible_roles.rb
@@ -384,7 +348,6 @@ files:
384
348
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js
385
349
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss
386
350
  - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js
387
- - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig
388
351
  - webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js
389
352
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js
390
353
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js
@@ -505,7 +468,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
505
468
  - !ruby/object:Gem::Version
506
469
  version: '0'
507
470
  requirements: []
508
- rubygems_version: 3.3.26
471
+ rubygems_version: 3.1.4
509
472
  signing_key:
510
473
  specification_version: 4
511
474
  summary: Ansible integration with Foreman (theforeman.org)
@@ -520,23 +483,31 @@ test_files:
520
483
  - test/fixtures/sample_playbooks.json
521
484
  - test/fixtures/report.json
522
485
  - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
486
+ - test/functional/ansible_roles_controller_test.rb
487
+ - test/functional/ansible_variables_controller_test.rb
523
488
  - test/functional/api/v2/ansible_playbooks_controller_test.rb
524
489
  - test/functional/api/v2/ansible_roles_controller_test.rb
525
490
  - test/functional/api/v2/ansible_variables_controller_test.rb
526
491
  - test/functional/api/v2/hostgroups_controller_test.rb
527
492
  - test/functional/api/v2/hosts_controller_test.rb
528
493
  - 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
494
  - test/functional/hosts_controller_test.rb
532
495
  - test/functional/ui_ansible_roles_controller_test.rb
533
496
  - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
534
497
  - test/graphql/queries/ansible_roles_query_test.rb
535
498
  - test/graphql/queries/host_ansible_roles_query_test.rb
499
+ - test/test_plugin_helper.rb
500
+ - test/unit/ansible_role_test.rb
501
+ - test/unit/ansible_variable_test.rb
502
+ - test/unit/concerns/config_reports_extensions_test.rb
536
503
  - test/unit/concerns/host_managed_extensions_test.rb
537
504
  - test/unit/concerns/hostgroup_extensions_test.rb
538
- - test/unit/concerns/config_reports_extensions_test.rb
539
505
  - test/unit/helpers/ansible_reports_helper_test.rb
506
+ - test/unit/host_ansible_role_test.rb
507
+ - test/unit/hostgroup_ansible_role_test.rb
508
+ - test/unit/ignore_roles_test.rb
509
+ - test/unit/import_playbooks_test.rb
510
+ - test/unit/import_roles_and_variables.rb
540
511
  - test/unit/lib/proxy_api/ansible_test.rb
541
512
  - test/unit/services/ansible_report_importer_test.rb
542
513
  - test/unit/services/ansible_variables_importer_test.rb
@@ -546,13 +517,5 @@ test_files:
546
517
  - test/unit/services/override_resolver_test.rb
547
518
  - test/unit/services/roles_importer_test.rb
548
519
  - 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
520
  - test/unit/ansible_provider_test.rb
557
- - test/test_plugin_helper.rb
558
521
  - test/integration/hostgroup_js_test.rb