foreman_discovery 4.1.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69250341871bac524c73e7a2271de18f888143d5
4
- data.tar.gz: d1e2264fbe02bb72254eae7ff5ded196c81be22f
3
+ metadata.gz: 3f374078ca62446b7d03fd98a002238e45cc9564
4
+ data.tar.gz: 843df4136fa29c634e7446349ba2ad358902662f
5
5
  SHA512:
6
- metadata.gz: 55bb62046e1c7c03e21410df0b24163fb9405267d9b7d4d28b7815c825177666b89062d00c164683e4ab1511efa04297bb5730daefe389f92bb60b2ae4336db1
7
- data.tar.gz: 2cd78477e03df12ba1f1ff9c0fc0ee0ca85b3572c4a75402ea09f0d804cd1056111bfc1607ea13d84616215d62d4099f417f5ef490675a927d16393a2aad6f45
6
+ metadata.gz: 1a8eeb66a019a1d99e8c2705698a7fd410e6ed993cb00a1ee1b5c16d39fe22168d4c01cb5bcc72f49dd40bc4d08545d94ab0be95cd682ac843d9eb462a8f79b5
7
+ data.tar.gz: debdc05bee101a87d3154f03ff600f090e5186e05f941d8d7c7e61377acfa4679396b999d442b98583e5a7355e6ffdcc2bf42eb4c7a0e19b6f3fc2d06262d331
@@ -2,9 +2,11 @@ class DiscoveredHostsController < ::ApplicationController
2
2
  include Foreman::Controller::AutoCompleteSearch
3
3
  include Foreman::Controller::TaxonomyMultiple
4
4
  include Foreman::Controller::DiscoveredExtensions
5
+ include ActionView::Helpers::NumberHelper
5
6
  unloadable
6
7
 
7
- before_filter :find_by_name, :only => %w[show edit update destroy refresh_facts convert reboot auto_provision]
8
+ before_filter :find_by_name, :only => %w[edit update destroy refresh_facts convert reboot auto_provision]
9
+ before_filter :find_by_name_incl_subnet, :only => [:show]
8
10
  before_filter :find_multiple, :only => [:multiple_destroy, :submit_multiple_destroy]
9
11
  before_filter :taxonomy_scope, :only => [:edit]
10
12
 
@@ -26,9 +28,16 @@ class DiscoveredHostsController < ::ApplicationController
26
28
  def show
27
29
  # filter graph time range
28
30
  @range = nil
29
-
30
31
  # summary report text
31
32
  @report_summary = nil
33
+ init_regex_and_categories
34
+ @interfaces = []
35
+ get_interfaces
36
+ @host.facts_hash.each do |key, value|
37
+ value = number_to_human_size(value) if /size$/.match(key)
38
+ assign_fact_to_category(key, value) unless @interfaces.any? {|interface| key.include? interface[:identifier]}
39
+ end
40
+ add_custom_facts
32
41
  end
33
42
 
34
43
  def destroy
@@ -171,13 +180,35 @@ class DiscoveredHostsController < ::ApplicationController
171
180
 
172
181
  private
173
182
 
183
+ def init_regex_and_categories
184
+ hightlights = Setting[:discovery_facts_highlights].empty? ? /^(productname|memorysize|manufacturer|architecture|macaddress$|processorcount|physicalprocessorcount|discovery_subnet|discovery_boot|ipaddress$)/ : Regexp.new(eval(Setting[:discovery_facts_highlights]))
185
+ storage = Setting[:discovery_facts_storage].empty? ? /^blockdevice/ : Regexp.new(eval(Setting[:discovery_facts_storage]))
186
+ hardware = Setting[:discovery_facts_hardware].empty? ? /^(hardw|manufacturer|memo|process)/ : Regexp.new(eval(Setting[:discovery_facts__hardware]))
187
+ network = Setting[:discovery_facts_network].empty? ? /^(ipaddress|interfaces|dhcp|fqdn|hostname|link|mtu|net|macaddress|wol|port|speed)/ : Regexp.new(eval(Setting[:discovery_facts_network]))
188
+ software = Setting[:discovery_facts_software].empty? ? /^(bios|os|discovery)/ : Regexp.new(eval(Setting[:discovery_facts_software]))
189
+ ipmi = Setting[:discovery_facts_ipmi].empty? ? /^ipmi/ : Regexp.new(eval(Setting[:discovery_facts_ipmi]))
190
+ @regex_array = [hightlights, storage, hardware, network, software, ipmi, false]
191
+ @categories = Array.new(7) { Hash.new }
192
+ @categories_names = [:Hightlights, :Storage, :Hardware, :Network, :Software, :IPMI, :Misceleneous]
193
+ end
194
+
195
+ def assign_fact_to_category(key, value )
196
+ @regex_array.each_with_index do |regex, index|
197
+ if !regex
198
+ @categories[index][key] = value
199
+ elsif regex.match key
200
+ @categories[index][key] = value
201
+ break
202
+ end
203
+ end
204
+ end
205
+
174
206
  def resource_base
175
207
  @resource_base ||= ::Host::Discovered.authorized(current_permission, ::Host::Discovered)
176
208
  end
177
209
 
178
210
  def load_vars_for_ajax
179
211
  return unless @host
180
-
181
212
  @environment = @host.environment
182
213
  @architecture = @host.architecture
183
214
  @domain = @host.domain
@@ -213,13 +244,17 @@ class DiscoveredHostsController < ::ApplicationController
213
244
  end
214
245
  end
215
246
 
216
- def find_by_name
247
+ def find_by_name(*includes)
217
248
  params[:id].downcase! if params[:id].present?
218
- @host = resource_base.find_by_id(params[:id])
219
- @host ||= resource_base.find_by_name(params[:id])
249
+ @host = includes.empty? ? resource_base.find_by_id(params[:id]) : resource_base.includes(includes).find_by_id(params[:id])
250
+ @host ||= includes.empty? ? resource_base.find_by_name(params[:id]) : resource_base.includes(includes).find_by_name(params[:id])
220
251
  return false unless @host
221
252
  end
222
253
 
254
+ def find_by_name_incl_subnet
255
+ find_by_name({:interfaces => :subnet})
256
+ end
257
+
223
258
  def find_multiple
224
259
  # Lets search by name or id and make sure one of them exists first
225
260
  if params[:host_names].present? or params[:host_ids].present?
@@ -262,4 +297,17 @@ class DiscoveredHostsController < ::ApplicationController
262
297
  ensure
263
298
  Bullet.enable = true if defined? Bullet
264
299
  end
300
+
301
+ def get_interfaces
302
+ @host.interfaces.each do |interface|
303
+ @interfaces << {:identifier => interface["identifier"], :type => interface["type"], :mac => interface["mac"], :ip => interface["ip"]? interface["ip"] : "N/A", :primary => interface["primary"], :provision => interface["provision"]}
304
+ end
305
+ end
306
+
307
+ def add_custom_facts
308
+ unless @host.primary_interface.subnet.nil?
309
+ discovery_subnet = "#{@host.primary_interface.subnet.name} (#{@host.primary_interface.subnet.network})"
310
+ assign_fact_to_category("discovery_subnet", discovery_subnet)
311
+ end
312
+ end
265
313
  end
@@ -1,5 +1,12 @@
1
1
  module DiscoveredHostsHelper
2
2
 
3
+ def attach_flags(interface)
4
+ flags = ""
5
+ flags += "flag-primary " if interface[:primary]
6
+ flags += "flag-provision" if interface[:provision]
7
+ flags
8
+ end
9
+
3
10
  def disc_report_column(record)
4
11
  record.last_report? ? (_("%s ago") % time_ago_in_words(record.last_report.getlocal)) : ""
5
12
  end
@@ -10,12 +17,20 @@ module DiscoveredHostsHelper
10
17
  actions << [_('Refresh facts') ,hash_for_refresh_facts_discovered_host_path(:id => host)]
11
18
  actions << [_('Reboot') ,hash_for_reboot_discovered_host_path(:id => host), :method => :put]
12
19
  title_actions(
20
+ button_group(
21
+ link_to(_("Back"), :back)
22
+ ),
13
23
  select_action_button( _("Select Action"), {},
14
24
  actions.map do |action|
15
25
  method = action[2] if action.size > 1
16
26
  link_to(action[0] , action[1], method)
17
27
  end.flatten
18
28
  ),
29
+ button_group(
30
+ link_to(_("Expand All"),"#",:class => "btn ",:onclick => "$('.glyphicon-plus-sign').toggleClass('glyphicon glyphicon-minus-sign glyphicon glyphicon-plus-sign');
31
+ $('.facts-panel').addClass('collapse in').height('auto');"
32
+ )
33
+ ),
19
34
  button_group(
20
35
  link_to(_("Delete"), hash_for_discovered_host_path(:id => host),
21
36
  :class => "btn btn-danger", :confirm => _('Are you sure?'), :method => :delete)
@@ -2,6 +2,8 @@ module DiscoverySubnet
2
2
  extend ActiveSupport::Concern
3
3
  included do
4
4
  belongs_to :discovery, :class_name => "SmartProxy"
5
+
6
+ attr_accessible :discovery_id
5
7
  end
6
8
  end
7
9
 
@@ -5,6 +5,8 @@ class DiscoveryRule < ActiveRecord::Base
5
5
  include Parameterizable::ByIdName
6
6
  include Taxonomix
7
7
 
8
+ attr_accessible :name, :priority, :search, :enabled, :hostgroup, :hostgroup_id, :max_count, :hostname
9
+
8
10
  validates :name, :presence => true, :uniqueness => true,
9
11
  :format => { :with => /\A(\S+)\Z/, :message => N_("can't contain white spaces.") }
10
12
  validates :search, :presence => true
@@ -1,6 +1,8 @@
1
1
  class Host::Discovered < ::Host::Base
2
2
  include ScopedSearchExtensions
3
3
 
4
+ attr_accessible :discovery_rule_id
5
+
4
6
  belongs_to :hostgroup
5
7
  has_one :discovery_attribute_set, :foreign_key => :host_id, :dependent => :destroy
6
8
 
@@ -10,6 +10,7 @@ module Host::ManagedExtensions
10
10
 
11
11
  # extra flag for post_queue callbacks which has no access to facts
12
12
  attr_accessor :legacy_api
13
+ attr_accessible :discovery_rule_id
13
14
  end
14
15
 
15
16
  def queue_reboot
@@ -35,11 +36,16 @@ module Host::ManagedExtensions
35
36
  end
36
37
 
37
38
  def boot_url pxe_file
38
- operatingsystem.medium_vars_to_uri("#{medium.path}/#{operatingsystem.url_for_boot(pxe_file)}", architecture.name, operatingsystem).to_s
39
+ raise ::Foreman::Exception.new(N_("Operating system not set for host/hostgroup")) unless operatingsystem
40
+ base = operatingsystem.medium_uri(self)
41
+ raise ::Foreman::Exception.new(N_("Medium not set for host/hostgroup")) unless base
42
+ path = operatingsystem.url_for_boot(pxe_file)
43
+ operatingsystem.medium_vars_to_uri("#{base}/#{path}", architecture.name, operatingsystem).to_s
39
44
  end
40
45
 
41
46
  def setKexec
42
47
  template = provisioning_template(:kind => 'kexec')
48
+ raise ::Foreman::Exception.new(N_("Kexec template not associated with operating system")) unless template
43
49
  @host = self
44
50
  @kernel = boot_url(:kernel)
45
51
  @initrd = boot_url(:initrd)
@@ -3,5 +3,6 @@ module HostgroupExtensions
3
3
 
4
4
  included do
5
5
  has_many :discovery_rules
6
+ attr_accessible :discovery_rules, :discovery_rule_ids, :discovery_rule_names, :type
6
7
  end
7
8
  end
@@ -2,6 +2,12 @@ class Setting::Discovered < ::Setting
2
2
  BLANK_ATTRS << "discovery_location"
3
3
  BLANK_ATTRS << "discovery_organization"
4
4
  BLANK_ATTRS << "discovery_fact_column"
5
+ BLANK_ATTRS << 'discovery_facts_highlights'
6
+ BLANK_ATTRS << 'discovery_facts_storage'
7
+ BLANK_ATTRS << 'discovery_facts_software'
8
+ BLANK_ATTRS << 'discovery_facts_hardware'
9
+ BLANK_ATTRS << 'discovery_facts_network'
10
+ BLANK_ATTRS << 'discovery_facts_ipmi'
5
11
 
6
12
  def self.load_defaults
7
13
  # Check the table exists
@@ -42,6 +48,16 @@ class Setting::Discovered < ::Setting
42
48
  end
43
49
  end
44
50
 
51
+ Setting.transaction do
52
+ [
53
+ self.set('discovery_facts_highlights', N_("Regex to organize facts for highlights section"), ""),
54
+ self.set('discovery_facts_storage', N_("Regex to organize facts for storage section"), ""),
55
+ self.set('discovery_facts_software', N_("Regex to organize facts for software section"), ""),
56
+ self.set('discovery_facts_hardware', N_("Regex to organize facts for hardware section"), ""),
57
+ self.set('discovery_facts_network', N_("Regex to organize facts for network section"), ""),
58
+ self.set('discovery_facts_ipmi', N_("Regex to organize facts for ipmi section"), ""),
59
+ ].compact.each { |s| self.create s.update(:category => "Setting::Discovered")}
60
+ end
45
61
  true
46
62
 
47
63
  end
@@ -14,44 +14,4 @@ module ForemanDiscovery::NodeAPI
14
14
  end
15
15
  end
16
16
  end
17
-
18
- class PowerService < NodeResource
19
- def url
20
- @args[:url] + "/power"
21
- end
22
-
23
- def reboot
24
- put({}, "/reboot")
25
- end
26
-
27
- def kexec(json)
28
- put(json, "/kexec")
29
- end
30
-
31
- end
32
-
33
- # legacy /reboot call direct
34
- class PowerLegacyDirectService < NodeResource
35
- def initialize(args)
36
- super args
37
- raise ArgumentError, "Legacy direct service only supports http scheme" if scheme != 'http'
38
- raise ArgumentError, "Legacy direct service only supports port 8443" if port != 8443
39
- Foreman::Deprecation.deprecation_warning("1.11", "Discovery legacy API will be removed, use the new Power API")
40
- end
41
-
42
- def reboot
43
- ::ProxyAPI::BMC.new(:url => url).power :action => "cycle"
44
- end
45
- end
46
-
47
- # legacy /reboot call via proxy
48
- class PowerLegacyProxiedService < NodeResource
49
- def initialize(args)
50
- super args.merge(:proxy => true)
51
- end
52
-
53
- def reboot
54
- put({}, "/reboot")
55
- end
56
- end
57
17
  end
@@ -0,0 +1,15 @@
1
+ module ForemanDiscovery::NodeAPI
2
+ # legacy /reboot call direct
3
+ class PowerLegacyDirectService < NodeResource
4
+ def initialize(args)
5
+ super args
6
+ raise ArgumentError, "Legacy direct service only supports http scheme" if scheme != 'http'
7
+ raise ArgumentError, "Legacy direct service only supports port 8443" if port != 8443
8
+ Foreman::Deprecation.deprecation_warning("1.11", "Discovery legacy API will be removed, use the new Power API")
9
+ end
10
+
11
+ def reboot
12
+ ::ProxyAPI::BMC.new(:url => url).power :action => "cycle"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ module ForemanDiscovery::NodeAPI
2
+ # legacy /reboot call via proxy
3
+ class PowerLegacyProxiedService < NodeResource
4
+ def initialize(args)
5
+ super args.merge(:proxy => true)
6
+ end
7
+
8
+ def reboot
9
+ put({}, "/reboot")
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ module ForemanDiscovery::NodeAPI
2
+ class PowerService < NodeResource
3
+ def url
4
+ @args[:url] + "/power"
5
+ end
6
+
7
+ def reboot
8
+ put({}, "/reboot")
9
+ end
10
+
11
+ def kexec(json)
12
+ put(json, "/kexec")
13
+ end
14
+
15
+ end
16
+ end
@@ -1,4 +1,4 @@
1
- <% all_hosts = Host::Discovered.includes(:model).includes(:discovery_attribute_set).scoped %>
1
+ <% all_hosts = Host::Discovered.includes(:model).includes(:discovery_attribute_set).all %>
2
2
  <% hosts = all_hosts.limit(6) %>
3
3
 
4
4
  <h4 class="header">
@@ -2,15 +2,94 @@
2
2
 
3
3
  <%= discovered_hosts_title_actions(@host) %>
4
4
 
5
- <h3><%= _('Facts discovered on this host') -%></h3>
6
- <table class="table table-bordered table-striped table-condensed">
7
- <tr>
8
- <th><%= _('Fact') -%></th>
9
- <th><%= _('Value') -%></th>
10
- <% @host.facts_hash.sort.each do |fact| -%>
11
- <tr>
12
- <td><%= fact[0] %></td>
13
- <td><%= truncate(fact[1], :length => 100) %></td>
14
- </tr>
15
- <% end -%>
16
- </table>
5
+ <div class="row">
6
+ <div class="col-md-6">
7
+ <div class="panel panel-default">
8
+ <div class="panel-heading" ><strong> <%= @categories_names[0] %></strong> </div>
9
+ <table class="table table-bordered table-condensed table-fixed">
10
+ <% @categories[0].sort.each do |keys, val| %>
11
+ <tr class="">
12
+ <th class="ellipsis" width="40%"> <strong> <%= keys %> </strong></th>
13
+ <td><%= val %></td>
14
+ </tr>
15
+ <% end -%>
16
+ </table>
17
+ </div>
18
+ <% unless @interfaces.empty? %>
19
+ <div class="panel panel-default">
20
+ <div class="panel-heading" role="tab">
21
+ <h4 class="panel-title">
22
+ <a role="button" class="expendable-link" data-toggle="collapse" data-parent="#accordion" href="#interfaces-panel" aria-expanded="true" onclick="$(this).find(':first-child').toggleClass('glyphicon glyphicon-minus-sign glyphicon glyphicon-plus-sign')">
23
+ <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
24
+ Interfaces
25
+ </a>
26
+ </h4>
27
+ </div>
28
+ <div id="interfaces-panel" class="panel-collapse collapse facts-panel in" >
29
+ <table class="table table-bordered table-condensed table-fixed" id="interfaceList">
30
+ <tr>
31
+ <th class="hidden-xs " width="12%"></th>
32
+ <th class="hidden-xs "><%= _('Identifier') %></th>
33
+ <th class="hidden-xs "><%= _("MAC address") %></th>
34
+ <th class="hidden-xs "><%= _("IP address") %></th>
35
+ </tr>
36
+ <% @interfaces.each do |interface| %>
37
+ <tr>
38
+ <td class="<%= attach_flags(interface) %> ellipsis"></td>
39
+ <td class="ellipsis"><%= interface[:identifier] %></td>
40
+ <td class="ellipsis"><%= interface[:mac] %></td>
41
+ <td class="ellipsis"><%= interface[:ip] %></td>
42
+ </tr>
43
+ <% end %>
44
+ </table>
45
+ </div>
46
+ </div>
47
+ <% end %>
48
+ </div>
49
+
50
+ <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
51
+ <div class="col-md-6">
52
+ <% @categories.each_with_index do |val, index| %>
53
+ <% next if index == 0 || val.empty? %>
54
+ <div class="panel panel-default">
55
+ <div class="panel-heading" role="tab">
56
+ <h4 class="panel-title">
57
+ <a role="button" class="expendable-link" data-toggle="collapse" data-parent="#accordion" href="#<%= @categories_names[index].to_s + "panel" %>" aria-expanded="true" onclick="$(this).find(':first-child').toggleClass('glyphicon glyphicon-minus-sign glyphicon glyphicon-plus-sign')">
58
+ <span class="glyphicon glyphicon<%= (@categories_names[index].to_s.include?("Storage")? "-minus-sign":"-plus-sign")%>" aria-hidden="true"></span>
59
+ <%= @categories_names[index] %>
60
+ </a>
61
+ </h4>
62
+ </div>
63
+ <div id="<%= @categories_names[index].to_s + "panel" %>" class="panel-collapse collapse facts-panel <%= "in" if @categories_names[index].to_s.include?"Storage"%>" role="tabpanel">
64
+ <table class="table table-bordered table-condensed table-fixed">
65
+ <% val.sort.each do |key, value| %>
66
+ <tr class="">
67
+ <th width="40%" class="ellipsis"><strong> <%= key %> </strong> </th>
68
+ <td class="ellipsis"> <%= value %> </td>
69
+ </tr>
70
+ <% end %>
71
+ </table>
72
+ </div>
73
+ </div>
74
+ <% end -%>
75
+ </div>
76
+ </div>
77
+ </div>
78
+
79
+ <script type="text/javascript" charset="utf-8">
80
+ $(document).ready(function(){
81
+ $("table").css('padding', '0');
82
+ $("table").css("cssText", 'margin-bottom: 0 !important;');
83
+ $(".panel-default").css('margin-bottom', "10px")
84
+
85
+ provision_class = 'active'
86
+ primary_class = 'active'
87
+ var flag_primary = '<i class="glyphicon glyphicon glyphicon-tag primary-flag '+ primary_class +'" title="" data-original-title="'+ __('Primary') +'"></i>';
88
+ var flags_provision = '<i class="glyphicon glyphicon glyphicon-hdd provision-flag '+ provision_class +'" title="" data-original-title="'+ __('Provisioning') +'"></i>';
89
+
90
+ $('.flag-primary').html(flag_primary);
91
+ $('.flag-provision').append(flags_provision);
92
+ $('.primary-flag').tooltip();
93
+ $('.provision-flag').tooltip();
94
+ });
95
+ </script>
@@ -2,9 +2,9 @@
2
2
  Rails.application.routes.draw do
3
3
 
4
4
  # Needed to make the hosts/edit form render
5
- match 'architecture_selected_discovered_hosts' => 'hosts#architecture_selected'
6
- match 'os_selected_discovered_hosts' => 'hosts#os_selected'
7
- match 'medium_selected_discovered_hosts' => 'hosts#medium_selected'
5
+ get 'architecture_selected_discovered_hosts' => 'hosts#architecture_selected'
6
+ get 'os_selected_discovered_hosts' => 'hosts#os_selected'
7
+ get 'medium_selected_discovered_hosts' => 'hosts#medium_selected'
8
8
 
9
9
  constraints(:id => /[^\/]+/) do
10
10
  resources :discovered_hosts, :except => [:new, :create] do
@@ -1,6 +1,6 @@
1
1
  class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration
2
2
  def up
3
- Host::Discovered.scoped.each { |host| host.populate_fields_from_facts}
3
+ Host::Discovered.all.each { |host| host.populate_fields_from_facts}
4
4
  end
5
5
 
6
6
  def down
@@ -1,9 +1,8 @@
1
- kind = TemplateKind.find_or_create_by_name('kexec')
1
+ kind = TemplateKind.where(:name => 'kexec').first_or_create
2
2
 
3
3
  ProvisioningTemplate.without_auditing do
4
4
  content = File.read(File.join(ForemanDiscovery::Engine.root, 'app', 'views', 'foreman_discovery', 'redhat_kexec.erb'))
5
- tmpl = ProvisioningTemplate.find_or_create_by_name(
6
- :name => 'Discovery Red Hat kexec',
5
+ tmpl = ProvisioningTemplate.where(:name => 'Discovery Red Hat kexec').first_or_create(
7
6
  :template_kind_id => kind.id,
8
7
  :snippet => false,
9
8
  :template => content
@@ -1,2 +1,2 @@
1
- f = Feature.find_or_create_by_name('Discovery')
1
+ f = Feature.where(:name => 'Discovery').first_or_create
2
2
  raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
@@ -39,12 +39,14 @@ module ForemanDiscovery
39
39
 
40
40
  # Add any db migrations
41
41
  initializer "foreman_discovery.load_app_instance_data" do |app|
42
- app.config.paths['db/migrate'] += ForemanDiscovery::Engine.paths['db/migrate'].existent
42
+ ForemanDiscovery::Engine.paths['db/migrate'].existent.each do |path|
43
+ app.config.paths['db/migrate'] << path
44
+ end
43
45
  end
44
46
 
45
47
  initializer 'foreman_discovery.register_plugin', :after=> :finisher_hook do |app|
46
48
  Foreman::Plugin.register :foreman_discovery do
47
- requires_foreman '>= 1.9.0'
49
+ requires_foreman '>= 1.11.0'
48
50
 
49
51
  # discovered hosts permissions
50
52
  security_block :discovery do
@@ -147,10 +149,6 @@ module ForemanDiscovery
147
149
  end
148
150
  end
149
151
 
150
- initializer "foreman_discovery.load_app_instance_data" do |app|
151
- app.config.paths['db/migrate'] += ForemanDiscovery::Engine.paths['db/migrate'].existent
152
- end
153
-
154
152
  initializer "foreman_discovery.apipie" do
155
153
  if Apipie.configuration.respond_to?(:checksum_path)
156
154
  Apipie.configuration.checksum_path += ['/discovered_hosts/']
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "4.1.2"
2
+ VERSION = "5.0.0"
3
3
  end
@@ -0,0 +1,506 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2015 Foreman developers
3
+ # This file is distributed under the same license as the foreman_discovery package.
4
+ #
5
+ # Translators:
6
+ # Robert Antoni Buj i Gelonch <rbuj@fedoraproject.org>, 2015
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Foreman\n"
10
+ "Report-Msgid-Bugs-To: foreman-dev@googlegroups.com\n"
11
+ "POT-Creation-Date: 2015-10-15 09:33+0200\n"
12
+ "PO-Revision-Date: 2015-12-08 13:32+0000\n"
13
+ "Last-Translator: Robert Antoni Buj i Gelonch <rbuj@fedoraproject.org>\n"
14
+ "Language-Team: Catalan (http://www.transifex.com/foreman/foreman/language/ca/)\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Language: ca\n"
19
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
+
21
+ msgid "%s - The following hosts are about to be changed"
22
+ msgstr "%s - Els següents amfitrions estan a punt de ser canviats"
23
+
24
+ msgid "%s ago"
25
+ msgstr "fa %s"
26
+
27
+ msgid "%s discovered hosts were provisioned"
28
+ msgstr "%s amfitrions descoberts van ser aprovisionats"
29
+
30
+ msgid "Are you sure?"
31
+ msgstr "Esteu segur?"
32
+
33
+ msgid "Assign Location"
34
+ msgstr "Assigna la ubicació"
35
+
36
+ msgid "Assign Organization"
37
+ msgstr "Assigna l'organització"
38
+
39
+ msgid "Auto Provision"
40
+ msgstr ""
41
+
42
+ msgid "Auto Provision All"
43
+ msgstr ""
44
+
45
+ msgid ""
46
+ "Automatically provision newly discovered hosts, according to the "
47
+ "provisioning rules"
48
+ msgstr ""
49
+
50
+ msgid "Automatically reboot discovered host during provisioning"
51
+ msgstr ""
52
+
53
+ msgid "CPUs"
54
+ msgstr "Les CPU"
55
+
56
+ msgid "Cancel"
57
+ msgstr "Cancel·la"
58
+
59
+ msgid "Could not get facts from proxy %{url}: %{error}"
60
+ msgstr "No s'han pogut obtenir els objectes d'interès del servidor intermediari %{url}: %{error}"
61
+
62
+ msgid "Create a discovered host for testing (use /facts to create new hosts)"
63
+ msgstr "Crea un amfitrió descobert per a provar-ho (utilitzeu /facts per crear nous amfitrions)"
64
+
65
+ msgid "Create a discovery rule"
66
+ msgstr "Crea una regla de descobriment"
67
+
68
+ msgid "Delete"
69
+ msgstr "Suprimeix"
70
+
71
+ msgid "Delete %s?"
72
+ msgstr "Voleu suprimir %s?"
73
+
74
+ msgid "Delete a discovered host"
75
+ msgstr ""
76
+
77
+ msgid "Delete a rule"
78
+ msgstr "Suprimeix una regla"
79
+
80
+ msgid "Delete hosts"
81
+ msgstr ""
82
+
83
+ msgid "Destroyed selected hosts"
84
+ msgstr ""
85
+
86
+ msgid "Disable"
87
+ msgstr ""
88
+
89
+ msgid "Disable rule?"
90
+ msgstr ""
91
+
92
+ msgid "Discovered host: %s"
93
+ msgstr ""
94
+
95
+ msgid "Discovered hosts"
96
+ msgstr ""
97
+
98
+ msgid "Discovered hosts are provisioning now"
99
+ msgstr ""
100
+
101
+ msgid "Discovered hosts are rebooting now"
102
+ msgstr ""
103
+
104
+ msgid "Discovery Rules"
105
+ msgstr "Regles de descobriment"
106
+
107
+ msgid "DiscoveryRule|Enabled"
108
+ msgstr "Habilitada"
109
+
110
+ msgid "DiscoveryRule|Name"
111
+ msgstr "Nom"
112
+
113
+ msgid "DiscoveryRule|Priority"
114
+ msgstr "Prioritat"
115
+
116
+ msgid "DiscoveryRule|Query"
117
+ msgstr "Consulta"
118
+
119
+ msgid "Disk count"
120
+ msgstr "Nombre de disc"
121
+
122
+ msgid "Disks size"
123
+ msgstr "Mida de disc"
124
+
125
+ msgid ""
126
+ "Domain will be appended automatically. A hostname based on MAC address will "
127
+ "be used when left blank. In addition to @host attribute function rand for "
128
+ "random integers is available. Examples:"
129
+ msgstr ""
130
+
131
+ msgid "Edit Discovery Rule"
132
+ msgstr "Edita la regla de descobriment"
133
+
134
+ msgid "Enable"
135
+ msgstr ""
136
+
137
+ msgid "Enable rule?"
138
+ msgstr ""
139
+
140
+ msgid "Errors during auto provisioning: %s"
141
+ msgstr ""
142
+
143
+ msgid "Errors during reboot: %s"
144
+ msgstr ""
145
+
146
+ msgid "Execute rules against a discovered host"
147
+ msgstr ""
148
+
149
+ msgid "Execute rules against all currently discovered hosts"
150
+ msgstr ""
151
+
152
+ msgid ""
153
+ "Expected discovery_fact '%s' is missing, unable to detect primary interface "
154
+ "and set hostname"
155
+ msgstr ""
156
+
157
+ msgid "Extra facter columns to show in host lists (separate by comma)"
158
+ msgstr ""
159
+
160
+ msgid "Fact"
161
+ msgstr "Objecte d'interès"
162
+
163
+ msgid "Fact name to use for primary interface detection and hostname"
164
+ msgstr "Nom de l'objecte d'interès per utilitzar-ho per a la detecció de la interfície primària i el nom d'amfitrió"
165
+
166
+ msgid "Facts discovered on this host"
167
+ msgstr "Els objectes d'interès que s'han descobert en aquest amfitrió"
168
+
169
+ msgid "Facts refreshed for %s"
170
+ msgstr "Els objectes d'interès que s'han refrescat per a %s"
171
+
172
+ msgid "Failed to auto provision host %s: %s"
173
+ msgstr ""
174
+
175
+ msgid "Failed to reboot host %s"
176
+ msgstr ""
177
+
178
+ msgid "Failed to reboot host %{hostname} with error %{error_message}"
179
+ msgstr ""
180
+
181
+ msgid "Failed to refresh facts for %s"
182
+ msgstr "No s'ha pogut refrescar els objectes d'interès per a %s"
183
+
184
+ msgid "Host"
185
+ msgstr "Amfitrió"
186
+
187
+ msgid "Host %{host} was provisioned with rule %{rule}"
188
+ msgstr ""
189
+
190
+ msgid "Host group"
191
+ msgstr "Grup d'amfitrions"
192
+
193
+ msgid "Host group location %s must also be associated to the discovery rule"
194
+ msgid_plural ""
195
+ "Host group locations %s must also be associated to the discovery rule"
196
+ msgstr[0] ""
197
+ msgstr[1] ""
198
+
199
+ msgid ""
200
+ "Host group organization %s must also be associated to the discovery rule"
201
+ msgid_plural ""
202
+ "Host group organizations %s must also be associated to the discovery rule"
203
+ msgstr[0] ""
204
+ msgstr[1] ""
205
+
206
+ msgid "Host of type %s can not be rebooted"
207
+ msgstr ""
208
+
209
+ msgid "Hostname for provisioned hosts"
210
+ msgstr ""
211
+
212
+ msgid "Hosts limit"
213
+ msgstr ""
214
+
215
+ msgid "Hosts/limit"
216
+ msgstr "Amfitrions/límit"
217
+
218
+ msgid "IP Address"
219
+ msgstr "Adreça IP"
220
+
221
+ msgid "Image API processing error: %{msg} (HTTP/%{code}, body: %{body})"
222
+ msgstr ""
223
+
224
+ msgid "Image API returned HTTP/%{code} with '%{body}"
225
+ msgstr ""
226
+
227
+ msgid "Incompatible version of puppet fact parser"
228
+ msgstr "Versió incompatible de l'analitzador sintàctic de l'objecte d'interès de puppet"
229
+
230
+ msgid "Invalid facts, must be a Hash"
231
+ msgstr "Objectes d'interès no vàlids, han de tenir un Hash"
232
+
233
+ msgid "Last facts upload"
234
+ msgstr "Última pujada dels objectes d'interès"
235
+
236
+ msgid "List all discovered hosts"
237
+ msgstr "Llista tots els amfitrions descoberts"
238
+
239
+ msgid "List all discovery rules"
240
+ msgstr "Llista totes les regles de descobriment"
241
+
242
+ msgid "Location"
243
+ msgstr "Ubicació"
244
+
245
+ msgid "Locations"
246
+ msgstr "Ubicacions"
247
+
248
+ msgid "Maximum hosts provisioned with this rule (0 = unlimited)"
249
+ msgstr ""
250
+
251
+ msgid "Memory"
252
+ msgstr "Memòria"
253
+
254
+ msgid "Model"
255
+ msgstr "Model"
256
+
257
+ msgid "N/A"
258
+ msgstr ""
259
+
260
+ msgid "Name"
261
+ msgstr "Nom"
262
+
263
+ msgid "New Discovery Rule"
264
+ msgstr "Nova regla de descobriment"
265
+
266
+ msgid "New Rule"
267
+ msgstr "Nova regla"
268
+
269
+ msgid "New in the last 24 hours"
270
+ msgstr ""
271
+
272
+ msgid "No discovered hosts available"
273
+ msgstr ""
274
+
275
+ msgid "No discovered hosts to provision"
276
+ msgstr ""
277
+
278
+ msgid "No discovered hosts to reboot"
279
+ msgstr ""
280
+
281
+ msgid "No hosts selected"
282
+ msgstr ""
283
+
284
+ msgid "No hosts were found with that id or name"
285
+ msgstr ""
286
+
287
+ msgid "No rule found for host %s"
288
+ msgstr ""
289
+
290
+ msgid "Not reported in more than 7 days"
291
+ msgstr "No es va informar en més de 7 dies"
292
+
293
+ msgid "Organization"
294
+ msgstr "Organització"
295
+
296
+ msgid "Organizations"
297
+ msgstr "Organitzacions"
298
+
299
+ msgid "Please Confirm"
300
+ msgstr ""
301
+
302
+ msgid "Primary"
303
+ msgstr "Primària"
304
+
305
+ msgid "Provision"
306
+ msgstr ""
307
+
308
+ msgid "Provision a discovered host"
309
+ msgstr ""
310
+
311
+ msgid "Reboot"
312
+ msgstr ""
313
+
314
+ msgid "Reboot All"
315
+ msgstr ""
316
+
317
+ msgid "Rebooting %s"
318
+ msgstr ""
319
+
320
+ msgid "Rebooting a discovered host"
321
+ msgstr ""
322
+
323
+ msgid "Rebooting all discovered hosts"
324
+ msgstr ""
325
+
326
+ msgid "Rebooting host %s"
327
+ msgstr ""
328
+
329
+ msgid "Refresh facts"
330
+ msgstr "Refresca els objectes d'interès"
331
+
332
+ msgid "Refreshing the facts of a discovered host"
333
+ msgstr "S'estan refrescant els objectes d'interès d'un amfitrió descobert"
334
+
335
+ msgid "Reloading kernel on %s"
336
+ msgstr "S'està tornant a carregar el kernel a %s"
337
+
338
+ msgid "Reported in the last 7 days"
339
+ msgstr ""
340
+
341
+ msgid "Rule disabled"
342
+ msgstr ""
343
+
344
+ msgid "Rule enabled"
345
+ msgstr ""
346
+
347
+ msgid "Rule priority (lower integer means higher priority)"
348
+ msgstr ""
349
+
350
+ msgid "Select Action"
351
+ msgstr ""
352
+
353
+ msgid "Select all items in this page"
354
+ msgstr "Selecciona tots els ítems en aquesta pàgina"
355
+
356
+ msgid "Select location"
357
+ msgstr ""
358
+
359
+ msgid "Select organization"
360
+ msgstr "Selecciona l'organització"
361
+
362
+ msgid "Show a discovered host"
363
+ msgstr ""
364
+
365
+ msgid "Show a discovery rule"
366
+ msgstr "Mostra una regla de descobriment"
367
+
368
+ msgid "Something went wrong while selecting hosts - %s"
369
+ msgstr ""
370
+
371
+ msgid ""
372
+ "Specify target hostname template pattern in the same syntax as in "
373
+ "Provisioning Templates (ERB)."
374
+ msgstr ""
375
+
376
+ msgid "Submit"
377
+ msgstr "Envia"
378
+
379
+ msgid "Subnet"
380
+ msgstr "Subxarxa"
381
+
382
+ msgid "Target host group for this rule with all properties set"
383
+ msgstr ""
384
+
385
+ msgid "Template"
386
+ msgstr "Plantilla"
387
+
388
+ msgid "The default location to place discovered hosts in"
389
+ msgstr ""
390
+
391
+ msgid "The default organization to place discovered hosts in"
392
+ msgstr ""
393
+
394
+ msgid "The default prefix to use for the host name, must start with a letter"
395
+ msgstr ""
396
+
397
+ msgid "The following hosts were not deleted: %s"
398
+ msgstr ""
399
+
400
+ msgid ""
401
+ "This might take a while, as all hosts, facts and reports will be destroyed "
402
+ "as well"
403
+ msgstr ""
404
+
405
+ msgid ""
406
+ "UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks"
407
+ msgstr ""
408
+
409
+ msgid "Unable to assign subnet, primary interface is missing IP address"
410
+ msgstr ""
411
+
412
+ msgid ""
413
+ "Unable to detect primary interface using MAC '%{mac}' specified by "
414
+ "discovery_fact '%{fact}'"
415
+ msgstr ""
416
+
417
+ msgid "Unable to find a discovery rule, no host provided (check permissions)"
418
+ msgstr ""
419
+
420
+ msgid "Unable to perform kexec on %{name} via %{url}: %{msg}"
421
+ msgstr ""
422
+
423
+ msgid "Unable to provision %{host}: %{errors}"
424
+ msgstr ""
425
+
426
+ msgid "Unable to reboot %{name} via %{url}: %{msg}"
427
+ msgstr ""
428
+
429
+ msgid "Update a rule"
430
+ msgstr "Actualitza una regla"
431
+
432
+ msgid "Upload facts for a host, creating the host if required"
433
+ msgstr "Puja els objectes d'interès per un amfitrió, creant el nou amfitrió si fos necessari"
434
+
435
+ msgid "Value"
436
+ msgstr "Valor"
437
+
438
+ msgid "Warning"
439
+ msgstr "Advertència"
440
+
441
+ msgid ""
442
+ "When creating hostname patterns, make sure the resulting host names are "
443
+ "unique. Hostnames must not start with numbers. A good approach is to use "
444
+ "unique information provided by facter (MAC address, BIOS or serial ID)."
445
+ msgstr ""
446
+
447
+ msgid "can't contain white spaces."
448
+ msgstr ""
449
+
450
+ msgid ""
451
+ "defines a pattern to assign human-readable hostnames to the matching hosts"
452
+ msgstr ""
453
+
454
+ msgid "enables to limit maximum amount of provisioned hosts per rule"
455
+ msgstr ""
456
+
457
+ msgid "filter results"
458
+ msgstr "filtra els resultats"
459
+
460
+ msgid "flag is used for temporary shutdown of rules"
461
+ msgstr ""
462
+
463
+ msgid ""
464
+ "hash containing facts for the host with minimum set of facts: "
465
+ "discovery_bootif, macaddress_eth0, ipaddress, ipaddress_eth0, interfaces: "
466
+ "eth0 (example in case primary interface is named eth0)"
467
+ msgstr ""
468
+
469
+ msgid "items selected. Uncheck to Clear"
470
+ msgstr "ítems seleccionats. Desmarca per netejar"
471
+
472
+ msgid "must start with a letter or ERB."
473
+ msgstr ""
474
+
475
+ msgid "not required if it's a virtual machine"
476
+ msgstr ""
477
+
478
+ msgid "not required if using a subnet with DHCP proxy"
479
+ msgstr ""
480
+
481
+ msgid "number of entries per request"
482
+ msgstr "Nombre d'entrades per petició"
483
+
484
+ msgid "paginate results"
485
+ msgstr "pagina els resultats"
486
+
487
+ msgid ""
488
+ "puts the rules in order, low numbers go first. Must be greater then zero"
489
+ msgstr ""
490
+
491
+ msgid "query to match discovered hosts for the particular rule"
492
+ msgstr ""
493
+
494
+ msgid "represents rule name shown to the users"
495
+ msgstr ""
496
+
497
+ msgid ""
498
+ "required if value is not inherited from host group or default password in "
499
+ "settings"
500
+ msgstr ""
501
+
502
+ msgid "sort results"
503
+ msgstr "ordena els resultats"
504
+
505
+ msgid "the hostgroup that is used to auto provision a host"
506
+ msgstr ""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amos Benari
@@ -32,20 +32,20 @@ authors:
32
32
  autorequire:
33
33
  bindir: bin
34
34
  cert_chain: []
35
- date: 2015-10-26 00:00:00.000000000 Z
35
+ date: 2016-01-26 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: deface
39
39
  requirement: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - <
41
+ - - "<"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '2.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - <
48
+ - - "<"
49
49
  - !ruby/object:Gem::Version
50
50
  version: '2.0'
51
51
  description: MaaS Discovery Plugin engine for Foreman
@@ -63,7 +63,10 @@ files:
63
63
  - app/controllers/api/v2/discovered_hosts_controller.rb
64
64
  - app/lib/puppet_fact_parser_extensions.rb
65
65
  - app/lib/facter_utils.rb
66
+ - app/services/foreman_discovery/node_api/power_service.rb
67
+ - app/services/foreman_discovery/node_api/power_legacy_direct_service.rb
66
68
  - app/services/foreman_discovery/node_api/node_resource.rb
69
+ - app/services/foreman_discovery/node_api/power_legacy_proxied_service.rb
67
70
  - app/services/foreman_discovery/node_api/power.rb
68
71
  - app/services/foreman_discovery/node_api/inventory.rb
69
72
  - app/services/foreman_discovery/host_converter.rb
@@ -139,6 +142,7 @@ files:
139
142
  - locale/es/foreman_discovery.po
140
143
  - locale/fr/foreman_discovery.po
141
144
  - locale/it/foreman_discovery.po
145
+ - locale/ca/foreman_discovery.po
142
146
  - locale/ja/foreman_discovery.po
143
147
  - locale/ko/foreman_discovery.po
144
148
  - locale/zh_CN/foreman_discovery.po
@@ -154,6 +158,7 @@ files:
154
158
  - locale/fr/LC_MESSAGES/foreman_discovery.mo
155
159
  - locale/it/LC_MESSAGES/foreman_discovery.mo
156
160
  - locale/messages.mo
161
+ - locale/ca/LC_MESSAGES/foreman_discovery.mo
157
162
  - locale/ja/LC_MESSAGES/foreman_discovery.mo
158
163
  - locale/ko/LC_MESSAGES/foreman_discovery.mo
159
164
  - locale/zh_CN/LC_MESSAGES/foreman_discovery.mo
@@ -185,12 +190,12 @@ require_paths:
185
190
  - lib
186
191
  required_ruby_version: !ruby/object:Gem::Requirement
187
192
  requirements:
188
- - - '>='
193
+ - - ">="
189
194
  - !ruby/object:Gem::Version
190
195
  version: '0'
191
196
  required_rubygems_version: !ruby/object:Gem::Requirement
192
197
  requirements:
193
- - - '>='
198
+ - - ">="
194
199
  - !ruby/object:Gem::Version
195
200
  version: '0'
196
201
  requirements: []