foreman_ansible 1.4.6 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of foreman_ansible might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00bb7f9d29564fb8e61f81e7406c05c50f185fbb
4
- data.tar.gz: 6c4404d0e53c1fe991a08760af23243ce62fb542
3
+ metadata.gz: e0481242667e1e9da7b3d4d6388622034a7bc9ef
4
+ data.tar.gz: fbff270464c50108ba2aa78fde5a60eb369804b4
5
5
  SHA512:
6
- metadata.gz: 5b13f77fa365d11d96e51da73e7cf72ac86335314a156de1b7ad7e7841efa172bbce7d69fb7820aab791f9563ec3fd5b4a2c7020fb6b08dcd966f22bb497fa90
7
- data.tar.gz: 5d40a1a231244b4ed0efde3041946305385022a25a29994601eff5f29c8e4cb68faf509b6fa68078aae3707f2f0a6819ca3f4ddfa33aadb8915de0de484f09c0
6
+ metadata.gz: eced3f1c1e3a72dfadf847cc3a15b9f3dbf824b7b1e9040b0b8845f2c277e086db41ff3b917ade2c79fe698589b4ddd592de2ed4b93b7449750af61d53e460ac
7
+ data.tar.gz: 390cda1e7cff7734a039abe887eedc75bcc6b482e0952397d67a858c0e21b69b6cdd2759a4554f19dd5947ac163e70841d025a463de3812b1fe59c8e94364f61
@@ -5,6 +5,7 @@ class AnsibleRolesController < ::ApplicationController
5
5
  before_action :find_resource, :only => [:destroy]
6
6
  before_action :find_proxy, :only => [:import]
7
7
  before_action :create_importer, :only => [:import, :confirm_import]
8
+ before_action :default_order, :only => [:index]
8
9
 
9
10
  def index
10
11
  @ansible_roles = resource_base.search_for(params[:search],
@@ -39,6 +40,10 @@ class AnsibleRolesController < ::ApplicationController
39
40
 
40
41
  private
41
42
 
43
+ def default_order
44
+ params[:order] ||= 'name ASC'
45
+ end
46
+
42
47
  def find_proxy
43
48
  return nil unless params[:proxy]
44
49
  @proxy = SmartProxy.authorized(:view_smart_proxies).find(params[:proxy])
@@ -1,8 +1,12 @@
1
+ require "#{ForemanAnsible::Engine.root}/lib/foreman_ansible/version"
2
+
1
3
  module ForemanAnsible
2
4
  # General helper for foreman_ansible
3
5
  module AnsiblePluginHelper
4
6
  def ansible_doc_url
5
- 'http://theforeman.org/plugins/foreman_ansible/1.x/index.html'
7
+ major_version = ::ForemanAnsible::VERSION.split('.')[0]
8
+ 'https://theforeman.org/plugins/foreman_ansible/'\
9
+ "#{major_version}.x/index.html"
6
10
  end
7
11
  end
8
12
  end
@@ -11,4 +11,5 @@ class AnsibleRole < ApplicationRecord
11
11
  :dependent => :destroy
12
12
 
13
13
  scoped_search :on => :name, :complete_value => true
14
+ scoped_search :on => :updated_at
14
15
  end
@@ -6,7 +6,9 @@ module ForemanAnsible
6
6
 
7
7
  included do
8
8
  def all_ansible_roles
9
- (ansible_roles + inherited_ansible_roles).uniq
9
+ result = (ansible_roles + inherited_ansible_roles).uniq
10
+ result += host_ansible_roles if is_a? Hostgroup
11
+ result
10
12
  end
11
13
  end
12
14
  end
@@ -7,6 +7,10 @@ module ForemanAnsible
7
7
  has_many :host_ansible_roles, :foreign_key => :host_id
8
8
  has_many :ansible_roles, :through => :host_ansible_roles,
9
9
  :dependent => :destroy
10
+ scoped_search :relation => :ansible_roles, :on => :name,
11
+ :complete_value => true, :rename => :role,
12
+ :only_explicit => true
13
+
10
14
  before_provision :play_ansible_roles
11
15
  include ForemanAnsible::HasManyAnsibleRoles
12
16
 
@@ -14,6 +14,10 @@ module ForemanAnsible
14
14
  roles + hostgroup.ansible_roles
15
15
  end.uniq
16
16
  end
17
+
18
+ def host_ansible_roles
19
+ hosts.all.includes(:ansible_roles).flat_map(&:ansible_roles)
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -10,6 +10,7 @@ class Setting
10
10
  # rubocop:disable BlockLength
11
11
  def load_defaults
12
12
  return unless super
13
+ Setting::BLANK_ATTRS.push('ansible_ssh_private_key_file')
13
14
  transaction do
14
15
  [
15
16
  set(
@@ -99,7 +100,6 @@ class Setting
99
100
  create(s.update(:category => 'Setting::Ansible'))
100
101
  end
101
102
  end
102
- Setting::BLANK_ATTRS.push('ansible_ssh_private_key_file')
103
103
  true
104
104
  end
105
105
 
@@ -1,19 +1,24 @@
1
1
  <% title _("Ansible Roles") %>
2
2
 
3
- <% title_actions ansible_proxy_import(hash_for_import_ansible_roles_path) %>
3
+ <% title_actions ansible_proxy_import(hash_for_import_ansible_roles_path),
4
+ documentation_button('#4.1ImportingRoles', :root_url => ansible_doc_url) %>
4
5
 
5
6
  <table class="<%= table_css_classes 'table-fixed' %>">
6
7
  <thead>
7
8
  <tr>
8
- <th class="col-md-3"><%= sort :name, :as => s_("Role|Name") %></th>
9
- <th class="col-md-3"><%= _("Imported at") %></th>
10
- <th class="col-md-1"><%= _("Actions") %></th>
9
+ <th class="col-md-6"><%= sort :name, :as => s_("Role|Name") %></th>
10
+ <th class="col-md-2"><%= _("Hostgroups") %></th>
11
+ <th class="col-md-2"><%= _("Hosts") %></th>
12
+ <th class="col-md-2"><%= sort :updated_at, :as => _("Imported at") %></th>
13
+ <th class="col-md-2"><%= _("Actions") %></th>
11
14
  </tr>
12
15
  </thead>
13
16
  <tbody>
14
17
  <% @ansible_roles.each do |role| %>
15
18
  <tr>
16
19
  <td class="ellipsis"><%= role.name %></td>
20
+ <td class="ellipsis"><%= role.hostgroups.count %></td>
21
+ <td class="ellipsis"><%= link_to role.hosts.count, hosts_path(:search => "role = #{role.name}")%></td>
17
22
  <td class="ellipsis"><%= import_time role %></td>
18
23
  <td>
19
24
  <%
@@ -1,14 +1,13 @@
1
1
  <%=
2
- if hostgroup.all_ansible_roles.empty?
2
+ play_roles = if hostgroup.all_ansible_roles.empty?
3
+ "<a title='No Roles assigned' href=\"#\">#{_('Play Roles')}</a>".html_safe
4
+ else
5
+ display_link_if_authorized(_('Play Roles'), hash_for_play_roles_hostgroup_path(:id => hostgroup), :'data-no-turbolink' => true)
6
+ end
7
+
3
8
  action_buttons(
4
9
  display_link_if_authorized(_('Nest'), hash_for_nest_hostgroup_path(:id => hostgroup)),
5
10
  display_link_if_authorized(_('Clone'), hash_for_clone_hostgroup_path(:id => hostgroup)),
11
+ play_roles,
6
12
  display_delete_if_authorized(hash_for_hostgroup_path(:id => hostgroup).merge(:auth_object => hostgroup, :authorizer => authorizer), :data => { :confirm => warning_message(hostgroup) }))
7
- else
8
- action_buttons(
9
- display_link_if_authorized(_('Nest'), hash_for_nest_hostgroup_path(:id => hostgroup)),
10
- display_link_if_authorized(_('Clone'), hash_for_clone_hostgroup_path(:id => hostgroup)),
11
- display_link_if_authorized(_('Play Roles'), hash_for_play_roles_hostgroup_path(:id => hostgroup), :'data-no-turbolink' => true),
12
- display_delete_if_authorized(hash_for_hostgroup_path(:id => hostgroup).merge(:auth_object => hostgroup, :authorizer => authorizer), :data => { :confirm => warning_message(hostgroup) }))
13
- end
14
13
  %>
@@ -2,5 +2,5 @@
2
2
  # This way other parts of Foreman can just call ForemanAnsible::VERSION
3
3
  # and detect what version the plugin is running.
4
4
  module ForemanAnsible
5
- VERSION = '1.4.6'.freeze
5
+ VERSION = '1.5.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.5.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: 2017-10-06 00:00:00.000000000 Z
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.8'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '0.12'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +55,9 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '0.8'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.12'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: dynflow
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -212,39 +218,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
218
  version: '0'
213
219
  requirements: []
214
220
  rubyforge_project:
215
- rubygems_version: 2.6.13
221
+ rubygems_version: 2.6.12
216
222
  signing_key:
217
223
  specification_version: 4
218
224
  summary: Ansible integration with Foreman (theforeman.org)
219
225
  test_files:
226
+ - test/factories/ansible_proxy.rb
227
+ - test/factories/ansible_roles.rb
228
+ - test/functional/api/v2/ansible_roles_controller_test.rb
229
+ - test/functional/api/v2/hostgroups_controller_test.rb
230
+ - test/functional/api/v2/hosts_controller_test.rb
231
+ - test/functional/ansible_roles_controller_test.rb
232
+ - test/functional/hosts_controller_test.rb
220
233
  - test/unit/ansible_role_test.rb
221
- - test/unit/hostgroup_ansible_role_test.rb
234
+ - test/unit/concerns/host_managed_extensions_test.rb
235
+ - test/unit/concerns/hostgroup_extensions_test.rb
236
+ - test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
237
+ - test/unit/lib/foreman_ansible_core/roles_reader_test.rb
238
+ - test/unit/lib/proxy_api/ansible_test.rb
222
239
  - test/unit/services/api_roles_importer_test.rb
240
+ - test/unit/services/fact_importer_test.rb
241
+ - test/unit/services/fact_parser_test.rb
223
242
  - test/unit/services/fact_sparser_test.rb
243
+ - test/unit/services/inventory_creator_test.rb
224
244
  - test/unit/services/proxy_selector_test.rb
245
+ - test/unit/services/roles_importer_test.rb
225
246
  - test/unit/services/structured_fact_importer_test.rb
226
247
  - test/unit/services/ui_roles_importer_test.rb
227
- - test/unit/services/inventory_creator_test.rb
228
- - test/unit/services/fact_parser_test.rb
229
- - test/unit/services/roles_importer_test.rb
230
- - test/unit/services/fact_importer_test.rb
231
248
  - test/unit/helpers/foreman_ansible/ansible_reports_helper_test.rb
232
- - test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
233
- - test/unit/lib/foreman_ansible_core/roles_reader_test.rb
234
- - test/unit/lib/proxy_api/ansible_test.rb
235
249
  - test/unit/host_ansible_role_test.rb
236
- - test/unit/concerns/host_managed_extensions_test.rb
237
- - test/unit/concerns/hostgroup_extensions_test.rb
238
- - test/factories/ansible_proxy.rb
239
- - test/factories/ansible_roles.rb
240
- - test/test_plugin_helper.rb
241
- - test/fixtures/ansible_permissions.yml
250
+ - test/unit/hostgroup_ansible_role_test.rb
242
251
  - test/fixtures/sample_facts.json
252
+ - test/fixtures/ansible_permissions.yml
243
253
  - test/support/fixture_support.rb
244
- - test/support/foreman_test_helper_additions.rb
245
254
  - test/support/foreman_tasks/task.rb
246
- - test/functional/ansible_roles_controller_test.rb
247
- - test/functional/api/v2/ansible_roles_controller_test.rb
248
- - test/functional/api/v2/hostgroups_controller_test.rb
249
- - test/functional/api/v2/hosts_controller_test.rb
250
- - test/functional/hosts_controller_test.rb
255
+ - test/support/foreman_test_helper_additions.rb
256
+ - test/test_plugin_helper.rb