foreman_ansible 6.0.2 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/ansible_roles_controller.rb +12 -8
  3. data/app/controllers/ansible_variables_controller.rb +4 -0
  4. data/app/controllers/api/v2/ansible_inventories_controller.rb +2 -2
  5. data/app/controllers/api/v2/ansible_roles_controller.rb +32 -11
  6. data/app/controllers/api/v2/ansible_variables_controller.rb +6 -4
  7. data/app/controllers/foreman_ansible/concerns/import_controller_helper.rb +3 -3
  8. data/app/helpers/foreman_ansible/ansible_reports_helper.rb +42 -56
  9. data/app/helpers/foreman_ansible/ansible_roles_data_preparations.rb +95 -0
  10. data/app/helpers/foreman_ansible/ansible_roles_helper.rb +20 -1
  11. data/app/jobs/sync_roles_and_variables.rb +20 -0
  12. data/app/models/concerns/foreman_ansible/host_managed_extensions.rb +10 -7
  13. data/app/models/concerns/foreman_ansible/hostgroup_extensions.rb +19 -4
  14. data/app/models/foreman_ansible/ansible_provider.rb +52 -2
  15. data/app/models/host_ansible_role.rb +1 -0
  16. data/app/models/hostgroup_ansible_role.rb +1 -0
  17. data/app/models/setting/ansible.rb +9 -0
  18. data/app/services/foreman_ansible/ansible_report_importer.rb +4 -0
  19. data/app/services/foreman_ansible/ansible_report_scanner.rb +15 -1
  20. data/app/services/foreman_ansible/api_roles_importer.rb +23 -11
  21. data/app/services/foreman_ansible/fact_parser.rb +21 -1
  22. data/app/services/foreman_ansible/import_roles_and_variables_error_notification.rb +31 -0
  23. data/app/services/foreman_ansible/import_roles_and_variables_success_notification.rb +26 -0
  24. data/app/services/foreman_ansible/inventory_creator.rb +3 -7
  25. data/app/services/foreman_ansible/operating_system_parser.rb +8 -2
  26. data/app/services/foreman_ansible/roles_importer.rb +3 -2
  27. data/app/services/foreman_ansible/ui_roles_importer.rb +2 -2
  28. data/app/services/foreman_ansible/variables_importer.rb +36 -1
  29. data/app/views/ansible_roles/import.html.erb +10 -50
  30. data/app/views/ansible_variables/index.html.erb +1 -2
  31. data/app/views/api/v2/ansible_roles/sync.json.rabl +5 -0
  32. data/app/views/foreman_ansible/ansible_roles/_select_tab_content.html.erb +8 -17
  33. data/app/views/foreman_ansible/config_reports/_ansible.html.erb +24 -8
  34. data/app/views/foreman_ansible/job_templates/ansible_collections_-_install_from_galaxy.erb +28 -0
  35. data/app/views/foreman_ansible/job_templates/ansible_roles_-_ansible_default.erb +4 -0
  36. data/app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_galaxy.erb +1 -1
  37. data/app/views/foreman_ansible/job_templates/capsule_upgrade_-_ansible_default.erb +2 -3
  38. data/app/views/foreman_ansible/job_templates/convert_to_rhel.erb +44 -0
  39. data/config/routes.rb +5 -4
  40. data/db/migrate/20210120150019_add_position_to_ansible_role.rb +27 -0
  41. data/db/seeds.d/100_common_parameters.rb +7 -0
  42. data/db/seeds.d/90_notification_blueprints.rb +19 -1
  43. data/lib/foreman_ansible/engine.rb +1 -1
  44. data/lib/foreman_ansible/register.rb +7 -5
  45. data/lib/foreman_ansible/version.rb +1 -1
  46. data/locale/ca/LC_MESSAGES/foreman_ansible.mo +0 -0
  47. data/locale/ca/foreman_ansible.po +1 -1
  48. data/locale/cs_CZ/LC_MESSAGES/foreman_ansible.mo +0 -0
  49. data/locale/cs_CZ/foreman_ansible.po +1 -1
  50. data/locale/de/LC_MESSAGES/foreman_ansible.mo +0 -0
  51. data/locale/de/foreman_ansible.po +1 -1
  52. data/locale/en/LC_MESSAGES/foreman_ansible.mo +0 -0
  53. data/locale/en/foreman_ansible.po +1 -1
  54. data/locale/en_GB/LC_MESSAGES/foreman_ansible.mo +0 -0
  55. data/locale/en_GB/foreman_ansible.po +1 -1
  56. data/locale/es/LC_MESSAGES/foreman_ansible.mo +0 -0
  57. data/locale/es/foreman_ansible.po +1 -1
  58. data/locale/fr/LC_MESSAGES/foreman_ansible.mo +0 -0
  59. data/locale/fr/foreman_ansible.po +1 -1
  60. data/locale/gl/LC_MESSAGES/foreman_ansible.mo +0 -0
  61. data/locale/gl/foreman_ansible.po +1 -1
  62. data/locale/it/LC_MESSAGES/foreman_ansible.mo +0 -0
  63. data/locale/it/foreman_ansible.po +1 -1
  64. data/locale/ja/LC_MESSAGES/foreman_ansible.mo +0 -0
  65. data/locale/ja/foreman_ansible.po +1 -1
  66. data/locale/ko/LC_MESSAGES/foreman_ansible.mo +0 -0
  67. data/locale/ko/foreman_ansible.po +1 -1
  68. data/locale/nl_NL/LC_MESSAGES/foreman_ansible.mo +0 -0
  69. data/locale/nl_NL/foreman_ansible.po +1 -1
  70. data/locale/pl/LC_MESSAGES/foreman_ansible.mo +0 -0
  71. data/locale/pl/foreman_ansible.po +1 -1
  72. data/locale/pt_BR/LC_MESSAGES/foreman_ansible.mo +0 -0
  73. data/locale/pt_BR/foreman_ansible.po +1 -1
  74. data/locale/ru/LC_MESSAGES/foreman_ansible.mo +0 -0
  75. data/locale/ru/foreman_ansible.po +1 -1
  76. data/locale/sv_SE/LC_MESSAGES/foreman_ansible.mo +0 -0
  77. data/locale/sv_SE/foreman_ansible.po +1 -1
  78. data/locale/zh_CN/LC_MESSAGES/foreman_ansible.mo +0 -0
  79. data/locale/zh_CN/foreman_ansible.po +1 -1
  80. data/locale/zh_TW/LC_MESSAGES/foreman_ansible.mo +0 -0
  81. data/locale/zh_TW/foreman_ansible.po +1 -1
  82. data/package.json +13 -42
  83. data/test/factories/ansible_roles.rb +12 -0
  84. data/test/factories/host_ansible_enhancements.rb +23 -0
  85. data/test/foreman_ansible/helpers/ansible_roles_helper_test.rb +45 -0
  86. data/test/functional/ansible_variables_controller_test.rb +0 -15
  87. data/test/functional/api/v2/ansible_roles_controller_test.rb +23 -0
  88. data/test/functional/api/v2/hostgroups_controller_test.rb +5 -4
  89. data/test/functional/api/v2/hosts_controller_test.rb +9 -8
  90. data/test/functional/hosts_controller_test.rb +10 -6
  91. data/test/unit/concerns/host_managed_extensions_test.rb +17 -3
  92. data/test/unit/concerns/hostgroup_extensions_test.rb +13 -7
  93. data/test/unit/helpers/ansible_reports_helper_test.rb +4 -30
  94. data/test/unit/host_ansible_role_test.rb +2 -1
  95. data/test/unit/hostgroup_ansible_role_test.rb +2 -1
  96. data/test/unit/ignore_roles_test.rb +43 -0
  97. data/test/unit/import_roles_and_variables.rb +60 -0
  98. data/test/unit/services/ansible_variables_importer_test.rb +13 -0
  99. data/test/unit/services/api_roles_importer_test.rb +22 -5
  100. data/test/unit/services/fact_parser_test.rb +16 -0
  101. data/test/unit/services/inventory_creator_test.rb +15 -7
  102. data/test/unit/services/ui_roles_importer_test.rb +2 -2
  103. data/webpack/components/AnsibleHostDetail/AnsibleHostDetail.js +35 -0
  104. data/webpack/components/AnsibleHostDetail/AnsibleHostDetail.scss +6 -0
  105. data/webpack/components/AnsibleHostDetail/AnsibleHostDetail.test.js +14 -0
  106. data/webpack/components/AnsibleHostDetail/index.js +6 -0
  107. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.js +178 -0
  108. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.scss +9 -0
  109. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesActions.js +39 -0
  110. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesConstants.js +4 -0
  111. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesHelpers.js +11 -0
  112. data/webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesHelpers.test.js +50 -0
  113. data/webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesImport.test.js +39 -0
  114. data/webpack/components/AnsibleRolesAndVariables/__test__/__snapshots__/AnsibleRolesAndVariablesImport.test.js.snap +177 -0
  115. data/webpack/components/AnsibleRolesAndVariables/index.js +31 -0
  116. data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js +25 -27
  117. data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss +1 -1
  118. data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherActions.js +20 -14
  119. data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherConstants.js +1 -2
  120. data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherReducer.js +13 -8
  121. data/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherSelectors.js +8 -28
  122. data/webpack/components/AnsibleRolesSwitcher/__fixtures__/ansibleRolesSwitcherReducer.fixtures.js +1 -0
  123. data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcher.test.js +6 -4
  124. data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherReducer.test.js +1 -9
  125. data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcherSelectors.test.js +3 -16
  126. data/webpack/components/AnsibleRolesSwitcher/__tests__/__snapshots__/AnsibleRolesSwitcher.test.js.snap +4 -8
  127. data/webpack/components/AnsibleRolesSwitcher/__tests__/__snapshots__/AnsibleRolesSwitcherReducer.test.js.snap +8 -97
  128. data/webpack/components/AnsibleRolesSwitcher/__tests__/__snapshots__/AnsibleRolesSwitcherSelectors.test.js.snap +5 -30
  129. data/webpack/components/AnsibleRolesSwitcher/components/AnsiblePermissionDenied.test.js +1 -1
  130. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +5 -2
  131. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.test.js +1 -1
  132. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js +43 -0
  133. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.test.js +19 -0
  134. data/webpack/components/AnsibleRolesSwitcher/components/AssignedRolesList.js +63 -51
  135. data/webpack/components/AnsibleRolesSwitcher/components/AssignedRolesList.test.js +4 -1
  136. data/webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.test.js +1 -1
  137. data/webpack/components/AnsibleRolesSwitcher/components/OrderedRolesTooltip.js +23 -0
  138. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsiblePermissionDenied.test.js.snap +2 -0
  139. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRoleInputs.test.js.snap +51 -0
  140. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AssignedRolesList.test.js.snap +28 -28
  141. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap +5 -0
  142. data/webpack/components/AnsibleRolesSwitcher/index.js +4 -8
  143. data/webpack/global_index.js +12 -0
  144. data/webpack/index.js +6 -13
  145. metadata +54 -30
  146. data/app/views/ansible_variables/import.html.erb +0 -56
  147. data/test/unit/lib/foreman_ansible_core/ansible_runner_test.rb +0 -51
  148. data/test/unit/lib/foreman_ansible_core/command_creator_test.rb +0 -64
  149. data/test/unit/lib/foreman_ansible_core/playbook_runner_test.rb +0 -110
  150. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -1
  151. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
  152. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +0 -5
  153. data/webpack/test_setup.js +0 -12
@@ -8,9 +8,14 @@ exports[`AvailableRolesList should render 1`] = `
8
8
  className="sticky-pagination"
9
9
  >
10
10
  <PaginationWrapper
11
+ className=""
12
+ disableNext={false}
13
+ disablePrev={false}
11
14
  dropdownButtonId="available-ansible-roles-pagination-row-dropdown"
12
15
  itemCount={2}
13
16
  onChange={[Function]}
17
+ onPageSet={[Function]}
18
+ onPerPageSelect={[Function]}
14
19
  pagination={
15
20
  Object {
16
21
  "page": 1,
@@ -7,15 +7,13 @@ import AnsiblePermissionDenied from './components/AnsiblePermissionDenied';
7
7
  import withProtectedView from './components/withProtectedView';
8
8
  import {
9
9
  selectUnassignedRoles,
10
- selectAssignedRolesPage,
11
10
  selectAssignedRoles,
12
- selectAssignedRolesCount,
13
11
  selectResults,
14
12
  selectPaginationMemoized,
15
13
  selectItemCount,
16
14
  selectLoading,
17
- selectAssignedPagination,
18
15
  selectError,
16
+ selectToDestroyRoles,
19
17
  } from './AnsibleRolesSwitcherSelectors';
20
18
 
21
19
  const mapStateToProps = state => ({
@@ -24,11 +22,9 @@ const mapStateToProps = state => ({
24
22
  itemCount: selectItemCount(state),
25
23
  loading: selectLoading(state),
26
24
  error: selectError(state),
27
- assignedPagination: selectAssignedPagination(state),
28
- assignedRolesCount: selectAssignedRolesCount(state),
29
- assignedRoles: selectAssignedRolesPage(state),
30
- allAssignedRoles: selectAssignedRoles(state),
25
+ assignedRoles: selectAssignedRoles(state),
31
26
  unassignedRoles: selectUnassignedRoles(state),
27
+ toDestroyRoles: selectToDestroyRoles(state),
32
28
  });
33
29
 
34
30
  const mapDispatchToProps = dispatch =>
@@ -37,5 +33,5 @@ const mapDispatchToProps = dispatch =>
37
33
  export default withProtectedView(
38
34
  connect(mapStateToProps, mapDispatchToProps)(AnsibleRolesSwitcher),
39
35
  AnsiblePermissionDenied,
40
- props => props.data && props.data.canView
36
+ props => props.canView
41
37
  );
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
4
+
5
+ import AnsibleHostDetail from './components/AnsibleHostDetail';
6
+
7
+ addGlobalFill(
8
+ 'host-details-page-tabs',
9
+ 'Ansible',
10
+ <AnsibleHostDetail key="ansible-host-detail" />,
11
+ 500
12
+ );
data/webpack/index.js CHANGED
@@ -1,12 +1,10 @@
1
- import $ from 'jquery';
2
1
  import componentRegistry from 'foremanReact/components/componentRegistry';
3
2
  import injectReducer from 'foremanReact/redux/reducers/registerReducer';
4
3
  import ReportJsonViewer from './components/ReportJsonViewer';
5
4
  import AnsibleRolesSwitcher from './components/AnsibleRolesSwitcher';
5
+ import WrappedImportRolesAndVariables from './components/AnsibleRolesAndVariables';
6
6
  import reducer from './reducer';
7
7
 
8
- const { tfm } = window;
9
-
10
8
  componentRegistry.register({
11
9
  name: 'ReportJsonViewer',
12
10
  type: ReportJsonViewer,
@@ -16,14 +14,9 @@ componentRegistry.register({
16
14
  type: AnsibleRolesSwitcher,
17
15
  });
18
16
 
19
- injectReducer('foremanAnsible', reducer);
17
+ componentRegistry.register({
18
+ name: 'WrappedImportRolesAndVariables',
19
+ type: WrappedImportRolesAndVariables,
20
+ });
20
21
 
21
- tfm.initAnsibleRoleSwitcher = () => {
22
- $(document).on('ContentLoad', evt => {
23
- tfm.reactMounter.mount(
24
- 'AnsibleRolesSwitcher',
25
- '#ansible_roles_switcher',
26
- $('#ansible_roles_switcher').data('roles')
27
- );
28
- });
29
- };
22
+ injectReducer('foremanAnsible', reducer);
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2
4
+ version: 6.4.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: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: foreman_ansible_core
14
+ name: acts_as_list
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
20
- type: :development
19
+ version: 1.0.3
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: 1.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: deface
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 4.2.0
47
+ version: 4.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 4.2.0
54
+ version: 4.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: ipaddress
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -104,8 +104,10 @@ files:
104
104
  - app/controllers/ui_ansible_roles_controller.rb
105
105
  - app/helpers/foreman_ansible/ansible_plugin_helper.rb
106
106
  - app/helpers/foreman_ansible/ansible_reports_helper.rb
107
+ - app/helpers/foreman_ansible/ansible_roles_data_preparations.rb
107
108
  - app/helpers/foreman_ansible/ansible_roles_helper.rb
108
109
  - app/helpers/foreman_ansible/hosts_helper_extensions.rb
110
+ - app/jobs/sync_roles_and_variables.rb
109
111
  - app/lib/actions/foreman_ansible/helpers/play_roles_description.rb
110
112
  - app/lib/proxy_api/ansible.rb
111
113
  - app/models/ansible_role.rb
@@ -128,6 +130,8 @@ files:
128
130
  - app/services/foreman_ansible/fact_importer.rb
129
131
  - app/services/foreman_ansible/fact_parser.rb
130
132
  - app/services/foreman_ansible/fact_sparser.rb
133
+ - app/services/foreman_ansible/import_roles_and_variables_error_notification.rb
134
+ - app/services/foreman_ansible/import_roles_and_variables_success_notification.rb
131
135
  - app/services/foreman_ansible/insights_notification_builder.rb
132
136
  - app/services/foreman_ansible/insights_plan_runner.rb
133
137
  - app/services/foreman_ansible/inventory_creator.rb
@@ -144,7 +148,6 @@ files:
144
148
  - app/views/ansible_roles/welcome.html.erb
145
149
  - app/views/ansible_variables/_fields.erb
146
150
  - app/views/ansible_variables/edit.html.erb
147
- - app/views/ansible_variables/import.html.erb
148
151
  - app/views/ansible_variables/index.html.erb
149
152
  - app/views/ansible_variables/new.html.erb
150
153
  - app/views/api/v2/ansible_override_values/show.json.rabl
@@ -152,6 +155,7 @@ files:
152
155
  - app/views/api/v2/ansible_roles/index.json.rabl
153
156
  - app/views/api/v2/ansible_roles/obsolete.json.rabl
154
157
  - app/views/api/v2/ansible_roles/show.json.rabl
158
+ - app/views/api/v2/ansible_roles/sync.json.rabl
155
159
  - app/views/api/v2/ansible_variables/create.json.rabl
156
160
  - app/views/api/v2/ansible_variables/destroy.json.rabl
157
161
  - app/views/api/v2/ansible_variables/import.json.rabl
@@ -169,11 +173,13 @@ files:
169
173
  - app/views/foreman_ansible/api/v2/ansible_roles/show.json.rabl
170
174
  - app/views/foreman_ansible/config_reports/_ansible.html.erb
171
175
  - app/views/foreman_ansible/config_reports/_output.html.erb
176
+ - app/views/foreman_ansible/job_templates/ansible_collections_-_install_from_galaxy.erb
172
177
  - app/views/foreman_ansible/job_templates/ansible_roles_-_ansible_default.erb
173
178
  - app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_galaxy.erb
174
179
  - app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_git.erb
175
180
  - app/views/foreman_ansible/job_templates/capsule_upgrade_-_ansible_default.erb
176
181
  - app/views/foreman_ansible/job_templates/configure_cloud_connector_-_ansible_default.erb
182
+ - app/views/foreman_ansible/job_templates/convert_to_rhel.erb
177
183
  - app/views/foreman_ansible/job_templates/maintenance_plan.erb
178
184
  - app/views/foreman_ansible/job_templates/module_action_-_ansible_default.erb
179
185
  - app/views/foreman_ansible/job_templates/package_action_-_ansible_default.erb
@@ -200,6 +206,8 @@ files:
200
206
  - db/migrate/20190328114657_remove_top_level_ansible_variables_setting.rb
201
207
  - db/migrate/20191010074208_remove_ansible_implementation_setting.rb
202
208
  - db/migrate/20200421201839_update_ansible_inv_template_name.rb
209
+ - db/migrate/20210120150019_add_position_to_ansible_role.rb
210
+ - db/seeds.d/100_common_parameters.rb
203
211
  - db/seeds.d/62_ansible_proxy_feature.rb
204
212
  - db/seeds.d/75_job_templates.rb
205
213
  - db/seeds.d/90_notification_blueprints.rb
@@ -252,9 +260,11 @@ files:
252
260
  - test/factories/ansible_proxy.rb
253
261
  - test/factories/ansible_roles.rb
254
262
  - test/factories/ansible_variables.rb
263
+ - test/factories/host_ansible_enhancements.rb
255
264
  - test/fixtures/insights_playbook.yaml
256
265
  - test/fixtures/report.json
257
266
  - test/fixtures/sample_facts.json
267
+ - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
258
268
  - test/functional/ansible_roles_controller_test.rb
259
269
  - test/functional/ansible_variables_controller_test.rb
260
270
  - test/functional/api/v2/ansible_inventories_controller_test.rb
@@ -276,9 +286,8 @@ files:
276
286
  - test/unit/helpers/ansible_reports_helper_test.rb
277
287
  - test/unit/host_ansible_role_test.rb
278
288
  - test/unit/hostgroup_ansible_role_test.rb
279
- - test/unit/lib/foreman_ansible_core/ansible_runner_test.rb
280
- - test/unit/lib/foreman_ansible_core/command_creator_test.rb
281
- - test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
289
+ - test/unit/ignore_roles_test.rb
290
+ - test/unit/import_roles_and_variables.rb
282
291
  - test/unit/lib/proxy_api/ansible_test.rb
283
292
  - test/unit/services/ansible_report_importer_test.rb
284
293
  - test/unit/services/ansible_variables_importer_test.rb
@@ -291,9 +300,19 @@ files:
291
300
  - test/unit/services/roles_importer_test.rb
292
301
  - test/unit/services/structured_fact_importer_test.rb
293
302
  - test/unit/services/ui_roles_importer_test.rb
294
- - webpack/__mocks__/foremanReact/common/I18n.js
295
- - webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
296
- - webpack/__mocks__/foremanReact/components/common/EmptyState.js
303
+ - webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
304
+ - webpack/components/AnsibleHostDetail/AnsibleHostDetail.scss
305
+ - webpack/components/AnsibleHostDetail/AnsibleHostDetail.test.js
306
+ - webpack/components/AnsibleHostDetail/index.js
307
+ - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.js
308
+ - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.scss
309
+ - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesActions.js
310
+ - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesConstants.js
311
+ - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesHelpers.js
312
+ - webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesHelpers.test.js
313
+ - webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesImport.test.js
314
+ - webpack/components/AnsibleRolesAndVariables/__test__/__snapshots__/AnsibleRolesAndVariablesImport.test.js.snap
315
+ - webpack/components/AnsibleRolesAndVariables/index.js
297
316
  - webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js
298
317
  - webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss
299
318
  - webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcherActions.js
@@ -314,21 +333,25 @@ files:
314
333
  - webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js
315
334
  - webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.test.js
316
335
  - webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleActionButton.js
336
+ - webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
337
+ - webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.test.js
317
338
  - webpack/components/AnsibleRolesSwitcher/components/AnsibleRolesSwitcherError.js
318
339
  - webpack/components/AnsibleRolesSwitcher/components/AssignedRolesList.js
319
340
  - webpack/components/AnsibleRolesSwitcher/components/AssignedRolesList.test.js
320
341
  - webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js
321
342
  - webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.test.js
343
+ - webpack/components/AnsibleRolesSwitcher/components/OrderedRolesTooltip.js
322
344
  - webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsiblePermissionDenied.test.js.snap
323
345
  - webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap
346
+ - webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRoleInputs.test.js.snap
324
347
  - webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AssignedRolesList.test.js.snap
325
348
  - webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap
326
349
  - webpack/components/AnsibleRolesSwitcher/components/withProtectedView.js
327
350
  - webpack/components/AnsibleRolesSwitcher/index.js
328
351
  - webpack/components/ReportJsonViewer.js
352
+ - webpack/global_index.js
329
353
  - webpack/index.js
330
354
  - webpack/reducer.js
331
- - webpack/test_setup.js
332
355
  homepage: https://github.com/theforeman/foreman_ansible
333
356
  licenses:
334
357
  - GPL-3.0
@@ -354,20 +377,21 @@ specification_version: 4
354
377
  summary: Ansible integration with Foreman (theforeman.org)
355
378
  test_files:
356
379
  - test/factories/ansible_proxy.rb
357
- - test/factories/ansible_roles.rb
358
380
  - test/factories/ansible_variables.rb
381
+ - test/factories/ansible_roles.rb
382
+ - test/factories/host_ansible_enhancements.rb
359
383
  - test/fixtures/insights_playbook.yaml
360
- - test/fixtures/report.json
361
384
  - test/fixtures/sample_facts.json
385
+ - test/fixtures/report.json
362
386
  - test/functional/ansible_roles_controller_test.rb
363
- - test/functional/ansible_variables_controller_test.rb
364
387
  - test/functional/api/v2/ansible_inventories_controller_test.rb
365
- - test/functional/api/v2/ansible_roles_controller_test.rb
366
388
  - test/functional/api/v2/ansible_variables_controller_test.rb
367
389
  - test/functional/api/v2/hostgroups_controller_test.rb
368
390
  - test/functional/api/v2/hosts_controller_test.rb
369
- - test/functional/hosts_controller_test.rb
391
+ - test/functional/api/v2/ansible_roles_controller_test.rb
370
392
  - test/functional/ui_ansible_roles_controller_test.rb
393
+ - test/functional/ansible_variables_controller_test.rb
394
+ - test/functional/hosts_controller_test.rb
371
395
  - test/test_plugin_helper.rb
372
396
  - test/unit/actions/run_ansible_job_test.rb
373
397
  - test/unit/actions/run_proxy_ansible_command_test.rb
@@ -377,21 +401,21 @@ test_files:
377
401
  - test/unit/concerns/host_managed_extensions_test.rb
378
402
  - test/unit/concerns/hostgroup_extensions_test.rb
379
403
  - test/unit/helpers/ansible_reports_helper_test.rb
380
- - test/unit/host_ansible_role_test.rb
381
- - test/unit/hostgroup_ansible_role_test.rb
382
- - test/unit/lib/foreman_ansible_core/command_creator_test.rb
383
- - test/unit/lib/foreman_ansible_core/ansible_runner_test.rb
384
- - test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
385
404
  - test/unit/lib/proxy_api/ansible_test.rb
386
405
  - test/unit/services/ansible_report_importer_test.rb
387
- - test/unit/services/ansible_variables_importer_test.rb
388
- - test/unit/services/api_roles_importer_test.rb
389
- - test/unit/services/fact_importer_test.rb
390
- - test/unit/services/fact_parser_test.rb
391
406
  - test/unit/services/fact_sparser_test.rb
392
407
  - test/unit/services/insights_plan_runner_test.rb
393
408
  - test/unit/services/roles_importer_test.rb
394
409
  - test/unit/services/structured_fact_importer_test.rb
410
+ - test/unit/services/fact_importer_test.rb
411
+ - test/unit/services/ansible_variables_importer_test.rb
395
412
  - test/unit/services/ui_roles_importer_test.rb
413
+ - test/unit/services/api_roles_importer_test.rb
414
+ - test/unit/services/fact_parser_test.rb
396
415
  - test/unit/services/inventory_creator_test.rb
397
416
  - test/unit/ansible_provider_test.rb
417
+ - test/unit/host_ansible_role_test.rb
418
+ - test/unit/hostgroup_ansible_role_test.rb
419
+ - test/unit/import_roles_and_variables.rb
420
+ - test/unit/ignore_roles_test.rb
421
+ - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
@@ -1,56 +0,0 @@
1
- <% title _("Changed Ansible variables") %>
2
- <%= form_tag confirm_import_ansible_variables_path do %>
3
- <h4><%= _("Select the changes you want to realize in Foreman") %></h4>
4
- <h6>
5
- <%= _("Toggle") %>:
6
- <%= link_to_function(icon_text("check", _("New")),
7
- "toggleCheckboxesBySelector('.variable_select_boxes_new')",
8
- :title => _("Check/Uncheck new")) %> |
9
- <%= link_to_function(icon_text("check", _("Obsolete")),
10
- "toggleCheckboxesBySelector('.variable_select_boxes_obsolete')",
11
- :title => _("Check/Uncheck obsolete")) %>
12
- <%= link_to_function(icon_text("check", _("Update")),
13
- "toggleCheckboxesBySelector('.variable_select_boxes_update')",
14
- :title => _("Check/Uncheck update")) %>
15
- </h6>
16
- <table class="<%= table_css_classes %>">
17
- <thead>
18
- <tr>
19
- <th class="ca">
20
- <%= link_to_function(icon_text("check"),
21
- "toggleCheckboxesBySelector('.variable_select_boxes')",
22
- :title => _("Check/Uncheck all")) %>
23
- </th>
24
- <th><%= _("Name") %></th>
25
- <th><%= _("Ansible role") %></th>
26
- <th class="col-md-2"><%= _("Hosts count") %></th>
27
- <th class="col-md-2"><%= _("Hostgroups count") %></th>
28
- <th><%= _("Operation") %></th>
29
- </tr>
30
- </thead>
31
- <tbody>
32
- <% changed.each do |kind, variables| %>
33
- <% variables.each do |variable| %>
34
- <tr>
35
- <td>
36
- <%= check_box_tag "changed[#{kind}][#{variable.ansible_role}][#{variable}]", variable.to_json, false, :class => "variable_select_boxes variable_select_boxes_#{kind} variable_select_boxes_variable_#{variable}" %>
37
- </td>
38
- <td>
39
- <%= link_to_function("#{variable}", "toggleCheckboxesBySelector('.variable_select_boxes_variable_#{variable}')", :title => _("Check/Uncheck all %s changes") % variable) %>
40
- </td>
41
- <td><%= variable.ansible_role %></td>
42
- <td><%= variable.ansible_role.hosts.count %></td>
43
- <td><%= variable.ansible_role.hostgroups.count %></td>
44
- <td>
45
- <%= { "new" => _("Add"), "obsolete" => _("Remove"), "update" => _("Update") }[kind] %>
46
- </td>
47
- </tr>
48
- <% end %>
49
- <% end %>
50
- </tbody>
51
- </table>
52
- <div>
53
- <%= link_to _("Cancel"), ansible_variables_path, :class => "btn btn-default" %>
54
- <%= submit_tag _("Update"), :class => "btn btn-primary" %>
55
- </div>
56
- <% end %>
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- module ForemanAnsibleCore
6
- module Runner
7
- class AnsibleRunnerTest < ActiveSupport::TestCase
8
- describe AnsibleRunner do
9
- it 'parses files without event data' do
10
- content = <<~JSON
11
- {"uuid": "a29d8592-f805-4d0e-b73d-7a53cc35a92e", "stdout": " [WARNING]: Consider using the yum module rather than running 'yum'. If you", "counter": 8, "end_line": 8, "runner_ident": "e2d9ae11-026a-4f9f-9679-401e4b852ab0", "start_line": 7, "event": "verbose"}
12
- JSON
13
-
14
- File.expects(:read).with('fake.json').returns(content)
15
- runner = AnsibleRunner.allocate
16
- runner.expects(:handle_broadcast_data)
17
- assert runner.send(:handle_event_file, 'fake.json')
18
- end
19
- end
20
-
21
- describe '#rebuild_secrets' do
22
- let(:inventory) do
23
- { 'all' => { 'hosts' => ['foreman.example.com'] },
24
- '_meta' => { 'hostvars' => { 'foreman.example.com' => {} } } }
25
- end
26
- let(:input) do
27
- host_secrets = { 'ansible_password' => 'letmein', 'ansible_become_password' => 'iamroot' }
28
- secrets = { 'per-host' => { 'foreman.example.com' => host_secrets } }
29
- host_input = { 'input' => { 'action_input' => { 'secrets' => secrets } } }
30
- { 'foreman.example.com' => host_input }
31
- end
32
- let(:runner) { ForemanAnsibleCore::Runner::AnsibleRunner.allocate }
33
-
34
- test 'uses secrets from inventory' do
35
- test_inventory = inventory.merge('ssh_password' => 'sshpass', 'effective_user_password' => 'mypass')
36
- rebuilt = runner.send(:rebuild_secrets, test_inventory, input)
37
- host_vars = rebuilt.dig('_meta', 'hostvars', 'foreman.example.com')
38
- assert_equal 'sshpass', host_vars['ansible_password']
39
- assert_equal 'mypass', host_vars['ansible_become_password']
40
- end
41
-
42
- test 'host secrets are used when not overriden by inventory secrest' do
43
- rebuilt = runner.send(:rebuild_secrets, inventory, input)
44
- host_vars = rebuilt.dig('_meta', 'hostvars', 'foreman.example.com')
45
- assert_equal 'letmein', host_vars['ansible_password']
46
- assert_equal 'iamroot', host_vars['ansible_become_password']
47
- end
48
- end
49
- end
50
- end
51
- end