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 +4 -4
- data/app/controllers/ansible_roles_controller.rb +5 -0
- data/app/helpers/foreman_ansible/ansible_plugin_helper.rb +5 -1
- data/app/models/ansible_role.rb +1 -0
- data/app/models/concerns/foreman_ansible/has_many_ansible_roles.rb +3 -1
- data/app/models/concerns/foreman_ansible/host_managed_extensions.rb +4 -0
- data/app/models/concerns/foreman_ansible/hostgroup_extensions.rb +4 -0
- data/app/models/setting/ansible.rb +1 -1
- data/app/views/ansible_roles/index.html.erb +9 -4
- data/app/views/foreman_ansible/ansible_roles/_hostgroup_ansible_roles_button.erb +7 -8
- data/lib/foreman_ansible/version.rb +1 -1
- metadata +29 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0481242667e1e9da7b3d4d6388622034a7bc9ef
|
4
|
+
data.tar.gz: fbff270464c50108ba2aa78fde5a60eb369804b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
'
|
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
|
data/app/models/ansible_role.rb
CHANGED
@@ -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
|
|
@@ -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-
|
9
|
-
<th class="col-md-
|
10
|
-
<th class="col-md-
|
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
|
%>
|
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
|
+
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:
|
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.
|
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/
|
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/
|
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/
|
247
|
-
- test/
|
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
|