foreman_ansible 7.1.8 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_ansible/api/v2/hostgroups_controller_extensions.rb +5 -1
- data/app/controllers/foreman_ansible/api/v2/hosts_controller_extensions.rb +3 -1
- data/app/helpers/foreman_ansible/ansible_reports_helper.rb +4 -0
- data/app/helpers/foreman_ansible/hosts_helper.rb +19 -0
- data/app/services/foreman_ansible/variables_importer.rb +9 -9
- data/app/views/api/v2/hostgroups/ansible_roles.json.rabl +9 -1
- data/app/views/api/v2/hosts/ansible_roles.json.rabl +9 -1
- data/lib/foreman_ansible/engine.rb +0 -1
- data/lib/foreman_ansible/register.rb +5 -1
- data/lib/foreman_ansible/version.rb +1 -1
- data/locale/action_names.rb +4 -3
- data/locale/ca/foreman_ansible.edit.po +1162 -0
- data/locale/ca/foreman_ansible.po +360 -45
- data/locale/ca/foreman_ansible.po.time_stamp +0 -0
- data/locale/cs_CZ/foreman_ansible.edit.po +1207 -0
- data/locale/cs_CZ/foreman_ansible.po +372 -57
- data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
- data/locale/de/foreman_ansible.edit.po +1148 -0
- data/locale/de/foreman_ansible.po +355 -40
- data/locale/de/foreman_ansible.po.time_stamp +0 -0
- data/locale/en/foreman_ansible.edit.po +1146 -0
- data/locale/en/foreman_ansible.po +355 -40
- data/locale/en/foreman_ansible.po.time_stamp +0 -0
- data/locale/en_GB/foreman_ansible.edit.po +1155 -0
- data/locale/en_GB/foreman_ansible.po +357 -42
- data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
- data/locale/es/foreman_ansible.edit.po +1148 -0
- data/locale/es/foreman_ansible.po +355 -40
- data/locale/es/foreman_ansible.po.time_stamp +0 -0
- data/locale/foreman_ansible.pot +767 -263
- data/locale/fr/foreman_ansible.edit.po +1148 -0
- data/locale/fr/foreman_ansible.po +355 -40
- data/locale/fr/foreman_ansible.po.time_stamp +0 -0
- data/locale/gl/foreman_ansible.edit.po +1156 -0
- data/locale/gl/foreman_ansible.po +358 -43
- data/locale/gl/foreman_ansible.po.time_stamp +0 -0
- data/locale/it/foreman_ansible.edit.po +1148 -0
- data/locale/it/foreman_ansible.po +355 -40
- data/locale/it/foreman_ansible.po.time_stamp +0 -0
- data/locale/ja/foreman_ansible.edit.po +1148 -0
- data/locale/ja/foreman_ansible.po +355 -40
- data/locale/ja/foreman_ansible.po.time_stamp +0 -0
- data/locale/ko/foreman_ansible.edit.po +1148 -0
- data/locale/ko/foreman_ansible.po +355 -40
- data/locale/ko/foreman_ansible.po.time_stamp +0 -0
- data/locale/nl_NL/foreman_ansible.edit.po +1168 -0
- data/locale/nl_NL/foreman_ansible.po +359 -44
- data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
- data/locale/pl/foreman_ansible.edit.po +1180 -0
- data/locale/pl/foreman_ansible.po +363 -48
- data/locale/pl/foreman_ansible.po.time_stamp +0 -0
- data/locale/pt_BR/foreman_ansible.edit.po +1148 -0
- data/locale/pt_BR/foreman_ansible.po +355 -40
- data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
- data/locale/ru/foreman_ansible.edit.po +1149 -0
- data/locale/ru/foreman_ansible.po +355 -40
- data/locale/ru/foreman_ansible.po.time_stamp +0 -0
- data/locale/sv_SE/foreman_ansible.edit.po +1180 -0
- data/locale/sv_SE/foreman_ansible.po +363 -48
- data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
- data/locale/zh_CN/foreman_ansible.edit.po +1148 -0
- data/locale/zh_CN/foreman_ansible.po +355 -40
- data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
- data/locale/zh_TW/foreman_ansible.edit.po +1148 -0
- data/locale/zh_TW/foreman_ansible.po +355 -40
- data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
- data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTableHelper.js +4 -13
- data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverrides.test.js +1 -3
- data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +151 -0
- data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +11 -1
- data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js +8 -10
- data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js +1 -1
- data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +10 -1
- data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/EditRoles.test.js +1 -2
- data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.fixtures.js +30 -0
- data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.test.js +1 -3
- data/webpack/components/AnsibleHostDetail/components/RolesTab/index.js +2 -26
- data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +3 -12
- data/webpack/components/AnsibleRolesSwitcher/components/OrderedRolesTooltip.js +11 -12
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap +6 -20
- data/webpack/graphql/queries/allAnsibleRoles.gql +3 -0
- data/webpack/graphql/queries/hostAnsibleRoles.gql +3 -0
- data/webpack/testHelper.js +3 -12
- metadata +82 -45
- data/app/helpers/foreman_ansible/hosts_helper_extensions.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b85dc5fe69b87ea05703f75380a2387deb64674755903ec03c3cb55dcc3bdb
|
4
|
+
data.tar.gz: ece7521c8b3f6da727abd6abad8be7384701a1598f6601dc5baf0b1f579931df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f72ecf4fc7949815787bd4b93c1da3ee7df5baf2c2266950ddc6bd01b701ae38559896ae45b11995fa3574c84f041e01d7caf41ba1e18ba4b9c0c2cea397b752
|
7
|
+
data.tar.gz: cee830b49ad5443db42d34e6e0910e0783b2d116f91b02745a8556e184b4e66535c3620b4e9c15b4329a35286d117df51a0bba3e7d7ae818ab1016a63636e61c
|
@@ -46,7 +46,11 @@ module ForemanAnsible
|
|
46
46
|
find_resource
|
47
47
|
return unless @hostgroup
|
48
48
|
|
49
|
-
@
|
49
|
+
@inherited_ansible_roles = @hostgroup.inherited_ansible_roles
|
50
|
+
@directly_assigned_roles = @hostgroup.ansible_roles
|
51
|
+
@ansible_roles = (
|
52
|
+
@directly_assigned_roles + @inherited_ansible_roles + @hostgroup.host_ansible_roles
|
53
|
+
).uniq
|
50
54
|
end
|
51
55
|
|
52
56
|
api :POST, '/hostgroups/:id/assign_ansible_roles',
|
@@ -49,7 +49,9 @@ module ForemanAnsible
|
|
49
49
|
def ansible_roles
|
50
50
|
return unless @host
|
51
51
|
|
52
|
-
@
|
52
|
+
@inherited_ansible_roles = @host.inherited_ansible_roles
|
53
|
+
@directly_assigned_roles = @host.ansible_roles
|
54
|
+
@ansible_roles = (@directly_assigned_roles + @inherited_ansible_roles).uniq
|
53
55
|
end
|
54
56
|
|
55
57
|
api :POST, '/hosts/:id/assign_ansible_roles',
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanAnsible
|
4
|
+
module HostsHelper
|
5
|
+
def ansible_hosts_multiple_actions
|
6
|
+
return [] unless User.current.can?(:create_job_invocations) &&
|
7
|
+
User.current.can?(:play_roles_on_host)
|
8
|
+
|
9
|
+
[{ action: [_('Run all Ansible roles'),
|
10
|
+
multiple_play_roles_hosts_path,
|
11
|
+
false], priority: 1000 }]
|
12
|
+
end
|
13
|
+
|
14
|
+
def ansible_roles_present?(host)
|
15
|
+
host.ansible_roles.present? ||
|
16
|
+
host.inherited_ansible_roles.present?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -31,14 +31,12 @@ module ForemanAnsible
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def import_variables(role_variables, new_roles)
|
34
|
-
detect_changes(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end.select(&:present?).flatten.compact
|
41
|
-
)
|
34
|
+
detect_changes(role_variables.map do |role_name, variables|
|
35
|
+
next if variables.blank?
|
36
|
+
role = import_new_role(role_name, new_roles)
|
37
|
+
next if role.blank?
|
38
|
+
initialize_variables(variables, role)
|
39
|
+
end.select(&:present?).flatten.compact)
|
42
40
|
end
|
43
41
|
|
44
42
|
def import_variables_roles(roles)
|
@@ -96,7 +94,9 @@ module ForemanAnsible
|
|
96
94
|
persisted, changes[:new] = imported.partition { |var| var.id.present? }
|
97
95
|
changed, _old = persisted.partition(&:changed?)
|
98
96
|
_overriden, changes[:update] = changed.partition(&:override?)
|
99
|
-
changes[:obsolete] = AnsibleVariable.where.not(:
|
97
|
+
changes[:obsolete] = AnsibleVariable.where.not(id: persisted.pluck(:id)).
|
98
|
+
where.not(imported: false)
|
99
|
+
|
100
100
|
changes
|
101
101
|
end
|
102
102
|
|
@@ -2,4 +2,12 @@
|
|
2
2
|
|
3
3
|
collection @ansible_roles
|
4
4
|
|
5
|
-
|
5
|
+
extends 'api/v2/ansible_roles/show'
|
6
|
+
|
7
|
+
node :inherited do |role|
|
8
|
+
@inherited_ansible_roles.include?(role)
|
9
|
+
end
|
10
|
+
|
11
|
+
node :directly_assigned do |role|
|
12
|
+
@directly_assigned_roles.include?(role)
|
13
|
+
end
|
@@ -2,4 +2,12 @@
|
|
2
2
|
|
3
3
|
collection @ansible_roles
|
4
4
|
|
5
|
-
|
5
|
+
extends 'api/v2/ansible_roles/show'
|
6
|
+
|
7
|
+
node :inherited do |role|
|
8
|
+
@inherited_ansible_roles.include?(role)
|
9
|
+
end
|
10
|
+
|
11
|
+
node :directly_assigned do |role|
|
12
|
+
@directly_assigned_roles.include?(role)
|
13
|
+
end
|
@@ -67,7 +67,6 @@ module ForemanAnsible
|
|
67
67
|
config.to_prepare do
|
68
68
|
::Host::Managed.prepend ForemanAnsible::HostManagedExtensions
|
69
69
|
::Hostgroup.include ForemanAnsible::HostgroupExtensions
|
70
|
-
::HostsHelper.include ForemanAnsible::HostsHelperExtensions
|
71
70
|
::HostsController.include ForemanAnsible::Concerns::HostsControllerExtensions
|
72
71
|
::Api::V2::HostsController.include ForemanAnsible::Api::V2::HostsControllerExtensions
|
73
72
|
::Api::V2::HostsController.include ForemanAnsible::Api::V2::HostsParamGroupExtensions
|
@@ -187,7 +187,7 @@ Foreman::Plugin.register :foreman_ansible do
|
|
187
187
|
|
188
188
|
register_global_js_file 'global'
|
189
189
|
|
190
|
-
extend_graphql_type :type => ::Types::Host do
|
190
|
+
extend_graphql_type :type => '::Types::Host' do
|
191
191
|
field :all_ansible_roles, ::Types::InheritedAnsibleRole.connection_type, :null => true, :method => :present_all_ansible_roles
|
192
192
|
field :own_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
|
193
193
|
field :available_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
|
@@ -236,4 +236,8 @@ Foreman::Plugin.register :foreman_ansible do
|
|
236
236
|
register_report_scanner ForemanAnsible::AnsibleReportScanner
|
237
237
|
register_report_origin 'Ansible', 'ConfigReport'
|
238
238
|
end
|
239
|
+
|
240
|
+
describe_host do
|
241
|
+
multiple_actions_provider :ansible_hosts_multiple_actions
|
242
|
+
end
|
239
243
|
end
|
data/locale/action_names.rb
CHANGED