foreman_ansible 6.3.1 → 6.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3986780692ba4ebf7918705dc78a06b637e5032371de0b0ed29b74d312ce42ed
4
- data.tar.gz: 852691a29487743f21a60c259e3dcbcfbea488df3bbe634b77712e3968090e67
3
+ metadata.gz: 49f289f46429611b1f8d183bab027589b46367fca60323c57e5370848ad12b7a
4
+ data.tar.gz: 887cf57c344a0f2a4baf1ee8fb6ae3be635ac9ab5e3073adf88e797a8eaca51f
5
5
  SHA512:
6
- metadata.gz: b1987573ed7c1b76377ac756e2d4f01b65f84dd30f0e7d536e12c35f53724a94526701f9f6f179b5af765353ddd087579df62ebbe4b7dcc35f0436cc9834db2f
7
- data.tar.gz: 6ad6a28153b718cdd9cbc251c53901072c4413df3fb82d25065c6014ba67124525c1151250954a5fe8c0dd4d081b7e3b1d515c9c38c4f7d57f5f0eeccaccd172
6
+ metadata.gz: 38061c87845fdd6d73817ba6b3e60a6470fb72302f731600fe06360dd7ce5593775dabb71c3d1414fe00ebd5711640250302bd3f5ef831699847d4d3b8987cf5
7
+ data.tar.gz: 9c79bd81e50619cbc49ad5b80a93a9702144b21eed1a39b3d0988e949f594a04e2e9bed73700eb090a4b17eb6580d6996f6b440f3e0a10286f3d7880c4b25617
@@ -2,22 +2,22 @@
2
2
 
3
3
  module ForemanAnsible
4
4
  module AnsibleRolesDataPreparations
5
- VARIABLE_ACTION_NAMES = { 'new' => N_('Add'), 'obsolete' => N_('Remove'), 'update' => N_('Update') }.freeze
6
- ROLE_ACTION_NAMES = { 'new' => N_('Import Role'), 'obsolete' => N_('Remove Role'), 'old' => N_('Update Role Variables') }.freeze
5
+ VARIABLE_ACTION_NAMES = { 'new' => _('Add'), 'obsolete' => _('Remove'), 'update' => _('Update') }.freeze
6
+ ROLE_ACTION_NAMES = { 'new' => _('Import Role'), 'obsolete' => _('Remove Role'), 'old' => _('Update Role Variables') }.freeze
7
7
 
8
- def get_variable_action(kind)
9
- _(VARIABLE_ACTION_NAMES[kind])
8
+ def variable_action_name(kind)
9
+ VARIABLE_ACTION_NAMES[kind]
10
10
  end
11
11
 
12
- def get_role_action(kind)
13
- _(ROLE_ACTION_NAMES[kind])
12
+ def role_action_name(kind)
13
+ ROLE_ACTION_NAMES[kind]
14
14
  end
15
15
 
16
16
  def get_old_roles_variables(imported_variables, role)
17
- variables = { 'Add' => [], 'Remove' => [], 'Update' => [] }
17
+ variables = { 'new' => [], 'obsolete' => [], 'update' => [] }
18
18
  imported_variables.each do |kind, temp_variables|
19
19
  temp_variables.each do |temp_variable|
20
- variables[get_variable_action(kind)].append(temp_variable.key) if temp_variable.ansible_role_id == role.id
20
+ variables[kind].append(temp_variable.key) if temp_variable.ansible_role_id == role.id
21
21
  end
22
22
  end
23
23
  variables
@@ -26,16 +26,16 @@ module ForemanAnsible
26
26
  def variables_to_s(variables)
27
27
  str = ''
28
28
  variables.each do |action, temp_variables|
29
- str += "#{action}: #{temp_variables.size}, " unless temp_variables.empty?
29
+ str += "#{variable_action_name action}: #{temp_variables.size}, " unless temp_variables.empty?
30
30
  end
31
31
  str[0..-3]
32
32
  end
33
33
 
34
34
  def get_roles_variables(imported_variables, variables_importer, kind, role)
35
35
  if kind == 'new'
36
- variables = { 'Add' => variables_importer.get_variables_names(role.name) }
36
+ variables = { 'new' => variables_importer.get_variables_names(role.name) }
37
37
  elsif kind == 'obsolete'
38
- variables = { 'Remove' => role.ansible_variables.map(&:key) }
38
+ variables = { 'obsolete' => role.ansible_variables.map(&:key) }
39
39
  elsif kind == 'old'
40
40
  variables = get_old_roles_variables(imported_variables, role)
41
41
  end
@@ -51,24 +51,25 @@ module ForemanAnsible
51
51
  match.to_s.empty? ? nil : match
52
52
  end
53
53
 
54
- def prepare_api_row(role, kind, variables, role_action)
54
+ def prepare_api_row(role, kind, variables)
55
55
  {
56
56
  name: role.name,
57
57
  id: role.id,
58
- role_action: role_action,
58
+ role_action: role_action_name(kind),
59
59
  variables: variables,
60
- hosts_count: role_action == 'Remove Role' ? role.hosts.count : '',
61
- hostgroup_count: role_action == 'Remove Role' ? role.hostgroups.count : '',
60
+ hosts_count: kind == 'obsolete' ? role.hosts.count : '',
61
+ hostgroup_count: kind == 'obsolete' ? role.hostgroups.count : '',
62
62
  kind: kind
63
63
  }
64
64
  end
65
65
 
66
- def prepare_ui_row(role, kind, variables, role_action)
66
+ def prepare_ui_row(role, kind, variables)
67
67
  { cells: [
68
68
  role.name,
69
- role_action, variables,
70
- role_action == 'Remove Role' ? role.hosts.count : '',
71
- role_action == 'Remove Role' ? role.hostgroups.count : ''
69
+ role_action_name(kind),
70
+ variables,
71
+ kind == 'obsolete' ? role.hosts.count : '',
72
+ kind == 'obsolete' ? role.hostgroups.count : ''
72
73
  ],
73
74
  role: role, kind: kind, id: role.name }
74
75
  end
@@ -81,11 +82,10 @@ module ForemanAnsible
81
82
  next if role_match_excluded_roles(role.name)
82
83
  variables = get_roles_variables(imported_variables, variables_importer, kind, role)
83
84
  next if variables.empty? && kind['old']
84
- role_action = get_role_action(kind)
85
85
  if is_ui
86
- rows.append(prepare_ui_row(role, kind, variables, role_action))
86
+ rows.append(prepare_ui_row(role, kind, variables))
87
87
  else
88
- rows.append(prepare_api_row(role, kind, variables, role_action))
88
+ rows.append(prepare_api_row(role, kind, variables))
89
89
  end
90
90
  end
91
91
  end
@@ -76,9 +76,10 @@ Foreman::Plugin.register :foreman_ansible do
76
76
 
77
77
  role 'Ansible Roles Manager',
78
78
  [:play_roles_on_host, :play_roles_on_hostgroup,
79
+ :create_job_invocations, :view_job_templates, # to allow the play_roles
80
+ :create_template_invocations, :view_smart_proxies, # ...
79
81
  :view_ansible_roles, :destroy_ansible_roles,
80
- :import_ansible_roles,
81
- :view_ansible_variables,
82
+ :import_ansible_roles, :view_ansible_variables,
82
83
  :create_ansible_variables, :import_ansible_variables,
83
84
  :edit_ansible_variables, :destroy_ansible_variables]
84
85
 
@@ -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 = '6.3.1'
7
+ VERSION = '6.3.2'
8
8
  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: 6.3.1
4
+ version: 6.3.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: 2021-07-12 00:00:00.000000000 Z
11
+ date: 2021-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman_ansible_core
@@ -389,54 +389,54 @@ required_rubygems_version: !ruby/object:Gem::Requirement
389
389
  - !ruby/object:Gem::Version
390
390
  version: '0'
391
391
  requirements: []
392
- rubygems_version: 3.1.6
392
+ rubygems_version: 3.1.2
393
393
  signing_key:
394
394
  specification_version: 4
395
395
  summary: Ansible integration with Foreman (theforeman.org)
396
396
  test_files:
397
- - test/functional/ansible_variables_controller_test.rb
397
+ - test/factories/ansible_proxy.rb
398
+ - test/factories/ansible_variables.rb
399
+ - test/factories/ansible_roles.rb
400
+ - test/factories/host_ansible_enhancements.rb
401
+ - test/fixtures/insights_playbook.yaml
402
+ - test/fixtures/report.json
403
+ - test/fixtures/sample_facts.json
398
404
  - test/functional/ansible_roles_controller_test.rb
405
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
399
406
  - test/functional/api/v2/ansible_variables_controller_test.rb
400
- - test/functional/api/v2/ansible_roles_controller_test.rb
401
407
  - test/functional/api/v2/hostgroups_controller_test.rb
402
- - test/functional/api/v2/ansible_inventories_controller_test.rb
403
408
  - test/functional/api/v2/hosts_controller_test.rb
409
+ - test/functional/api/v2/ansible_roles_controller_test.rb
404
410
  - test/functional/ui_ansible_roles_controller_test.rb
411
+ - test/functional/ansible_variables_controller_test.rb
405
412
  - test/functional/hosts_controller_test.rb
406
- - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
413
+ - test/test_plugin_helper.rb
407
414
  - test/unit/actions/run_ansible_job_test.rb
408
415
  - test/unit/actions/run_proxy_ansible_command_test.rb
409
- - test/unit/services/api_roles_importer_test.rb
410
- - test/unit/services/ui_roles_importer_test.rb
411
- - test/unit/services/structured_fact_importer_test.rb
412
- - test/unit/services/ansible_report_importer_test.rb
413
- - test/unit/services/insights_plan_runner_test.rb
414
- - test/unit/services/fact_importer_test.rb
415
- - test/unit/services/fact_parser_test.rb
416
- - test/unit/services/roles_importer_test.rb
417
- - test/unit/services/fact_sparser_test.rb
418
- - test/unit/services/inventory_creator_test.rb
419
- - test/unit/services/ansible_variables_importer_test.rb
416
+ - test/unit/ansible_role_test.rb
417
+ - test/unit/ansible_variable_test.rb
418
+ - test/unit/concerns/config_reports_extensions_test.rb
419
+ - test/unit/concerns/host_managed_extensions_test.rb
420
+ - test/unit/concerns/hostgroup_extensions_test.rb
421
+ - test/unit/helpers/ansible_reports_helper_test.rb
420
422
  - test/unit/lib/foreman_ansible_core/command_creator_test.rb
421
423
  - test/unit/lib/foreman_ansible_core/ansible_runner_test.rb
422
424
  - test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
423
425
  - test/unit/lib/proxy_api/ansible_test.rb
424
- - test/unit/ansible_role_test.rb
425
- - test/unit/hostgroup_ansible_role_test.rb
426
- - test/unit/ansible_variable_test.rb
427
- - test/unit/host_ansible_role_test.rb
428
- - test/unit/helpers/ansible_reports_helper_test.rb
426
+ - test/unit/services/ansible_report_importer_test.rb
427
+ - test/unit/services/fact_importer_test.rb
428
+ - test/unit/services/fact_sparser_test.rb
429
+ - test/unit/services/insights_plan_runner_test.rb
430
+ - test/unit/services/roles_importer_test.rb
431
+ - test/unit/services/structured_fact_importer_test.rb
432
+ - test/unit/services/ansible_variables_importer_test.rb
433
+ - test/unit/services/ui_roles_importer_test.rb
434
+ - test/unit/services/api_roles_importer_test.rb
435
+ - test/unit/services/fact_parser_test.rb
436
+ - test/unit/services/inventory_creator_test.rb
429
437
  - test/unit/ansible_provider_test.rb
430
- - test/unit/ignore_roles_test.rb
438
+ - test/unit/host_ansible_role_test.rb
431
439
  - test/unit/import_roles_and_variables.rb
432
- - test/unit/concerns/config_reports_extensions_test.rb
433
- - test/unit/concerns/host_managed_extensions_test.rb
434
- - test/unit/concerns/hostgroup_extensions_test.rb
435
- - test/factories/ansible_proxy.rb
436
- - test/factories/host_ansible_enhancements.rb
437
- - test/factories/ansible_variables.rb
438
- - test/factories/ansible_roles.rb
439
- - test/fixtures/report.json
440
- - test/fixtures/sample_facts.json
441
- - test/fixtures/insights_playbook.yaml
442
- - test/test_plugin_helper.rb
440
+ - test/unit/ignore_roles_test.rb
441
+ - test/unit/hostgroup_ansible_role_test.rb
442
+ - test/foreman_ansible/helpers/ansible_roles_helper_test.rb