foreman_ansible 9.0.0 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/concerns/foreman_ansible/hostgroup_extensions.rb +13 -0
  3. data/app/views/ansible_roles/index.html.erb +1 -1
  4. data/lib/foreman_ansible/register.rb.orig +0 -0
  5. data/lib/foreman_ansible/version.rb +1 -1
  6. data/locale/ca/foreman_ansible.edit.po +0 -0
  7. data/locale/ca/foreman_ansible.po.time_stamp +0 -0
  8. data/locale/cs_CZ/foreman_ansible.edit.po +0 -0
  9. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  10. data/locale/de/foreman_ansible.edit.po +0 -0
  11. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  12. data/locale/en/foreman_ansible.edit.po +0 -0
  13. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  14. data/locale/en_GB/foreman_ansible.edit.po +0 -0
  15. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  16. data/locale/es/foreman_ansible.edit.po +0 -0
  17. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  18. data/locale/fr/foreman_ansible.edit.po +0 -0
  19. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  20. data/locale/gl/foreman_ansible.edit.po +0 -0
  21. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  22. data/locale/it/foreman_ansible.edit.po +0 -0
  23. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  24. data/locale/ja/foreman_ansible.edit.po +0 -0
  25. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  26. data/locale/ko/foreman_ansible.edit.po +0 -0
  27. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  28. data/locale/nl_NL/foreman_ansible.edit.po +0 -0
  29. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  30. data/locale/pl/foreman_ansible.edit.po +0 -0
  31. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  32. data/locale/pt_BR/foreman_ansible.edit.po +0 -0
  33. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  34. data/locale/ru/foreman_ansible.edit.po +0 -0
  35. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  36. data/locale/sv_SE/foreman_ansible.edit.po +0 -0
  37. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  38. data/locale/zh_CN/foreman_ansible.edit.po +0 -0
  39. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  40. data/locale/zh_TW/foreman_ansible.edit.po +0 -0
  41. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  42. data/package.json +6 -6
  43. data/test/unit/concerns/hostgroup_extensions_test.rb +5 -0
  44. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +0 -0
  45. data/webpack/components/ReportJsonViewer.js +11 -1
  46. metadata +34 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df3c4d8c1514c442f1da8c0c6ef356482f5edb63ca14df0e39ef83818076f22b
4
- data.tar.gz: 253b5ef0614bb34d78ad96b7312537b496b4850ea34d6ba7a960f9df34da5e02
3
+ metadata.gz: bf08e369d1c4b9a445123a9fab3a02b1da8c3bfe9261b7027693959d90e1e1a3
4
+ data.tar.gz: 13ac8e3cb9b88bf5167a2fdeb9e95409ad9a93c6f4dce12f0500cc5c5bd787a9
5
5
  SHA512:
6
- metadata.gz: b6f8201c41db492b56888c675cb460f88e5dae92aeb808487747783ba43031961a27f66eb2df975216385b8e003d2df645f4208f0a1f0d4bec44b0c02f878984
7
- data.tar.gz: da19e080f0fa135ae2cb4757fae4a10a946989ecc953cf41eb774877b075bcfc68455707d4abc3a4265fdcb1421714572947bb14eefc709a8d825d6c23623987
6
+ metadata.gz: 8c515c517add1b91f020c63a50b6b58eaafdacfe08d52d39286ae79efd034cb8ca0ffc8ef4aa8aa2f5be9e5dcc6a797910dd9b32f444e61e525077c8239e3e56
7
+ data.tar.gz: 18fac58f8a1d119af822b6be9f28ce33b626b0951791d5c3ca201d6e2475f2399c52d21ba92b19335f267a183306e568cbc384910942f1d7d0de9d1d74a88ef2
@@ -11,6 +11,9 @@ module ForemanAnsible
11
11
  -> { order('hostgroup_ansible_roles.position ASC') },
12
12
  :through => :hostgroup_ansible_roles,
13
13
  :dependent => :destroy
14
+ scoped_search :relation => :ansible_roles, :on => :name,
15
+ :complete_value => true, :rename => :ansible_role,
16
+ :only_explicit => true, :operators => ['= ', '!= ', '~ ', '!~ '], :ext_method => :search_by_role
14
17
  accepts_nested_attributes_for :hostgroup_ansible_roles, :allow_destroy => true
15
18
  audit_associations :ansible_roles
16
19
  include_in_clone :ansible_roles
@@ -38,6 +41,16 @@ module ForemanAnsible
38
41
  (inherited_ansible_roles + ansible_roles + host_ansible_roles).uniq
39
42
  end
40
43
  end
44
+
45
+ class_methods do
46
+ def search_by_role(_key, operator, value)
47
+ conditions = sanitize_sql_for_conditions(["ansible_roles.name #{operator} ?", value_to_sql(operator, value)])
48
+ hostgroup_ids = ::Hostgroup.joins(:ansible_roles).where(conditions).map(&:subtree_ids).flatten
49
+
50
+ conds = "hostgroups.id IN(#{hostgroup_ids.join(',')})" if hostgroup_ids.present?
51
+ { conditions: conds.presence || '1 = 0' }
52
+ end
53
+ end
41
54
  end
42
55
  end
43
56
 
@@ -18,7 +18,7 @@
18
18
  <% @ansible_roles.each do |role| %>
19
19
  <tr>
20
20
  <td class="ellipsis"><%= role.name %></td>
21
- <td class="ellipsis"><%= role.hostgroups.count %></td>
21
+ <td class="ellipsis"><%= link_to role.hostgroups.count, hostgroups_path(:search => "ansible_role = #{role.name}") %></td>
22
22
  <td class="ellipsis"><%= link_to role.hosts.count, hosts_path(:search => "ansible_role = #{role.name}")%></td>
23
23
  <td class="ellipsis"><%= link_to(role.ansible_variables.count, ansible_variables_path(:search => "ansible_role = #{role}")) %></td>
24
24
  <td class="ellipsis"><%= import_time role %></td>
File without changes
@@ -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 = '9.0.0'
7
+ VERSION = '9.0.1'
8
8
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/package.json CHANGED
@@ -15,12 +15,12 @@
15
15
  "devDependencies": {
16
16
  "@babel/core": "^7.7.0",
17
17
  "@testing-library/user-event": "^13.2.1",
18
- "@theforeman/builder": "^8.4.1",
19
- "@theforeman/eslint-plugin-foreman": "^8.4.1",
20
- "@theforeman/find-foreman": "^8.4.1",
21
- "@theforeman/stories": "^8.4.1",
22
- "@theforeman/test": "^8.9.0",
23
- "@theforeman/vendor-dev": "^8.4.1",
18
+ "@theforeman/builder": "^10.0",
19
+ "@theforeman/eslint-plugin-foreman": "^10.0",
20
+ "@theforeman/find-foreman": "^10.0",
21
+ "@theforeman/stories": "^10.0",
22
+ "@theforeman/test": "^10.0",
23
+ "@theforeman/vendor-dev": "^10.0",
24
24
  "@testing-library/user-event": "^13.2.1",
25
25
  "babel-eslint": "^10.0.3",
26
26
  "eslint": "^6.7.2",
@@ -61,4 +61,9 @@ class HostgroupExtensionsTest < ActiveSupport::TestCase
61
61
  @hostgroup_parent.clone.all_ansible_roles.must_equal @hostgroup_parent.all_ansible_roles
62
62
  end
63
63
  end
64
+
65
+ test 'should find hostgroup with role' do
66
+ result = ::Hostgroup.search_for("ansible_role = #{@role1.name}").pluck(:id)
67
+ assert_include result, @hostgroup.id
68
+ end
64
69
  end
@@ -10,7 +10,17 @@ const theme = {
10
10
 
11
11
  const ReportJsonViewer = ({ data }) => (
12
12
  <div className="report-json-viewer">
13
- <JSONTree data={data} hideRoot theme={theme} />
13
+ <JSONTree
14
+ data={data}
15
+ hideRoot
16
+ theme={theme}
17
+ shouldExpandNode={(keyPath, _myData, level) =>
18
+ keyPath[0] === '_meta' ||
19
+ keyPath[0] === 'hostvars' ||
20
+ level === 3 ||
21
+ keyPath[0] === 'foreman_ansible_roles'
22
+ }
23
+ />
14
24
  </div>
15
25
  );
16
26
 
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: 9.0.0
4
+ version: 9.0.1
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: 2022-08-08 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -495,55 +495,55 @@ required_rubygems_version: !ruby/object:Gem::Requirement
495
495
  - !ruby/object:Gem::Version
496
496
  version: '0'
497
497
  requirements: []
498
- rubygems_version: 3.3.7
498
+ rubygems_version: 3.1.6
499
499
  signing_key:
500
500
  specification_version: 4
501
501
  summary: Ansible integration with Foreman (theforeman.org)
502
502
  test_files:
503
+ - test/factories/ansible_proxy.rb
504
+ - test/factories/ansible_roles.rb
505
+ - test/factories/ansible_variables.rb
506
+ - test/factories/host_ansible_enhancements.rb
507
+ - test/fixtures/insights_playbook.yaml
508
+ - test/fixtures/playbooks_example_output.json
509
+ - test/fixtures/report.json
510
+ - test/fixtures/sample_facts.json
511
+ - test/fixtures/sample_playbooks.json
512
+ - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
513
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
503
514
  - test/functional/api/v2/ansible_playbooks_controller_test.rb
504
- - test/functional/api/v2/hosts_controller_test.rb
505
515
  - test/functional/api/v2/ansible_roles_controller_test.rb
506
- - test/functional/api/v2/hostgroups_controller_test.rb
507
516
  - test/functional/api/v2/ansible_variables_controller_test.rb
508
- - test/functional/api/v2/ansible_inventories_controller_test.rb
509
- - test/functional/hosts_controller_test.rb
517
+ - test/functional/api/v2/hostgroups_controller_test.rb
518
+ - test/functional/api/v2/hosts_controller_test.rb
510
519
  - test/functional/ansible_roles_controller_test.rb
511
520
  - test/functional/ansible_variables_controller_test.rb
521
+ - test/functional/hosts_controller_test.rb
512
522
  - test/functional/ui_ansible_roles_controller_test.rb
513
- - test/unit/services/inventory_creator_test.rb
523
+ - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
524
+ - test/graphql/queries/ansible_roles_query_test.rb
525
+ - test/graphql/queries/host_ansible_roles_query_test.rb
526
+ - test/unit/actions/run_ansible_job_test.rb
527
+ - test/unit/actions/run_proxy_ansible_command_test.rb
528
+ - test/unit/concerns/config_reports_extensions_test.rb
529
+ - test/unit/concerns/host_managed_extensions_test.rb
530
+ - test/unit/concerns/hostgroup_extensions_test.rb
531
+ - test/unit/helpers/ansible_reports_helper_test.rb
532
+ - test/unit/lib/proxy_api/ansible_test.rb
514
533
  - test/unit/services/ansible_report_importer_test.rb
515
- - test/unit/services/ui_roles_importer_test.rb
516
- - test/unit/services/roles_importer_test.rb
517
534
  - test/unit/services/ansible_variables_importer_test.rb
518
- - test/unit/services/override_resolver_test.rb
519
535
  - test/unit/services/api_roles_importer_test.rb
520
536
  - test/unit/services/insights_plan_runner_test.rb
537
+ - test/unit/services/inventory_creator_test.rb
538
+ - test/unit/services/override_resolver_test.rb
539
+ - test/unit/services/roles_importer_test.rb
540
+ - test/unit/services/ui_roles_importer_test.rb
541
+ - test/unit/ansible_provider_test.rb
521
542
  - test/unit/ansible_role_test.rb
543
+ - test/unit/ansible_variable_test.rb
522
544
  - test/unit/host_ansible_role_test.rb
523
- - test/unit/import_playbooks_test.rb
524
545
  - test/unit/hostgroup_ansible_role_test.rb
525
- - test/unit/helpers/ansible_reports_helper_test.rb
526
- - test/unit/ansible_provider_test.rb
527
- - test/unit/concerns/host_managed_extensions_test.rb
528
- - test/unit/concerns/config_reports_extensions_test.rb
529
- - test/unit/concerns/hostgroup_extensions_test.rb
530
546
  - test/unit/ignore_roles_test.rb
531
- - test/unit/ansible_variable_test.rb
547
+ - test/unit/import_playbooks_test.rb
532
548
  - test/unit/import_roles_and_variables.rb
533
- - test/unit/lib/proxy_api/ansible_test.rb
534
- - test/unit/actions/run_ansible_job_test.rb
535
- - test/unit/actions/run_proxy_ansible_command_test.rb
536
- - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
537
549
  - test/test_plugin_helper.rb
538
- - test/factories/ansible_proxy.rb
539
- - test/factories/ansible_variables.rb
540
- - test/factories/host_ansible_enhancements.rb
541
- - test/factories/ansible_roles.rb
542
- - test/fixtures/playbooks_example_output.json
543
- - test/fixtures/report.json
544
- - test/fixtures/sample_facts.json
545
- - test/fixtures/insights_playbook.yaml
546
- - test/fixtures/sample_playbooks.json
547
- - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
548
- - test/graphql/queries/host_ansible_roles_query_test.rb
549
- - test/graphql/queries/ansible_roles_query_test.rb