foreman_ansible 7.0.4 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/ansible_playbooks_controller.rb +66 -0
  3. data/app/controllers/foreman_ansible/api/v2/hostgroups_controller_extensions.rb +5 -1
  4. data/app/controllers/foreman_ansible/api/v2/hosts_controller_extensions.rb +3 -1
  5. data/app/graphql/presenters/ansible_role_presenter.rb +4 -0
  6. data/app/graphql/types/ansible_role.rb +1 -0
  7. data/app/graphql/types/inherited_ansible_role.rb +4 -0
  8. data/app/helpers/foreman_ansible/hosts_helper.rb +19 -0
  9. data/app/jobs/sync_playbooks.rb +25 -0
  10. data/app/lib/proxy_api/ansible.rb +13 -0
  11. data/app/services/foreman_ansible/import_playbooks_error_notification.rb +38 -0
  12. data/app/services/foreman_ansible/import_playbooks_success_notification.rb +33 -0
  13. data/app/services/foreman_ansible/playbooks_importer.rb +73 -0
  14. data/app/services/foreman_ansible/proxy_api.rb +3 -4
  15. data/app/services/foreman_ansible/variables_importer.rb +9 -9
  16. data/app/views/ansible_roles/index.html.erb +2 -0
  17. data/app/views/api/v2/ansible_playbooks/sync.json.rabl +5 -0
  18. data/app/views/api/v2/hostgroups/ansible_roles.json.rabl +9 -1
  19. data/app/views/api/v2/hosts/ansible_roles.json.rabl +9 -1
  20. data/app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_git.erb +4 -1
  21. data/app/views/foreman_ansible/job_templates/ansible_windows_updates.erb +160 -0
  22. data/config/routes.rb +10 -3
  23. data/db/migrate/20200421201839_update_ansible_inv_template_name.rb +1 -5
  24. data/db/seeds.d/90_notification_blueprints.rb +14 -0
  25. data/lib/foreman_ansible/engine.rb +0 -1
  26. data/lib/foreman_ansible/register.rb +9 -3
  27. data/lib/foreman_ansible/version.rb +1 -1
  28. data/locale/action_names.rb +4 -3
  29. data/locale/ca/foreman_ansible.edit.po +1162 -0
  30. data/locale/ca/foreman_ansible.po +360 -45
  31. data/{webpack/components/withPagination.js → locale/ca/foreman_ansible.po.time_stamp} +0 -0
  32. data/locale/cs_CZ/foreman_ansible.edit.po +1207 -0
  33. data/locale/cs_CZ/foreman_ansible.po +372 -57
  34. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  35. data/locale/de/foreman_ansible.edit.po +1148 -0
  36. data/locale/de/foreman_ansible.po +355 -40
  37. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  38. data/locale/en/foreman_ansible.edit.po +1146 -0
  39. data/locale/en/foreman_ansible.po +355 -40
  40. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  41. data/locale/en_GB/foreman_ansible.edit.po +1155 -0
  42. data/locale/en_GB/foreman_ansible.po +357 -42
  43. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  44. data/locale/es/foreman_ansible.edit.po +1148 -0
  45. data/locale/es/foreman_ansible.po +355 -40
  46. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  47. data/locale/foreman_ansible.pot +767 -263
  48. data/locale/fr/foreman_ansible.edit.po +1148 -0
  49. data/locale/fr/foreman_ansible.po +355 -40
  50. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  51. data/locale/gl/foreman_ansible.edit.po +1156 -0
  52. data/locale/gl/foreman_ansible.po +358 -43
  53. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  54. data/locale/it/foreman_ansible.edit.po +1148 -0
  55. data/locale/it/foreman_ansible.po +355 -40
  56. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  57. data/locale/ja/foreman_ansible.edit.po +1148 -0
  58. data/locale/ja/foreman_ansible.po +355 -40
  59. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  60. data/locale/ko/foreman_ansible.edit.po +1148 -0
  61. data/locale/ko/foreman_ansible.po +355 -40
  62. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  63. data/locale/nl_NL/foreman_ansible.edit.po +1168 -0
  64. data/locale/nl_NL/foreman_ansible.po +359 -44
  65. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  66. data/locale/pl/foreman_ansible.edit.po +1180 -0
  67. data/locale/pl/foreman_ansible.po +363 -48
  68. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  69. data/locale/pt_BR/foreman_ansible.edit.po +1148 -0
  70. data/locale/pt_BR/foreman_ansible.po +355 -40
  71. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  72. data/locale/ru/foreman_ansible.edit.po +1149 -0
  73. data/locale/ru/foreman_ansible.po +355 -40
  74. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  75. data/locale/sv_SE/foreman_ansible.edit.po +1180 -0
  76. data/locale/sv_SE/foreman_ansible.po +363 -48
  77. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  78. data/locale/zh_CN/foreman_ansible.edit.po +1148 -0
  79. data/locale/zh_CN/foreman_ansible.po +355 -40
  80. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  81. data/locale/zh_TW/foreman_ansible.edit.po +1148 -0
  82. data/locale/zh_TW/foreman_ansible.po +355 -40
  83. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  84. data/test/fixtures/playbooks_example_output.json +1 -0
  85. data/test/fixtures/sample_playbooks.json +10 -0
  86. data/test/functional/api/v2/ansible_playbooks_controller_test.rb +65 -0
  87. data/test/functional/hosts_controller_test.rb +2 -2
  88. data/test/graphql/queries/host_ansible_roles_query_test.rb +61 -0
  89. data/test/unit/import_playbooks_test.rb +51 -0
  90. data/test/unit/lib/proxy_api/ansible_test.rb +6 -0
  91. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTable.js +58 -75
  92. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js +44 -58
  93. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +151 -0
  94. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +43 -56
  95. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/index.js +1 -1
  96. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js +26 -24
  97. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js +3 -2
  98. data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +39 -43
  99. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.fixtures.js +30 -0
  100. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariables.js +27 -38
  101. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesActions.js +2 -1
  102. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesConstants.js +1 -0
  103. data/webpack/components/AnsibleRolesAndVariables/AnsibleRolesAndVariablesSelectors.js +6 -0
  104. data/webpack/components/AnsibleRolesAndVariables/index.js +7 -1
  105. data/webpack/components/AnsibleRolesSwitcher/__tests__/AnsibleRolesSwitcher.test.js +0 -2
  106. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +3 -12
  107. data/webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js +2 -2
  108. data/webpack/components/AnsibleRolesSwitcher/components/OrderedRolesTooltip.js +11 -12
  109. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap +6 -20
  110. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AvailableRolesList.test.js.snap +9 -6
  111. data/webpack/components/withLoading.js +7 -12
  112. data/webpack/graphql/queries/allAnsibleRoles.gql +3 -0
  113. data/webpack/graphql/queries/hostAnsibleRoles.gql +3 -0
  114. data/webpack/helpers/pageParamsHelper.js +3 -3
  115. metadata +87 -34
  116. data/app/helpers/foreman_ansible/hosts_helper_extensions.rb +0 -30
  117. data/webpack/helpers/paginationHelper.js +0 -9
@@ -31,7 +31,21 @@ blueprints = [
31
31
  :name => 'Sync_roles_and_variables_failed',
32
32
  :message => 'DYNAMIC',
33
33
  :level => 'error'
34
+ },
35
+ {
36
+ :group => N_('Playbooks'),
37
+ :name => 'Sync_playbooks_successfully',
38
+ :message => N_('Import playbooks has finished successfully'),
39
+ :level => 'success'
40
+
41
+ },
42
+ {
43
+ :group => N_('Playbooks'),
44
+ :name => 'Sync_playbooks_failed',
45
+ :message => 'DYNAMIC',
46
+ :level => 'error'
34
47
  }
35
48
 
36
49
  ]
50
+
37
51
  blueprints.each { |blueprint| UINotifications::Seed.new(blueprint).configure }
@@ -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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Foreman::Plugin.register :foreman_ansible do
4
- requires_foreman '>= 3.0'
4
+ requires_foreman '>= 3.3'
5
5
 
6
6
  settings do
7
7
  category :ansible, N_('Ansible') do
@@ -158,6 +158,8 @@ Foreman::Plugin.register :foreman_ansible do
158
158
  :resource_type => 'Hostgroup'
159
159
  permission :generate_ansible_inventory,
160
160
  { :'api/v2/ansible_inventories' => [:schedule] }
161
+ permission :import_ansible_playbooks,
162
+ { :'api/v2/ansible_playbooks' => [:sync, :fetch] }
161
163
  end
162
164
 
163
165
  role 'Ansible Roles Manager',
@@ -167,7 +169,7 @@ Foreman::Plugin.register :foreman_ansible do
167
169
  :view_ansible_roles, :destroy_ansible_roles,
168
170
  :import_ansible_roles, :view_ansible_variables,
169
171
  :create_ansible_variables, :import_ansible_variables,
170
- :edit_ansible_variables, :destroy_ansible_variables]
172
+ :edit_ansible_variables, :destroy_ansible_variables, :import_ansible_playbooks]
171
173
 
172
174
  role 'Ansible Tower Inventory Reader',
173
175
  [:view_hosts, :view_hostgroups, :view_facts, :generate_report_templates, :generate_ansible_inventory,
@@ -185,7 +187,7 @@ Foreman::Plugin.register :foreman_ansible do
185
187
 
186
188
  register_global_js_file 'global'
187
189
 
188
- extend_graphql_type :type => ::Types::Host do
190
+ extend_graphql_type :type => '::Types::Host' do
189
191
  field :all_ansible_roles, ::Types::InheritedAnsibleRole.connection_type, :null => true, :method => :present_all_ansible_roles
190
192
  field :own_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
191
193
  field :available_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
@@ -234,4 +236,8 @@ Foreman::Plugin.register :foreman_ansible do
234
236
  register_report_scanner ForemanAnsible::AnsibleReportScanner
235
237
  register_report_origin 'Ansible', 'ConfigReport'
236
238
  end
239
+
240
+ describe_host do
241
+ multiple_actions_provider :ansible_hosts_multiple_actions
242
+ end
237
243
  end
@@ -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 = '7.0.4'
7
+ VERSION = '8.0.1'
8
8
  end
@@ -1,5 +1,6 @@
1
1
  # Autogenerated!
2
- _("Action with sub plans")
3
- _("Import facts")
2
+ _("Preupgrade job")
3
+ _("Remote action:")
4
4
  _("Import Puppet classes")
5
- _("Remote action:")
5
+ _("Import facts")
6
+ _("Action with sub plans")