foreman_ansible 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa031a234a6d296465ac087dda5cf526282eec60
4
- data.tar.gz: 832fe5d6d10229ad099580e4a0c9819e8f014109
3
+ metadata.gz: a4f05964b165891e1b44e5158dcf7b2d5e77881e
4
+ data.tar.gz: c1629f35495a5617fa6a74a10fffadbde03564ea
5
5
  SHA512:
6
- metadata.gz: 888fb2bc15861e7f584f4eced2293179953f2e366f33b9cf0da442b6dc9c411362a68f9863d13977c64f265611d74f048056c76c2cfbcd8fbc79f95c5727f894
7
- data.tar.gz: 416dde1c07ef3153d37f43982f16978980fd2fc4e840e981272d9ac0a3b855123b43decb2bf5b4f75b877d6472c37f6658b7c204ce61c1f8e11a9eaf22e32d50
6
+ metadata.gz: 3e2aae785f1b33486213458fce2c68d3c3a278e09545bf7ec77fb4e2e0b4345296b69f2623dd0c47cd2468e33be4ba0de1498fb7484e58f425836741ae849e5f
7
+ data.tar.gz: cc39abf1727a1eab156b1ce837cd3fe16642979c35cbbfe02d61e07edc9dc28d0cd57fa2822f2c8402804e04074a76afec60c45d32e481233d835325a3ae60b6
@@ -2,19 +2,11 @@ module ForemanAnsible
2
2
  # Small convenience to list all roles in the UI
3
3
  module AnsibleRolesHelper
4
4
  def ansible_proxy_links(hash, classes = nil)
5
- links = SmartProxy.with_features('Ansible').map do |proxy|
5
+ SmartProxy.with_features('Ansible').map do |proxy|
6
6
  display_link_if_authorized(_('From %s') % proxy.name,
7
7
  hash.merge(:proxy => proxy),
8
8
  :class => classes)
9
9
  end.flatten
10
- host_text = if links.any?
11
- _('From Foreman host')
12
- else
13
- _('Import from Foreman host')
14
- end
15
- links.unshift display_link_if_authorized(host_text,
16
- hash,
17
- :class => classes)
18
10
  end
19
11
 
20
12
  def ansible_proxy_import(hash)
@@ -16,6 +16,12 @@ module ForemanAnsible
16
16
  end.uniq
17
17
  end
18
18
 
19
+ def inherited_and_own_ansible_roles
20
+ path.reduce([]) do |roles, hostgroup|
21
+ roles + hostgroup.ansible_roles
22
+ end.uniq
23
+ end
24
+
19
25
  def host_ansible_roles
20
26
  hosts.all.includes(:ansible_roles).flat_map(&:ansible_roles)
21
27
  end
@@ -3,7 +3,7 @@
3
3
  f,
4
4
  :ansible_roles,
5
5
  AnsibleRole,
6
- f.object.all_ansible_roles.map(&:id),
6
+ f.object.is_a?(Hostgroup) ? (f.object.inherited_and_own_ansible_roles).map(&:id) : f.object.all_ansible_roles.map(&:id),
7
7
  {
8
8
  :disabled => f.object.inherited_ansible_roles.map(&:id),
9
9
  :label => _('Available roles'),
@@ -23,5 +23,5 @@ model: JobTemplate
23
23
  when 'restart'
24
24
  'shutdown -r +1'
25
25
  else
26
- 'shutdown -h now'
26
+ 'shutdown -h +1'
27
27
  end %>
@@ -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 = '2.2.3'.freeze
5
+ VERSION = '2.2.4'.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: 2.2.3
4
+ version: 2.2.4
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: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2018-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop