foreman_discovery 2.0.2 → 3.0.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -182
  3. data/app/controllers/api/v2/discovered_hosts_controller.rb +2 -2
  4. data/app/controllers/api/v2/discovery_rules_controller.rb +16 -8
  5. data/app/controllers/discovered_hosts_controller.rb +8 -1
  6. data/app/helpers/discovered_hosts_helper.rb +1 -1
  7. data/app/models/discovery_rule.rb +0 -7
  8. data/app/models/host/discovered.rb +14 -4
  9. data/app/services/host_converter.rb +2 -2
  10. data/app/views/api/v2/discovery_rules/main.json.rabl +1 -6
  11. data/app/views/discovered_hosts/_discovered_host.html.erb +1 -1
  12. data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +2 -2
  13. data/app/views/discovery_rules/index.html.erb +3 -3
  14. data/lib/foreman_discovery/engine.rb +5 -8
  15. data/lib/foreman_discovery/version.rb +1 -1
  16. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  17. data/locale/de/foreman_discovery.po +211 -20
  18. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  19. data/locale/en_GB/foreman_discovery.po +208 -17
  20. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  21. data/locale/es/foreman_discovery.po +212 -19
  22. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  23. data/locale/fr/foreman_discovery.po +209 -18
  24. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  25. data/locale/gl/foreman_discovery.po +203 -12
  26. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  27. data/locale/it/foreman_discovery.po +209 -18
  28. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  29. data/locale/ja/foreman_discovery.po +209 -18
  30. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  31. data/locale/ko/foreman_discovery.po +209 -18
  32. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  33. data/locale/pt_BR/foreman_discovery.po +209 -18
  34. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/ru/foreman_discovery.po +209 -18
  36. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  37. data/locale/sv_SE/foreman_discovery.po +209 -18
  38. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  39. data/locale/zh_CN/foreman_discovery.po +209 -18
  40. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/zh_TW/foreman_discovery.po +209 -18
  42. data/test/factories/discovery_rule_related.rb +1 -0
  43. data/test/functional/api/v2/discovered_hosts_controller_test.rb +19 -4
  44. data/test/functional/discovered_hosts_controller_test.rb +4 -3
  45. data/test/unit/discovered_extensions_test.rb +9 -7
  46. data/test/unit/facts.json +3 -1
  47. data/test/unit/host_discovered_test.rb +7 -8
  48. metadata +2 -5
  49. data/db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb +0 -8
  50. data/test/unit/discovery_rule_test.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8376f5939d2a45b99fa967a25a8643d6b9145016
4
- data.tar.gz: 51dbc6574fd0e9edc5625ccb1aad6ec9b19575fc
3
+ metadata.gz: 73911ee5b9b16a403e8f2709babed0be65bcdd31
4
+ data.tar.gz: ba4db8e574a8fac66bf4a7b481750581c2e22484
5
5
  SHA512:
6
- metadata.gz: cc7ef21b60498eb6a65a7822c0d2aaf8a8bc52f1a1cc02e7026b4fac26efb0529774e4b2f2b741fa9015d06e28a0f73ae37d5d83756770017c88448735e75d93
7
- data.tar.gz: 883e95584fe9574bccd635bc860ffec433b61b2b0715397108af6d16cdaf1f852cfc14cc79ef7923f2a9eb155962708bf61294aa2bffee77753bc54adf4007dc
6
+ metadata.gz: ab7fba75b6799fcc3c95890a3f942cafea7f4c590a45514f0ebba707256cff977bc5cdec67bdea7bd5ed96c0a5897e6f3c1133b47bc930184fc3750458eee121
7
+ data.tar.gz: 3fc4a54ee297c7c3134c3ef02e373225bfc809bc162a90b07dad598455318926065da63696fa0925066709cf1bbb4f54a00183ed8d9da1151243a8b048154695
data/README.md CHANGED
@@ -1,40 +1,10 @@
1
1
  # foreman\_discovery
2
2
 
3
- This plugin enables MaaS hardware discovery in Foreman. There are two
4
- artifacts (and terms) used in this document:
3
+ This plugin enables MaaS hardware discovery in Foreman.
5
4
 
6
- * foreman_discovery plugin - software installed in Foreman that adds Discovered
7
- Hosts menu entry, API and required configuration
8
- * discovery image - net-bootable image that needs to be installed in the TFTP
9
- server and configured in Foreman for new (unknown) hosts to boot from over
10
- PXE
5
+ # Documentation
11
6
 
12
- ## Minimal hardware requirements
13
-
14
- Since the bootable image runs from memory, keep in mind the minimum
15
- requirement of 500 MB RAM otherwise kernel panic can be seen during boot
16
- sequence.
17
-
18
- # Installation (plugin)
19
-
20
- Please see the Foreman wiki for appropriate instructions:
21
-
22
- * [Foreman: How to Install a Plugin](http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Plugin)
23
-
24
- The gem name is "foreman_discovery".
25
-
26
- RPM users can install the "ruby193-rubygem-foreman_discovery" or
27
- "rubygem-foreman_discovery" packages.
28
-
29
- ## Compatibility
30
-
31
- | Foreman Version | Plugin Version | Image Version |
32
- | --------------- | --------------:| -------------------:|
33
- | <= 1.2 | 1.0.2 | N/A |
34
- | = 1.3 | 1.1.0 | 0.1.0 |
35
- | = 1.4 | 1.2.0 | 0.3.0-1 |
36
- | = 1.5 | 1.3.0 | 0.5.0-1 |
37
- | >= 1.6 | 1.4.0 | 0.6 or 2.0 |
7
+ The main documentation can be found in [Foreman Discovery 2.0 Manual] (http://theforeman.org/plugins/foreman_discovery/2.0/).
38
8
 
39
9
  ## Latest code
40
10
 
@@ -43,155 +13,6 @@ branch of the plugin can be obtained by updating the Gemfile in this way:
43
13
 
44
14
  gem 'foreman_discovery', :git => "https://github.com/theforeman/foreman_discovery.git"
45
15
 
46
- # Installation (image)
47
-
48
- The image is based on CentOS 7 and about 150 MB in size. The recommended
49
- option is to download a prebuilt image from the Foreman repositories.
50
-
51
- ## Downloading an image
52
-
53
- ### Download via installer
54
-
55
- As of Foreman 1.6, the foreman-installer is able to automatically download
56
- latest stable image. For this, re-run the installer with the following
57
- option:
58
-
59
- # foreman-installer \
60
- --enable-foreman-plugin-discovery \
61
- --foreman-plugin-discovery-install-images=true
62
-
63
- ### Manual download
64
-
65
- Images are available from:
66
-
67
- * http://downloads.theforeman.org/discovery/
68
-
69
- To download the latest release to the expected location, do the following:
70
-
71
- # wget http://downloads.theforeman.org/discovery/releases/latest/fdi-image-latest.tar \
72
- -O - | tar x --overwrite -C /var/lib/tftpboot/boot
73
-
74
- After download, verify checksums:
75
-
76
- # cat /var/lib/tftpboot/boot/fdi-image/SHA256SUM
77
- beb3cfba7d9fb9d71481c0c8f... initrd0.img
78
- f03bce150d2473a28697d2988... vmlinuz0
79
- # sha256sum /var/lib/tftpboot/boot/fdi-image/*
80
-
81
- ### Building an image
82
-
83
- To build a discovery image, please visit the
84
- [foreman-discovery-image](https://github.com/theforeman/foreman-discovery-image)
85
- git repository and find the README for further instructions.
86
-
87
- # Configuration (image)
88
-
89
- Foreman Discovery relies on intercepting the normal boot process for machines
90
- not registered in Foreman. To achieve this, the PXE default.cfg file needs to
91
- be altered to instruct new machines to boot the discovery image.
92
-
93
- In the Foreman UI, go to Provisioning Templates, edit *PXELinux global default*
94
- template and add the following after the "LABEL local" block of options:
95
-
96
- LABEL discovery
97
- MENU LABEL Foreman Discovery
98
- MENU DEFAULT
99
- KERNEL boot/fdi-image/vmlinuz0
100
- APPEND initrd=boot/fdi-image/initrd0.img rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=http://xyz proxy.type=proxy
101
- IPAPPEND 2
102
-
103
- The `proxy.type` option can be either `proxy` or `foreman`. In the first case
104
- all communication goes through Smart Proxy, in the latter case the
105
- communication goes directly to Foreman (legacy mode). This is the default when
106
- not specified.
107
-
108
- The `proxy.url` specifies URL of the Smart Proxy or Foreman depending on the
109
- previous setting. Both http and https schemes are supported. For backward
110
- compatibility, `foreman.url` is an alias for this setting.
111
-
112
- Once the APPEND line is modified properly, set the entry to be default via the
113
- `ONTIMEOUT` option:
114
-
115
- ONTIMEOUT discovery
116
-
117
- *Alternatively*, the Discovery image also searches for DNS SRV record named
118
- `_x-foreman._tcp`. If the DNS server is configured for this (see the example
119
- for ISC BIND below), then it is not required to provide `foreman.url` at all.
120
-
121
- _x-foreman._tcp SRV 0 5 443 foreman
122
-
123
- This can still be overriden with the command line opts.
124
-
125
- It is important to have *IPAPPEND 2* option which adds BOOTIF=MAC option which
126
- is then reported via facter as `discovery_bootif` which is key fact which is
127
- used for provisioning. Without this line, DNS will not work properly as well.
128
-
129
- It is important to know that DNS servers from DHCP are enabled only for the
130
- interface that was specified via the BOOTIF option. This means when a system
131
- have multiple NICs, DNS will work for the correct interface - the one that was
132
- booted from.
133
-
134
- _Warning_: For now, the selinux=0 option *must* be provided, the image is read
135
- only anyway but we plan to enable and test with SELinux too.
136
-
137
- ## Updating the on-disk `default` file
138
-
139
- Once the template has been updated, click the Build PXE Default button at the top
140
- of the Provisioning Templates page. This will instruct the TFTP proxy to rewrite
141
- the `pxelinux.cfg/default` file.
142
-
143
- # Configuration (plugin)
144
-
145
- No configuration of the plugin in the Foreman UI is required, but some
146
- configuration is available.
147
-
148
- If Locations and/or Organisations are enabled, Foreman will default to using
149
- the first Location and first Organisation for Discovered hosts. If hosts should
150
- be placed in some other Location/Organization, alter the default Loc/Org in
151
- `More->Settings->Discovered`
152
-
153
- There is also setting called `discovery_fact` which defaults to
154
- `discovery_bootif` which specifies which incoming fact should be used to get
155
- the MAC address. By default PXELinux BOOTIF kernel command line option is used
156
- which gives a MAC address of the interface which was booted from. Make sure
157
- the `IPAPPEND 2` option is set correctly in the Foreman template.
158
-
159
- # Usage
160
-
161
- Boot a machine using the new PXE config above. It should register with
162
- Foreman. The new Host should show up in `Hosts->Discovered Hosts`. Then select
163
- a Discovered Host and choose Provision. This will redirect to the normal Edit
164
- page for a Host, with the discovered data filled in where possible. Fill in
165
- the details as normal.
166
-
167
- On save, a reboot is sent to the discovered host, after which it should reboot into
168
- the installer for the chosen OS, and finally into the installed OS.
169
-
170
- Delete a machine and reboot it to have it move back to the Discovery Pool.
171
-
172
- # Permissions
173
-
174
- The plugin will create a Role called `Discovery` when first started. This can
175
- be assigned to roles for non-admins to allow them to use the discovery plugin.
176
- Alternatively assign the `:perform_discovery` permission to an existing Role.
177
-
178
- # Troubleshooting
179
-
180
- If the booted machine fails to register with Foreman, then there are a number of common causes:
181
-
182
- * Machine did not boot the correct image
183
- * check your `pxelinux.cfg/default` has the right config as above
184
- * Machine booted image but failed to contact Foreman
185
- * Check the `foreman.url` option in `pxelinux.cfg/default` is correctly defined
186
- * Check DNS is working for that image, or use an IP in `foreman.url`
187
- * Check DHCP is handing IPs to the booted image correctly
188
-
189
- To log in the running image you need to set root password which is locked by
190
- default. In addition, you can enable ssh server as well. To do this, provide
191
- the following kernel command line options:
192
-
193
- APPEND ... fdi.ssh=1 fdi.rootpw=redhat
194
-
195
16
  # API
196
17
 
197
18
  see the [API README](README.api.md)
@@ -119,7 +119,7 @@ module Api
119
119
  def auto_provision
120
120
  @discovered_host.transaction do
121
121
  if rule = find_discovery_rule(@discovered_host)
122
- msg = _("Host %s was provisioned with rule %s") % [@discovered_host.name, rule.name]
122
+ msg = _("Host %{host} was provisioned with rule %{rule}") % {:host => @discovered_host.name, :rule => rule.name}
123
123
  process_response perform_auto_provision(@discovered_host, rule), msg
124
124
  else
125
125
  process_success _("No rule found for host %s") % @discovered_host.name
@@ -135,7 +135,7 @@ module Api
135
135
  result = true
136
136
  error_message = _("Errors during auto provisioning: %s")
137
137
 
138
- if Host::Discovered.count == 0
138
+ if Host::Discovered.count == 0
139
139
  error_message = _("No discovered hosts to provision")
140
140
  result = false
141
141
  end
@@ -28,13 +28,13 @@ module Api
28
28
 
29
29
  def_param_group :discovery_rule do
30
30
  param :discovery_rule, Hash, :action_aware => true do
31
- param :name, String, :required => true, :desc => N_("represents rule name shown to the users")
32
- param :search, String, :required => true, :desc => N_("query to match discovered hosts for the particular rule")
33
- param :hostgroup_id, Integer, :required => true, :desc => N_("the hostgroup that is used to auto provision a host")
34
- param :hostname, String, :desc => N_("defines a pattern to assign human-readable hostnames to the matching hosts")
35
- param :max_count, Integer, :desc => N_("enables to limit maximum amount of provisioned hosts per rule")
36
- param :priority, Integer, :desc => N_("puts the rules in order, low numbers go first. Must be greater then zero")
37
- param :enabled, :bool, :desc => N_("flag is used for temporary shutdown of rules")
31
+ param :name, String, :required => true
32
+ param :search, String, :required => true
33
+ param :hostgroup_id, Integer, :required => true
34
+ param :hostname, String, :required => true
35
+ param :max_count, Integer
36
+ param :priority, Integer
37
+ param :enabled, :bool
38
38
  end
39
39
  end
40
40
 
@@ -48,7 +48,15 @@ module Api
48
48
 
49
49
  api :PUT, "/discovery_rules/:id/", N_("Update a rule")
50
50
  param :id, :identifier, :required => true
51
- param_group :discovery_rule, :as => :update
51
+ param :discovery_rule, Hash, :action_aware => true do
52
+ param :name, String, :required => true
53
+ param :search, String, :required => true
54
+ param :hostgroup_id, Integer, :required => true
55
+ param :hostname, String, :required => true
56
+ param :max_count, Integer
57
+ param :priority, Integer
58
+ param :enabled, :bool
59
+ end
52
60
 
53
61
  def update
54
62
  process_response @discovery_rule.update_attributes(params[:discovery_rule])
@@ -154,6 +154,13 @@ class DiscoveredHostsController < ::ApplicationController
154
154
 
155
155
  def auto_provision_all
156
156
  result = true
157
+ error_message = _("Errors during auto provisioning: %s")
158
+
159
+ if Host::Discovered.count == 0
160
+ error_message = _("No discovered hosts to provision")
161
+ result = false
162
+ end
163
+
157
164
  Host.transaction do
158
165
  overall_errors = ""
159
166
  Host::Discovered.all.each do |discovered_host|
@@ -169,7 +176,7 @@ class DiscoveredHostsController < ::ApplicationController
169
176
  if result
170
177
  process_success :success_msg => _("Discovered hosts are provisioning now"), :success_redirect => :back
171
178
  else
172
- process_error :error_msg => _("Errors during auto provisioning: %s") % overall_errors, :redirect => :back
179
+ process_error :error_msg => error_message % overall_errors, :redirect => :back
173
180
  end
174
181
  end
175
182
  end
@@ -30,7 +30,7 @@ module DiscoveredHostsHelper
30
30
 
31
31
  select_action_button( _("Select Action"), {:id => 'submit_multiple'},
32
32
  actions.map do |action|
33
- link_to(action[0] , action[1], :'data-dialog-title' => _("%s - The following hosts are about to be changed") % action[0])
33
+ link_to_function(action[0], "build_modal(this, '#{action[1]}')", :'data-dialog-title' => _("%s - The following hosts are about to be changed") % action[0])
34
34
  end.flatten
35
35
  )
36
36
 
@@ -15,7 +15,6 @@ class DiscoveryRule < ActiveRecord::Base
15
15
  validates :max_count, :numericality => { :only_integer => true, :greater_than_or_equal_to => 0 }
16
16
  validates :priority, :presence => true, :numericality => { :only_integer => true, :greater_than_or_equal_to => 0 }
17
17
  validates_lengths_from_database
18
- before_validation :default_int_attributes
19
18
 
20
19
  belongs_to :hostgroup
21
20
  has_many :hosts
@@ -24,10 +23,4 @@ class DiscoveryRule < ActiveRecord::Base
24
23
  scoped_search :on => :priority
25
24
  scoped_search :on => :search
26
25
  scoped_search :on => :enabled
27
- scoped_search :in => :hostgroup, :on => :name, :complete_value => true, :rename => :hostgroup
28
-
29
- def default_int_attributes
30
- self.max_count ||= 0
31
- self.priority ||= 0
32
- end
33
26
  end
@@ -9,8 +9,6 @@ class Host::Discovered < ::Host::Base
9
9
  belongs_to :hostgroup
10
10
  has_one :discovery_attribute_set, :foreign_key => :host_id, :dependent => :destroy
11
11
 
12
- validates :mac, :uniqueness => true, :mac_address => true, :presence => true
13
- validates :ip, :format => {:with => Net::Validations::IP_REGEXP}, :uniqueness => true
14
12
  validates :discovery_attribute_set, :presence => true
15
13
 
16
14
  delegate :memory, :cpu_count, :disk_count, :disks_size, :to => :discovery_attribute_set
@@ -92,8 +90,14 @@ class Host::Discovered < ::Host::Base
92
90
  super
93
91
  end
94
92
 
93
+ def setup_clone
94
+ # Nic::Managed needs this method but Discovered hosts shouldn't
95
+ # be doing orchestration anyway...
96
+ clone
97
+ end
98
+
95
99
  def attributes_to_import_from_facts
96
- super + [:ip]
100
+ super
97
101
  end
98
102
 
99
103
  def populate_fields_from_facts facts = self.facts_hash, type = 'puppet'
@@ -103,7 +107,7 @@ class Host::Discovered < ::Host::Base
103
107
  else
104
108
  importer = super(facts)
105
109
  end
106
- self.subnet = Subnet.subnet_for(importer.ip)
110
+ self.primary_interface.subnet = Subnet.subnet_for(self.primary_interface.ip)
107
111
  self.discovery_attribute_set = DiscoveryAttributeSet.where(:host_id => id).first_or_create
108
112
  self.discovery_attribute_set.update_attributes(import_from_facts)
109
113
  self.save
@@ -178,4 +182,10 @@ class Host::Discovered < ::Host::Base
178
182
  false
179
183
  end
180
184
 
185
+ def lookup_value_match
186
+ # We don't really expect lookup values to be used to match discovered hosts,
187
+ # so simply put a string that won't match anything here
188
+ "discovery-not-matched"
189
+ end
190
+
181
191
  end
@@ -1,6 +1,6 @@
1
1
  class ForemanDiscovery::HostConverter
2
2
 
3
- # must be called from SQL transaction
3
+ # must be called from SQL transaction
4
4
  def self.to_managed(original_host, set_managed = true, set_build = true)
5
5
  if ActiveRecord::Base.connection.open_transactions <= 0
6
6
  raise "This method must be executed with explicit transaction"
@@ -10,7 +10,7 @@ class ForemanDiscovery::HostConverter
10
10
  # the following flags can be skipped when parameters are set to false
11
11
  if set_managed
12
12
  host.managed = set_managed
13
- host.managed = set_managed
13
+ host.primary_interface.managed = set_managed
14
14
  end
15
15
  host.build = set_build if set_build
16
16
  # this gets rolled back when anything in the transaction fails
@@ -2,9 +2,4 @@ object @discovery_rule
2
2
 
3
3
  extends "api/v2/discovery_rules/base"
4
4
 
5
- attributes :name, :enabled, :hostgroup_id, :hostgroup_name, :hostname, :priority, :search
6
- attribute :max_count => :hosts_limit
7
-
8
- child :hosts do
9
- extends "api/v2/discovered_hosts/base"
10
- end
5
+ attributes :name, :enabled, :hostgroup_id, :hostname, :max_count, :priority, :search
@@ -1,4 +1,4 @@
1
- <td><%= link_to h(host.name), discovered_host_path(host) %></td>
1
+ <td><%= link_to trunc_with_tooltip(h(host.name)), discovered_host_path(host) %></td>
2
2
  <td class="hidden-tablet hidden-xs"><%= model_name host %></td>
3
3
  <td class="hidden-tablet hidden-xs"><%= host.ip %></td>
4
4
  <td class="hidden-tablet hidden-xs"><%= discovery_attribute(host, :cpu_count) %></td>
@@ -35,7 +35,7 @@
35
35
  <% if SETTINGS[:organizations_enabled] -%>
36
36
  <td class="hidden-tablet hidden-xs"><%= host.organization.try(:name) %></td>
37
37
  <% end -%>
38
- <td class="hidden-tablet hidden-xs"><%= host.subnet %></td>
38
+ <td class="hidden-tablet hidden-xs"><%= host.primary_interface.try(:subnet) %></td>
39
39
  <td class="hidden-tablet hidden-xs"><%= disc_report_column(host) %></td>
40
40
  <td>
41
41
  <%= action_buttons(
@@ -61,7 +61,7 @@
61
61
  </div>
62
62
  <div class="modal-footer">
63
63
  <button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
64
- <button type="button" class="btn btn-primary"><%= _('Submit') %></button>
64
+ <button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
65
65
  </div>
66
66
  </div><!-- /.modal-content -->
67
67
  </div><!-- /.modal-dialog -->
@@ -13,10 +13,10 @@
13
13
  </tr>
14
14
  <% for rule in @discovery_rules %>
15
15
  <tr>
16
- <td class='col-md-3 display-two-pane'><%= link_to_if_authorized(rule.name, hash_for_edit_discovery_rule_path(:id => rule).merge(:auth_object => rule, :authorizer => authorizer)) %></td>
16
+ <td class='col-md-3 display-two-pane'><%= link_to_if_authorized(trunc_with_tooltip(rule.name), hash_for_edit_discovery_rule_path(:id => rule).merge(:auth_object => rule, :authorizer => authorizer)) %></td>
17
17
  <td><%= rule.priority %></td>
18
- <td><%= rule.search %></td>
19
- <td><%= rule.hostgroup.name %></td>
18
+ <td><%= trunc_with_tooltip(rule.search) %></td>
19
+ <td><%= label_with_link(rule.hostgroup, 26, authorizer) %></td>
20
20
  <td><%= rule.hosts.count %> / <%= rule.max_count %></td>
21
21
  <td><%= rule.enabled %></td>
22
22
  <td><%= action_buttons(*permitted_discovery_actions(rule)) %></td>
@@ -37,7 +37,7 @@ module ForemanDiscovery
37
37
 
38
38
  initializer 'foreman_discovery.register_plugin', :after=> :finisher_hook do |app|
39
39
  Foreman::Plugin.register :foreman_discovery do
40
- requires_foreman '~> 1.7.0'
40
+ requires_foreman '>= 1.8.0'
41
41
 
42
42
  # discovered hosts permissions
43
43
  security_block :discovery do
@@ -106,6 +106,10 @@ module ForemanDiscovery
106
106
 
107
107
  # add template helpers
108
108
  allowed_template_helpers :rand
109
+
110
+ # apipie API documentation
111
+ # Only available in 1.8, otherwise it has to be in the initializer below
112
+ apipie_documented_controllers ["#{ForemanDiscovery::Engine.root}/app/controllers/api/v2/*.rb"]
109
113
  end
110
114
  end
111
115
 
@@ -114,13 +118,6 @@ module ForemanDiscovery
114
118
  end
115
119
 
116
120
  initializer "foreman_discovery.apipie" do
117
- # this condition is here for compatibility reason to work with Foreman 1.4.x
118
- # Also need to handle the reverse of the 1.8 method above
119
- unless (SETTINGS[:version].to_s.include?('develop') or Gem::Version.new(SETTINGS[:version]) >= Gem::Version.new('1.8'))
120
- if Apipie.configuration.api_controllers_matcher.is_a?(Array)
121
- Apipie.configuration.api_controllers_matcher << "#{ForemanDiscovery::Engine.root}/app/controllers/api/v2/*.rb"
122
- end
123
- end
124
121
  if Apipie.configuration.respond_to?(:checksum_path)
125
122
  Apipie.configuration.checksum_path += ['/discovered_hosts/']
126
123
  end