foreman_ansible 6.4.1 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/ansible_inventories_controller.rb +1 -1
  3. data/app/graphql/mutations/ansible_variable_overrides/create.rb +26 -0
  4. data/app/graphql/mutations/ansible_variable_overrides/delete.rb +38 -0
  5. data/app/graphql/mutations/ansible_variable_overrides/update.rb +26 -0
  6. data/app/graphql/mutations/hosts/assign_ansible_roles.rb +37 -0
  7. data/app/graphql/presenters/ansible_role_presenter.rb +12 -0
  8. data/app/graphql/presenters/overriden_ansible_variable_presenter.rb +19 -0
  9. data/app/graphql/types/ansible_role.rb +9 -0
  10. data/app/graphql/types/ansible_variable.rb +23 -0
  11. data/app/graphql/types/ansible_variable_override.rb +9 -0
  12. data/app/graphql/types/inherited_ansible_role.rb +13 -0
  13. data/app/graphql/types/overriden_ansible_variable.rb +27 -0
  14. data/app/helpers/foreman_ansible/ansible_roles_data_preparations.rb +22 -22
  15. data/app/models/concerns/foreman_ansible/host_managed_extensions.rb +23 -4
  16. data/app/models/concerns/foreman_ansible/hostgroup_extensions.rb +2 -1
  17. data/app/models/foreman_ansible/ansible_provider.rb +7 -5
  18. data/app/services/foreman_ansible/ansible_report_importer.rb +2 -2
  19. data/app/services/foreman_ansible/inventory_creator.rb +1 -1
  20. data/app/services/foreman_ansible/override_resolver.rb +22 -0
  21. data/app/views/api/v2/ansible_override_values/index.json.rabl +3 -0
  22. data/app/views/api/v2/ansible_variables/show.json.rabl +1 -1
  23. data/app/views/foreman_ansible/ansible_roles/_hostgroup_ansible_roles_button.erb +3 -0
  24. data/app/views/foreman_ansible/job_templates/convert_to_rhel.erb +6 -2
  25. data/app/views/foreman_ansible/job_templates/run_openscap_scans_-_ansible_default.erb +20 -0
  26. data/config/routes.rb +3 -0
  27. data/db/migrate/20210818083407_fix_ansible_setting_category_to_dsl.rb +5 -0
  28. data/lib/foreman_ansible/engine.rb +0 -17
  29. data/lib/foreman_ansible/register.rb +115 -4
  30. data/lib/foreman_ansible/version.rb +1 -1
  31. data/package.json +4 -2
  32. data/test/functional/api/v2/ansible_inventories_controller_test.rb +1 -2
  33. data/test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb +96 -0
  34. data/test/graphql/queries/ansible_roles_query_test.rb +35 -0
  35. data/test/unit/ansible_provider_test.rb +3 -6
  36. data/test/unit/concerns/host_managed_extensions_test.rb +8 -0
  37. data/test/unit/concerns/hostgroup_extensions_test.rb +6 -0
  38. data/test/unit/hostgroup_ansible_role_test.rb +13 -0
  39. data/test/unit/services/override_resolver_test.rb +34 -0
  40. data/webpack/components/AnsibleHostDetail/AnsibleHostDetail.js +51 -27
  41. data/webpack/components/AnsibleHostDetail/AnsibleHostDetail.test.js +12 -6
  42. data/webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/AnsibleHostInventory.js +22 -0
  43. data/webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/AnsibleHostInventory.scss +4 -0
  44. data/webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/AnsibleHostInventory.test.js +104 -0
  45. data/webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/index.js +38 -0
  46. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverrides.scss +3 -0
  47. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTable.js +238 -0
  48. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTableHelper.js +111 -0
  49. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableAction.js +161 -0
  50. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableAction.scss +7 -0
  51. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableActionHelper.js +49 -0
  52. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableValue.js +70 -0
  53. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableValueHelper.js +35 -0
  54. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverrides.fixtures.js +429 -0
  55. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverrides.test.js +71 -0
  56. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverridesDelete.test.js +74 -0
  57. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverridesUpdate.test.js +188 -0
  58. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/index.js +58 -0
  59. data/webpack/components/AnsibleHostDetail/components/JobsTab/JobsTabHelper.js +79 -0
  60. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobHelper.js +106 -0
  61. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js +129 -0
  62. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss +7 -0
  63. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js +103 -0
  64. data/webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js +96 -0
  65. data/webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js +184 -0
  66. data/webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js +195 -0
  67. data/webpack/components/AnsibleHostDetail/components/JobsTab/index.js +88 -0
  68. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +89 -0
  69. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/index.js +80 -0
  70. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js +90 -0
  71. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesModal.scss +3 -0
  72. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesModalHelper.js +40 -0
  73. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js +82 -0
  74. data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +129 -0
  75. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/EditRoles.test.js +85 -0
  76. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.fixtures.js +180 -0
  77. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.test.js +75 -0
  78. data/webpack/components/AnsibleHostDetail/components/RolesTab/index.js +51 -0
  79. data/webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js +60 -0
  80. data/webpack/components/AnsibleHostDetail/components/TabLayout.js +12 -0
  81. data/webpack/components/AnsibleHostDetail/constants.js +9 -0
  82. data/webpack/components/AnsibleHostDetail/helpers.js +4 -0
  83. data/webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesImport.test.js +15 -10
  84. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +29 -0
  85. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.test.js +3 -0
  86. data/webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js +2 -1
  87. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap +3 -3
  88. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap +4 -0
  89. data/webpack/components/DualList/DualList.scss +3 -0
  90. data/webpack/components/DualList/ListControls.js +65 -0
  91. data/webpack/components/DualList/ListHeader.js +16 -0
  92. data/webpack/components/DualList/ListItem.js +69 -0
  93. data/webpack/components/DualList/ListPane.js +95 -0
  94. data/webpack/components/DualList/SelectedStatus.js +21 -0
  95. data/webpack/components/DualList/index.js +103 -0
  96. data/webpack/components/ErrorState.js +16 -0
  97. data/webpack/components/withLoading.js +135 -0
  98. data/webpack/components/withPagination.js +0 -0
  99. data/webpack/formHelper.js +131 -0
  100. data/webpack/globalIdHelper.js +13 -0
  101. data/webpack/global_index.js +7 -1
  102. data/webpack/graphql/mutations/assignAnsibleRoles.gql +17 -0
  103. data/webpack/graphql/mutations/cancelRecurringLogic.gql +12 -0
  104. data/webpack/graphql/mutations/createAnsibleVariableOverride.gql +28 -0
  105. data/webpack/graphql/mutations/createJobInvocation.gql +11 -0
  106. data/webpack/graphql/mutations/deleteAnsibleVariableOverride.gql +17 -0
  107. data/webpack/graphql/mutations/updateAnsibleVariableOverride.gql +29 -0
  108. data/webpack/graphql/queries/allAnsibleRoles.gql +13 -0
  109. data/webpack/graphql/queries/ansibleRoles.gql +13 -0
  110. data/webpack/graphql/queries/currentUserAttributes.gql +11 -0
  111. data/webpack/graphql/queries/hostAnsibleRoles.gql +17 -0
  112. data/webpack/graphql/queries/hostAvailableAnsibleRoles.gql +11 -0
  113. data/webpack/graphql/queries/hostVariableOverrides.gql +39 -0
  114. data/webpack/graphql/queries/recurringJobs.gql +28 -0
  115. data/webpack/helpers/pageParamsHelper.js +40 -0
  116. data/webpack/helpers/paginationHelper.js +9 -0
  117. data/webpack/permissionsHelper.js +58 -0
  118. data/webpack/routes/HostgroupJobs/__test__/HostgroupJobs.fixtures.js +63 -0
  119. data/webpack/routes/HostgroupJobs/__test__/HostgroupJobs.test.js +112 -0
  120. data/webpack/routes/HostgroupJobs/index.js +26 -0
  121. data/webpack/routes/routes.js +10 -0
  122. data/webpack/testHelper.js +165 -0
  123. data/webpack/toastHelper.js +4 -0
  124. metadata +127 -54
  125. data/app/assets/images/foreman_ansible/Ansible.png +0 -0
  126. data/app/models/foreman_ansible/fact_name.rb +0 -16
  127. data/app/models/setting/ansible.rb +0 -106
  128. data/app/services/foreman_ansible/fact_importer.rb +0 -99
  129. data/app/services/foreman_ansible/fact_parser.rb +0 -126
  130. data/app/services/foreman_ansible/fact_sparser.rb +0 -37
  131. data/app/services/foreman_ansible/operating_system_parser.rb +0 -102
  132. data/app/services/foreman_ansible/structured_fact_importer.rb +0 -25
  133. data/test/unit/services/fact_importer_test.rb +0 -52
  134. data/test/unit/services/fact_parser_test.rb +0 -281
  135. data/test/unit/services/fact_sparser_test.rb +0 -24
  136. data/test/unit/services/structured_fact_importer_test.rb +0 -30
  137. data/webpack/components/AnsibleRolesAndVariables/__test__/__snapshots__/AnsibleRolesAndVariablesImport.test.js.snap +0 -177
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.4.1
4
+ version: 7.0.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-06-25 00:00:00.000000000 Z
11
+ date: 2021-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -53,25 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.4.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: ipaddress
56
+ name: foreman-tasks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.8.0
62
- - - "<"
63
- - !ruby/object:Gem::Version
64
- version: '1.0'
61
+ version: 5.2.0
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
- version: 0.8.0
72
- - - "<"
73
- - !ruby/object:Gem::Version
74
- version: '1.0'
68
+ version: 5.2.0
75
69
  description: Ansible integration with Foreman
76
70
  email:
77
71
  - elobatocs@gmail.com
@@ -82,7 +76,6 @@ files:
82
76
  - LICENSE
83
77
  - README.md
84
78
  - Rakefile
85
- - app/assets/images/foreman_ansible/Ansible.png
86
79
  - app/assets/stylesheets/foreman_ansible/foreman-ansible.css
87
80
  - app/controllers/ansible_roles_controller.rb
88
81
  - app/controllers/ansible_variables_controller.rb
@@ -102,6 +95,17 @@ files:
102
95
  - app/controllers/foreman_ansible/concerns/import_controller_helper.rb
103
96
  - app/controllers/foreman_ansible/concerns/job_invocation_helper.rb
104
97
  - app/controllers/ui_ansible_roles_controller.rb
98
+ - app/graphql/mutations/ansible_variable_overrides/create.rb
99
+ - app/graphql/mutations/ansible_variable_overrides/delete.rb
100
+ - app/graphql/mutations/ansible_variable_overrides/update.rb
101
+ - app/graphql/mutations/hosts/assign_ansible_roles.rb
102
+ - app/graphql/presenters/ansible_role_presenter.rb
103
+ - app/graphql/presenters/overriden_ansible_variable_presenter.rb
104
+ - app/graphql/types/ansible_role.rb
105
+ - app/graphql/types/ansible_variable.rb
106
+ - app/graphql/types/ansible_variable_override.rb
107
+ - app/graphql/types/inherited_ansible_role.rb
108
+ - app/graphql/types/overriden_ansible_variable.rb
105
109
  - app/helpers/foreman_ansible/ansible_plugin_helper.rb
106
110
  - app/helpers/foreman_ansible/ansible_reports_helper.rb
107
111
  - app/helpers/foreman_ansible/ansible_roles_data_preparations.rb
@@ -115,10 +119,8 @@ files:
115
119
  - app/models/concerns/foreman_ansible/host_managed_extensions.rb
116
120
  - app/models/concerns/foreman_ansible/hostgroup_extensions.rb
117
121
  - app/models/foreman_ansible/ansible_provider.rb
118
- - app/models/foreman_ansible/fact_name.rb
119
122
  - app/models/host_ansible_role.rb
120
123
  - app/models/hostgroup_ansible_role.rb
121
- - app/models/setting/ansible.rb
122
124
  - app/overrides/ansible_roles_tab.rb
123
125
  - app/overrides/hostgroup_ansible_roles_tab.rb
124
126
  - app/overrides/hostgroup_play_roles.rb
@@ -127,20 +129,16 @@ files:
127
129
  - app/services/foreman_ansible/ansible_report_importer.rb
128
130
  - app/services/foreman_ansible/ansible_report_scanner.rb
129
131
  - app/services/foreman_ansible/api_roles_importer.rb
130
- - app/services/foreman_ansible/fact_importer.rb
131
- - app/services/foreman_ansible/fact_parser.rb
132
- - app/services/foreman_ansible/fact_sparser.rb
133
132
  - app/services/foreman_ansible/import_roles_and_variables_error_notification.rb
134
133
  - app/services/foreman_ansible/import_roles_and_variables_success_notification.rb
135
134
  - app/services/foreman_ansible/insights_notification_builder.rb
136
135
  - app/services/foreman_ansible/insights_plan_runner.rb
137
136
  - app/services/foreman_ansible/inventory_creator.rb
138
- - app/services/foreman_ansible/operating_system_parser.rb
137
+ - app/services/foreman_ansible/override_resolver.rb
139
138
  - app/services/foreman_ansible/playbook_creator.rb
140
139
  - app/services/foreman_ansible/proxy_api.rb
141
140
  - app/services/foreman_ansible/renderer_methods.rb
142
141
  - app/services/foreman_ansible/roles_importer.rb
143
- - app/services/foreman_ansible/structured_fact_importer.rb
144
142
  - app/services/foreman_ansible/ui_roles_importer.rb
145
143
  - app/services/foreman_ansible/variables_importer.rb
146
144
  - app/views/ansible_roles/import.html.erb
@@ -150,6 +148,7 @@ files:
150
148
  - app/views/ansible_variables/edit.html.erb
151
149
  - app/views/ansible_variables/index.html.erb
152
150
  - app/views/ansible_variables/new.html.erb
151
+ - app/views/api/v2/ansible_override_values/index.json.rabl
153
152
  - app/views/api/v2/ansible_override_values/show.json.rabl
154
153
  - app/views/api/v2/ansible_roles/import.json.rabl
155
154
  - app/views/api/v2/ansible_roles/index.json.rabl
@@ -186,6 +185,7 @@ files:
186
185
  - app/views/foreman_ansible/job_templates/power_action_-_ansible_default.erb
187
186
  - app/views/foreman_ansible/job_templates/puppet_run_once_-_ansible_default.erb
188
187
  - app/views/foreman_ansible/job_templates/run_command_-_ansible_default.erb
188
+ - app/views/foreman_ansible/job_templates/run_openscap_scans_-_ansible_default.erb
189
189
  - app/views/foreman_ansible/job_templates/run_playbook-ansible_default.erb
190
190
  - app/views/foreman_ansible/job_templates/service_action_-_ansible_default.erb
191
191
  - app/views/foreman_ansible/job_templates/service_action_-_enable_web_console.erb
@@ -207,6 +207,7 @@ files:
207
207
  - db/migrate/20191010074208_remove_ansible_implementation_setting.rb
208
208
  - db/migrate/20200421201839_update_ansible_inv_template_name.rb
209
209
  - db/migrate/20210120150019_add_position_to_ansible_role.rb
210
+ - db/migrate/20210818083407_fix_ansible_setting_category_to_dsl.rb
210
211
  - db/seeds.d/100_common_parameters.rb
211
212
  - db/seeds.d/62_ansible_proxy_feature.rb
212
213
  - db/seeds.d/75_job_templates.rb
@@ -274,6 +275,8 @@ files:
274
275
  - test/functional/api/v2/hosts_controller_test.rb
275
276
  - test/functional/hosts_controller_test.rb
276
277
  - test/functional/ui_ansible_roles_controller_test.rb
278
+ - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
279
+ - test/graphql/queries/ansible_roles_query_test.rb
277
280
  - test/test_plugin_helper.rb
278
281
  - test/unit/actions/run_ansible_job_test.rb
279
282
  - test/unit/actions/run_proxy_ansible_command_test.rb
@@ -292,17 +295,55 @@ files:
292
295
  - test/unit/services/ansible_report_importer_test.rb
293
296
  - test/unit/services/ansible_variables_importer_test.rb
294
297
  - test/unit/services/api_roles_importer_test.rb
295
- - test/unit/services/fact_importer_test.rb
296
- - test/unit/services/fact_parser_test.rb
297
- - test/unit/services/fact_sparser_test.rb
298
298
  - test/unit/services/insights_plan_runner_test.rb
299
299
  - test/unit/services/inventory_creator_test.rb
300
+ - test/unit/services/override_resolver_test.rb
300
301
  - test/unit/services/roles_importer_test.rb
301
- - test/unit/services/structured_fact_importer_test.rb
302
302
  - test/unit/services/ui_roles_importer_test.rb
303
303
  - webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
304
304
  - webpack/components/AnsibleHostDetail/AnsibleHostDetail.scss
305
305
  - webpack/components/AnsibleHostDetail/AnsibleHostDetail.test.js
306
+ - webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/AnsibleHostInventory.js
307
+ - webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/AnsibleHostInventory.scss
308
+ - webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/AnsibleHostInventory.test.js
309
+ - webpack/components/AnsibleHostDetail/components/AnsibleHostInventory/index.js
310
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverrides.scss
311
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTable.js
312
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTableHelper.js
313
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableAction.js
314
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableAction.scss
315
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableActionHelper.js
316
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableValue.js
317
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableValueHelper.js
318
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverrides.fixtures.js
319
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverrides.test.js
320
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverridesDelete.test.js
321
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/__test__/AnsibleVariableOverridesUpdate.test.js
322
+ - webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/index.js
323
+ - webpack/components/AnsibleHostDetail/components/JobsTab/JobsTabHelper.js
324
+ - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobHelper.js
325
+ - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js
326
+ - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss
327
+ - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js
328
+ - webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js
329
+ - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js
330
+ - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js
331
+ - webpack/components/AnsibleHostDetail/components/JobsTab/index.js
332
+ - webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js
333
+ - webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/index.js
334
+ - webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js
335
+ - webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesModal.scss
336
+ - webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesModalHelper.js
337
+ - webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js
338
+ - webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js
339
+ - webpack/components/AnsibleHostDetail/components/RolesTab/__test__/EditRoles.test.js
340
+ - webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.fixtures.js
341
+ - webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.test.js
342
+ - webpack/components/AnsibleHostDetail/components/RolesTab/index.js
343
+ - webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
344
+ - webpack/components/AnsibleHostDetail/components/TabLayout.js
345
+ - webpack/components/AnsibleHostDetail/constants.js
346
+ - webpack/components/AnsibleHostDetail/helpers.js
306
347
  - webpack/components/AnsibleHostDetail/index.js
307
348
  - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.js
308
349
  - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.scss
@@ -311,7 +352,6 @@ files:
311
352
  - webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesHelpers.js
312
353
  - webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesHelpers.test.js
313
354
  - webpack/components/AnsibleRolesAndVariables/__test__/AnsibleRolesAndVariablesImport.test.js
314
- - webpack/components/AnsibleRolesAndVariables/__test__/__snapshots__/AnsibleRolesAndVariablesImport.test.js.snap
315
355
  - webpack/components/AnsibleRolesAndVariables/index.js
316
356
  - webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js
317
357
  - webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss
@@ -348,10 +388,44 @@ files:
348
388
  - webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap
349
389
  - webpack/components/AnsibleRolesSwitcher/components/withProtectedView.js
350
390
  - webpack/components/AnsibleRolesSwitcher/index.js
391
+ - webpack/components/DualList/DualList.scss
392
+ - webpack/components/DualList/ListControls.js
393
+ - webpack/components/DualList/ListHeader.js
394
+ - webpack/components/DualList/ListItem.js
395
+ - webpack/components/DualList/ListPane.js
396
+ - webpack/components/DualList/SelectedStatus.js
397
+ - webpack/components/DualList/index.js
398
+ - webpack/components/ErrorState.js
351
399
  - webpack/components/ReportJsonViewer.js
400
+ - webpack/components/withLoading.js
401
+ - webpack/components/withPagination.js
402
+ - webpack/formHelper.js
403
+ - webpack/globalIdHelper.js
352
404
  - webpack/global_index.js
405
+ - webpack/graphql/mutations/assignAnsibleRoles.gql
406
+ - webpack/graphql/mutations/cancelRecurringLogic.gql
407
+ - webpack/graphql/mutations/createAnsibleVariableOverride.gql
408
+ - webpack/graphql/mutations/createJobInvocation.gql
409
+ - webpack/graphql/mutations/deleteAnsibleVariableOverride.gql
410
+ - webpack/graphql/mutations/updateAnsibleVariableOverride.gql
411
+ - webpack/graphql/queries/allAnsibleRoles.gql
412
+ - webpack/graphql/queries/ansibleRoles.gql
413
+ - webpack/graphql/queries/currentUserAttributes.gql
414
+ - webpack/graphql/queries/hostAnsibleRoles.gql
415
+ - webpack/graphql/queries/hostAvailableAnsibleRoles.gql
416
+ - webpack/graphql/queries/hostVariableOverrides.gql
417
+ - webpack/graphql/queries/recurringJobs.gql
418
+ - webpack/helpers/pageParamsHelper.js
419
+ - webpack/helpers/paginationHelper.js
353
420
  - webpack/index.js
421
+ - webpack/permissionsHelper.js
354
422
  - webpack/reducer.js
423
+ - webpack/routes/HostgroupJobs/__test__/HostgroupJobs.fixtures.js
424
+ - webpack/routes/HostgroupJobs/__test__/HostgroupJobs.test.js
425
+ - webpack/routes/HostgroupJobs/index.js
426
+ - webpack/routes/routes.js
427
+ - webpack/testHelper.js
428
+ - webpack/toastHelper.js
355
429
  homepage: https://github.com/theforeman/foreman_ansible
356
430
  licenses:
357
431
  - GPL-3.0
@@ -371,51 +445,50 @@ required_rubygems_version: !ruby/object:Gem::Requirement
371
445
  - !ruby/object:Gem::Version
372
446
  version: '0'
373
447
  requirements: []
374
- rubygems_version: 3.1.2
448
+ rubygems_version: 3.1.6
375
449
  signing_key:
376
450
  specification_version: 4
377
451
  summary: Ansible integration with Foreman (theforeman.org)
378
452
  test_files:
379
- - test/factories/ansible_proxy.rb
380
- - test/factories/ansible_variables.rb
381
- - test/factories/ansible_roles.rb
382
- - test/factories/host_ansible_enhancements.rb
383
- - test/fixtures/insights_playbook.yaml
384
- - test/fixtures/sample_facts.json
385
- - test/fixtures/report.json
453
+ - test/functional/ansible_variables_controller_test.rb
386
454
  - test/functional/ansible_roles_controller_test.rb
387
- - test/functional/api/v2/ansible_inventories_controller_test.rb
388
455
  - test/functional/api/v2/ansible_variables_controller_test.rb
456
+ - test/functional/api/v2/ansible_roles_controller_test.rb
389
457
  - test/functional/api/v2/hostgroups_controller_test.rb
458
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
390
459
  - test/functional/api/v2/hosts_controller_test.rb
391
- - test/functional/api/v2/ansible_roles_controller_test.rb
392
460
  - test/functional/ui_ansible_roles_controller_test.rb
393
- - test/functional/ansible_variables_controller_test.rb
394
461
  - test/functional/hosts_controller_test.rb
395
- - test/test_plugin_helper.rb
462
+ - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
463
+ - test/graphql/queries/ansible_roles_query_test.rb
464
+ - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
396
465
  - test/unit/actions/run_ansible_job_test.rb
397
466
  - test/unit/actions/run_proxy_ansible_command_test.rb
398
- - test/unit/ansible_role_test.rb
399
- - test/unit/ansible_variable_test.rb
400
- - test/unit/concerns/config_reports_extensions_test.rb
401
- - test/unit/concerns/host_managed_extensions_test.rb
402
- - test/unit/concerns/hostgroup_extensions_test.rb
403
- - test/unit/helpers/ansible_reports_helper_test.rb
404
- - test/unit/lib/proxy_api/ansible_test.rb
467
+ - test/unit/services/api_roles_importer_test.rb
468
+ - test/unit/services/ui_roles_importer_test.rb
405
469
  - test/unit/services/ansible_report_importer_test.rb
406
- - test/unit/services/fact_sparser_test.rb
407
470
  - test/unit/services/insights_plan_runner_test.rb
471
+ - test/unit/services/override_resolver_test.rb
408
472
  - test/unit/services/roles_importer_test.rb
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
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
415
473
  - test/unit/services/inventory_creator_test.rb
416
- - test/unit/ansible_provider_test.rb
417
- - test/unit/host_ansible_role_test.rb
474
+ - test/unit/services/ansible_variables_importer_test.rb
475
+ - test/unit/lib/proxy_api/ansible_test.rb
476
+ - test/unit/ansible_role_test.rb
418
477
  - test/unit/hostgroup_ansible_role_test.rb
419
- - test/unit/import_roles_and_variables.rb
478
+ - test/unit/ansible_variable_test.rb
479
+ - test/unit/host_ansible_role_test.rb
480
+ - test/unit/helpers/ansible_reports_helper_test.rb
481
+ - test/unit/ansible_provider_test.rb
420
482
  - test/unit/ignore_roles_test.rb
421
- - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
483
+ - test/unit/import_roles_and_variables.rb
484
+ - test/unit/concerns/config_reports_extensions_test.rb
485
+ - test/unit/concerns/host_managed_extensions_test.rb
486
+ - test/unit/concerns/hostgroup_extensions_test.rb
487
+ - test/factories/ansible_proxy.rb
488
+ - test/factories/host_ansible_enhancements.rb
489
+ - test/factories/ansible_variables.rb
490
+ - test/factories/ansible_roles.rb
491
+ - test/fixtures/report.json
492
+ - test/fixtures/sample_facts.json
493
+ - test/fixtures/insights_playbook.yaml
494
+ - test/test_plugin_helper.rb
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ForemanAnsible
4
- # Define the class that fact names that come from Ansible should have
5
- # It allows us to filter facts by origin, and also to display the origin
6
- # in the fact values table (/fact_values)
7
- class FactName < ::FactName
8
- def origin
9
- 'Ansible'
10
- end
11
-
12
- def icon_path
13
- 'foreman_ansible/Ansible.png'
14
- end
15
- end
16
- end
@@ -1,106 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Setting
4
- # Provide settings related with Ansible
5
- class Ansible < ::Setting
6
- ::Setting::BLANK_ATTRS.concat %w[ansible_roles_to_ignore]
7
- class << self
8
- # It would be more disadvantages than advantages to split up
9
- # default_settings into multiple methods, this way it's already very
10
- # manageable.
11
- def default_settings
12
- [
13
- set(
14
- 'ansible_ssh_private_key_file',
15
- N_('Use this to supply a path to an SSH Private Key '\
16
- 'that Ansible will use in lieu of a password '\
17
- 'Override with "ansible_ssh_private_key_file" '\
18
- 'host parameter'),
19
- '',
20
- N_('Private Key Path')
21
- ),
22
- set(
23
- 'ansible_connection',
24
- N_('Use this connection type by default when running '\
25
- 'Ansible playbooks. You can override this on hosts by '\
26
- 'adding a parameter "ansible_connection"'),
27
- 'ssh',
28
- N_('Connection type')
29
- ),
30
- set(
31
- 'ansible_winrm_server_cert_validation',
32
- N_('Enable/disable WinRM server certificate '\
33
- 'validation when running Ansible playbooks. You can override '\
34
- 'this on hosts by adding a parameter '\
35
- '"ansible_winrm_server_cert_validation"'),
36
- 'validate',
37
- N_('WinRM cert Validation')
38
- ),
39
- set(
40
- 'ansible_verbosity',
41
- N_('Foreman will add this level of verbosity for '\
42
- 'additional debugging output when running Ansible playbooks.'),
43
- '0',
44
- N_('Default verbosity level'),
45
- nil,
46
- :collection => lambda do
47
- { '0' => N_('Disabled'),
48
- '1' => N_('Level 1 (-v)'),
49
- '2' => N_('Level 2 (-vv)'),
50
- '3' => N_('Level 3 (-vvv)'),
51
- '4' => N_('Level 4 (-vvvv)') }
52
- end
53
- ),
54
- set(
55
- 'ansible_post_provision_timeout',
56
- N_('Timeout (in seconds) to set when Foreman will trigger a '\
57
- 'play Ansible roles task after a host is fully provisioned. '\
58
- 'Set this to the maximum time you expect a host to take '\
59
- 'until it is ready after a reboot.'),
60
- '360',
61
- N_('Post-provision timeout')
62
- ),
63
- set(
64
- 'ansible_interval',
65
- N_('Timeout (in minutes) when hosts should have reported.'),
66
- '30',
67
- N_('Ansible report timeout')
68
- ),
69
- set(
70
- 'ansible_out_of_sync_disabled',
71
- format(N_('Disable host configuration status turning to out of'\
72
- ' sync for %{cfgmgmt} after report does not arrive within'\
73
- ' configured interval'), :cfgmgmt => 'Ansible'),
74
- false,
75
- format(N_('%{cfgmgmt} out of sync disabled'),
76
- :cfgmgmt => 'Ansible')
77
- ),
78
- set(
79
- 'ansible_inventory_template',
80
- N_('Foreman will use this template to schedule the report '\
81
- 'with Ansible inventory'),
82
- 'Ansible - Ansible Inventory',
83
- N_('Default Ansible inventory report template')
84
- ),
85
- set(
86
- 'ansible_roles_to_ignore',
87
- N_('Those roles will be excluded when importing roles from smart proxy, '\
88
- 'The expected input is comma separated values and you can use * wildcard metacharacters'\
89
- 'For example: foo*, *b*,*bar'),
90
- [],
91
- N_('Ansible roles to ignore')
92
- )
93
- ]
94
- end
95
-
96
- def load_defaults
97
- Setting::BLANK_ATTRS.push('ansible_ssh_private_key_file')
98
- super
99
- end
100
-
101
- def humanized_category
102
- N_('Ansible')
103
- end
104
- end
105
- end
106
- end
@@ -1,99 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ForemanAnsible
4
- # Override methods from Foreman app/services/fact_importer so that Ansible
5
- # facts are recognized in Foreman as ForemanAnsible facts. It supports
6
- # nested facts.
7
- #
8
- # Only relevant for 1.12 and lower versions
9
- class FactImporter < ::FactImporter
10
- def fact_name_class
11
- ForemanAnsible::FactName
12
- end
13
-
14
- def initialize(host, facts = {})
15
- # Try to assign these facts to the correct host as per the facts say
16
- # If that host isn't created yet, the host parameter will contain it
17
- @host = Host.find_by(:name => facts[:ansible_facts][:ansible_fqdn] ||
18
- facts[:ansible_facts][:fqdn]) ||
19
- host
20
- @facts = normalize(facts[:ansible_facts])
21
- @original_facts = FactSparser.unsparse(facts[:ansible_facts])
22
- @counters = {}
23
- end
24
-
25
- private
26
-
27
- def add_new_facts
28
- @counters[:added] = 0
29
- add_missing_facts(FactSparser.unsparse(@original_facts))
30
- logger.debug(
31
- "Merging facts for '#{host}': added #{@counters[:added]} facts"
32
- )
33
- end
34
-
35
- def add_missing_facts(imported_facts, parent = nil, prefix = '')
36
- imported_facts.reject! { |_fact_name, fact_value| fact_value.nil? }
37
-
38
- imported_facts.each do |imported_name, imported_value|
39
- fact_fqn = fact_fqn(imported_name, prefix)
40
- fact_name = find_or_create_fact_name(fact_fqn, parent, imported_value)
41
- add_fact_value(imported_value, fact_name)
42
- add_compose_fact(imported_value, fact_name, fact_fqn)
43
- end
44
- end
45
-
46
- def add_compose_fact(imported_values, fact_name, fact_fqn)
47
- if imported_values.is_a?(Hash)
48
- add_missing_facts(imported_values, fact_name, fact_fqn)
49
- elsif imported_values.is_a?(Array)
50
- imported_values.each do |imported_value|
51
- next unless imported_value.is_a?(Hash)
52
- add_missing_facts(imported_value, fact_name, fact_fqn)
53
- end
54
- end
55
- end
56
-
57
- def missing_facts
58
- @missing_facts ||= facts.keys +
59
- FactSparser.sparse(@original_facts).keys -
60
- host_fact_names
61
- end
62
-
63
- def host_fact_names
64
- host.fact_names.where(:type => fact_name_class.to_s).pluck(:name)
65
- end
66
-
67
- # Returns pairs [id, fact_name]
68
- def fact_names
69
- fact_name_class.group('name').maximum(:id)
70
- end
71
-
72
- # Fact fully qualified name contains an unambiguous name for a fact
73
- # e.g: ansible_lo::ipv6, ansible_virbr0::active
74
- def fact_fqn(name, prefix)
75
- prefix.empty? ? name : prefix + FactName::SEPARATOR + name
76
- end
77
-
78
- def find_or_create_fact_name(name, parent, fact_value)
79
- return fact_name_class.find(fact_names[name]) if fact_names[name].present?
80
- fact_name_class.create!(:name => name,
81
- :parent => parent,
82
- :compose => compose?(fact_value))
83
- end
84
-
85
- def add_fact_value(value, fact_name)
86
- return unless missing_facts.include?(fact_name.name)
87
- method = host.new_record? ? :build : :create!
88
- host.fact_values.send(method,
89
- :value => value.to_s,
90
- :fact_name => fact_name)
91
- @counters[:added] += 1
92
- end
93
-
94
- def compose?(fact_value)
95
- fact_value.is_a?(Hash) ||
96
- fact_value.is_a?(Array) && fact_value.first.is_a?(Hash)
97
- end
98
- end
99
- end
@@ -1,126 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ForemanAnsible
4
- # Override methods from Foreman app/services/fact_parser so that facts
5
- # representing host properties are understood when they come from Ansible.
6
- class FactParser < ::FactParser
7
- include OperatingSystemParser
8
- attr_reader :facts
9
-
10
- def initialize(facts)
11
- @facts = HashWithIndifferentAccess.new(facts[:ansible_facts])
12
- end
13
-
14
- # Don't do anything as there's no env in Ansible
15
- def environment; end
16
-
17
- def architecture
18
- name = facts[:ansible_architecture] || facts[:facter_architecture]
19
- Architecture.where(:name => name).first_or_create if name.present?
20
- end
21
-
22
- def model
23
- name = detect_fact([:ansible_product_name, :facter_virtual,
24
- :facter_productname, :facter_model, :model])
25
- Model.where(:name => name.strip).first_or_create if name.present?
26
- end
27
-
28
- def domain
29
- name = detect_fact([:ansible_domain, :facter_domain,
30
- :ohai_domain, :domain])
31
- Domain.where(:name => name).first_or_create if name.present?
32
- end
33
-
34
- def support_interfaces_parsing?
35
- true
36
- end
37
-
38
- # Move ansible's default interface first in the list of interfaces since
39
- # Foreman picks the first one that is usable. If ansible has no
40
- # preference otherwise at least sort the list.
41
- #
42
- # This method overrides app/services/fact_parser.rb on Foreman and returns
43
- # an array of interface names, ['eth0', 'wlan1', etc...]
44
- def get_interfaces # rubocop:disable Naming/AccessorMethodName
45
- pref = facts[:ansible_default_ipv4] &&
46
- facts[:ansible_default_ipv4]['interface']
47
- if pref.present?
48
- (facts[:ansible_interfaces] - [pref]).unshift(pref)
49
- else
50
- ansible_interfaces
51
- end
52
- end
53
-
54
- def get_facts_for_interface(iface_name)
55
- interface = iface_name.tr('-', '_') # virbr1-nic -> virbr1_nic
56
- interface_facts = facts[:"ansible_#{interface}"]
57
- ipaddress = ip_from_interface(interface)
58
- ipaddress6 = ipv6_from_interface(interface)
59
- macaddress = mac_from_interface(interface)
60
- iface_facts = HashWithIndifferentAccess[
61
- interface_facts.merge(:ipaddress => ipaddress,
62
- :ipaddress6 => ipaddress6,
63
- :macaddress => macaddress)
64
- ]
65
- logger.debug { "Ansible interface #{interface} facts: #{iface_facts.inspect}" }
66
- iface_facts
67
- end
68
-
69
- def ipmi_interface; end
70
-
71
- def boot_timestamp
72
- Time.zone.now.to_i - facts['ansible_uptime_seconds'].to_i
73
- end
74
-
75
- def virtual
76
- facts['ansible_virtualization_role'] == 'guest'
77
- end
78
-
79
- def ram
80
- facts['ansible_memtotal_mb'].to_i
81
- end
82
-
83
- def sockets
84
- facts['ansible_processor_count'].to_i
85
- end
86
-
87
- def cores
88
- facts['ansible_processor_cores'].to_i
89
- end
90
-
91
- private
92
-
93
- def ansible_interfaces
94
- return [] if facts[:ansible_interfaces].blank?
95
- facts[:ansible_interfaces].sort
96
- end
97
-
98
- def mac_from_interface(interface)
99
- facts[:"ansible_#{interface}"]['perm_macaddress'].presence || facts[:"ansible_#{interface}"]['macaddress']
100
- end
101
-
102
- def ip_from_interface(interface)
103
- return if facts[:"ansible_#{interface}"]['ipv4'].blank?
104
- if facts[:"ansible_#{interface}"]['ipv4'].is_a?(Array)
105
- facts[:"ansible_#{interface}"]['ipv4'][0]['address']
106
- else
107
- facts[:"ansible_#{interface}"]['ipv4']['address']
108
- end
109
- end
110
-
111
- def ipv6_from_interface(interface)
112
- return if facts[:"ansible_#{interface}"]['ipv6'].blank?
113
-
114
- facts[:"ansible_#{interface}"]['ipv6'].first['address']
115
- end
116
-
117
- # Returns first non-empty fact. Needed to check for empty strings.
118
- def detect_fact(fact_names)
119
- facts[
120
- fact_names.detect do |fact_name|
121
- facts[fact_name].present?
122
- end
123
- ]
124
- end
125
- end
126
- end