foreman_discovery 10.0.0 → 11.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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/controllers/api/v2/discovered_hosts_controller.rb +1 -1
  4. data/app/controllers/api/v2/discovery_rules_controller.rb +2 -1
  5. data/app/controllers/concerns/foreman/controller/parameters/discovered_host.rb +9 -2
  6. data/app/controllers/discovered_hosts_controller.rb +16 -15
  7. data/app/controllers/discovery_rules_controller.rb +1 -1
  8. data/app/models/host/discovered.rb +10 -4
  9. data/app/models/host/managed_extensions.rb +4 -1
  10. data/app/views/foreman_discovery/debian_kexec.erb +1 -1
  11. data/db/migrate/20141107091416_create_discovery_rules.rb +1 -1
  12. data/db/migrate/20141107091417_add_discovery_rule_to_host.rb +1 -1
  13. data/db/migrate/20141126165451_add_discovery_id_to_subnet.rb +1 -1
  14. data/db/migrate/20141223101707_create_discovery_attribute_sets.rb +1 -1
  15. data/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb +1 -1
  16. data/db/migrate/20150302112545_remove_duplicate_tokens_from_hosts.rb +1 -1
  17. data/db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb +1 -1
  18. data/db/migrate/20150331132115_remove_old_permissions.rb +1 -1
  19. data/db/migrate/20150505111345_remove_leftover_tokens.rb +1 -1
  20. data/db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb +1 -1
  21. data/db/migrate/20150714144500_review_discovery_permissions.rb +1 -1
  22. data/db/migrate/20151023144501_regenerate_red_hat_kexec.rb +1 -1
  23. data/db/migrate/20160719124942_add_missing_view_permissions.rb +1 -1
  24. data/db/migrate/20160805104605_rename_lock_template_setting.rb +1 -1
  25. data/db/migrate/20160818091421_add_permissions_from_default_roles.rb +1 -1
  26. data/db/migrate/20160925213030_change_discovery_widget_names.rb +1 -1
  27. data/db/migrate/20160927164411_define_explicit_length_for_discovery_rule_attributes.rb +1 -1
  28. data/db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb +4 -1
  29. data/lib/foreman_discovery/engine.rb +2 -1
  30. data/lib/foreman_discovery/version.rb +1 -1
  31. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  32. data/locale/ca/foreman_discovery.edit.po +47 -38
  33. data/locale/ca/foreman_discovery.po +18 -11
  34. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/de/foreman_discovery.edit.po +50 -42
  36. data/locale/de/foreman_discovery.po +21 -15
  37. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  38. data/locale/en/foreman_discovery.edit.po +51 -43
  39. data/locale/en/foreman_discovery.po +7 -1
  40. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/en_GB/foreman_discovery.edit.po +43 -35
  42. data/locale/en_GB/foreman_discovery.po +14 -8
  43. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  44. data/locale/es/foreman_discovery.edit.po +208 -200
  45. data/locale/es/foreman_discovery.po +179 -173
  46. data/locale/foreman_discovery.pot +52 -44
  47. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  48. data/locale/fr/foreman_discovery.edit.po +54 -46
  49. data/locale/fr/foreman_discovery.po +25 -19
  50. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  51. data/locale/gl/foreman_discovery.edit.po +37 -29
  52. data/locale/gl/foreman_discovery.po +8 -2
  53. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  54. data/locale/it/foreman_discovery.edit.po +51 -43
  55. data/locale/it/foreman_discovery.po +22 -16
  56. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  57. data/locale/ja/foreman_discovery.edit.po +184 -176
  58. data/locale/ja/foreman_discovery.po +155 -151
  59. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  60. data/locale/ko/foreman_discovery.edit.po +57 -49
  61. data/locale/ko/foreman_discovery.po +28 -22
  62. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  63. data/locale/pt_BR/foreman_discovery.edit.po +206 -198
  64. data/locale/pt_BR/foreman_discovery.po +177 -171
  65. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  66. data/locale/ru/foreman_discovery.edit.po +57 -49
  67. data/locale/ru/foreman_discovery.po +28 -22
  68. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  69. data/locale/sv_SE/foreman_discovery.edit.po +37 -29
  70. data/locale/sv_SE/foreman_discovery.po +8 -2
  71. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  72. data/locale/zh_CN/foreman_discovery.edit.po +204 -196
  73. data/locale/zh_CN/foreman_discovery.po +177 -169
  74. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  75. data/locale/zh_TW/foreman_discovery.edit.po +47 -39
  76. data/locale/zh_TW/foreman_discovery.po +18 -12
  77. data/test/factories/discovery_host_related.rb +2 -2
  78. data/test/factories/discovery_rule_related.rb +1 -1
  79. data/test/functional/api/v2/discovered_hosts_controller_test.rb +28 -27
  80. data/test/functional/api/v2/discovery_rules_controller_test.rb +14 -14
  81. data/test/functional/api/v2/fact_value_extensions_test.rb +5 -2
  82. data/test/functional/discovered_hosts_controller_test.rb +47 -40
  83. data/test/functional/discovery_rules_controller_test.rb +14 -14
  84. data/test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb +2 -2
  85. data/test/integration/discovered_hosts_test.rb +151 -0
  86. data/test/test_helper_discovery.rb +53 -23
  87. data/test/test_plugin_helper.rb +3 -7
  88. data/test/unit/discovered_extensions_test.rb +40 -38
  89. data/test/unit/discovered_mailer_test.rb +1 -1
  90. data/test/unit/discovery_attribute_set_test.rb +4 -2
  91. data/test/unit/discovery_rule_test.rb +2 -2
  92. data/test/unit/discovery_taxonomy_extensions_test.rb +1 -1
  93. data/test/unit/fact_parser_test.rb +1 -1
  94. data/test/unit/host_discovered_test.rb +26 -23
  95. data/test/unit/managed_extensions_test.rb +1 -1
  96. data/test/unit/ui_notifications/destroy_host_test.rb +21 -17
  97. data/test/unit/ui_notifications/new_host_test.rb +11 -11
  98. metadata +8 -3
  99. data/config/as_deprecation_whitelist.yaml +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d782b90e35570098b6d74636a5a79a6a7f94026a
4
- data.tar.gz: '07791a0d0a62b65eb04803473e2413748458b40a'
3
+ metadata.gz: 221ad5eb42c9d10c313e6e827beb5d0156a56275
4
+ data.tar.gz: 6b6df98bf5b4611aeb3734152b5463c2edef7453
5
5
  SHA512:
6
- metadata.gz: 3172b396efe8c2b9a7a8727bc26739bcbfb4da40cd0fc1222ad4c2cd91267de873d61ef3c4fdc2e7e6cbf44881679c79b990b9ed795f699150ecb8f806d7aa3b
7
- data.tar.gz: a8daeeadb503811032caebe4f2c6dd26acad998d615b7e3deeb96dff59880494ba7ce01cd9459431adcc439e7a13ab91a24ca467b2774b54a4c4265a31c2b17f
6
+ metadata.gz: 4a67ce08394ba37b05dba6947d2bfc2ccd0de5ab13ded18dc208ce29b7ec069634ba68a42611b17a7987c90f013540d94e136b06a553764192df9b07e29bd237
7
+ data.tar.gz: 8f57149cce4c007f15858483c9aaf3bb9dac723c2e5a544aef8a94662e1b7f064c777442e9f69596d39152ace62a9a92fd8ca4c097448283bf5f57bbbafbad2c
data/README.md CHANGED
@@ -4,7 +4,7 @@ This plugin enables MaaS hardware discovery in Foreman.
4
4
 
5
5
  # Documentation
6
6
 
7
- The main documentation can be found in the [Foreman Discovery manual] (http://theforeman.org/plugins/foreman_discovery/).
7
+ The main documentation can be found in the [Foreman Discovery manual](http://theforeman.org/plugins/foreman_discovery/).
8
8
 
9
9
  ## Latest code
10
10
 
@@ -80,7 +80,7 @@ module Api
80
80
  end
81
81
 
82
82
  def update
83
- @host = ::ForemanDiscovery::HostConverter.to_managed(@discovered_host, true, true, discovered_host_params)
83
+ @host = ::ForemanDiscovery::HostConverter.to_managed(@discovered_host, true, true, managed_host_params)
84
84
  forward_request_url
85
85
  update_response = @host.save
86
86
  process_response update_response
@@ -36,7 +36,8 @@ module Api
36
36
  param :max_count, Integer, :desc => N_("enables to limit maximum amount of provisioned hosts per rule")
37
37
  param :priority, Integer, :desc => N_("puts the rules in order, low numbers go first. Must be greater then zero")
38
38
  param :enabled, :bool, :desc => N_("flag is used for temporary shutdown of rules")
39
- param_group :taxonomies, ::Api::V2::BaseController
39
+ param :location_ids, Array, :required => true, :desc => N_("location ID for provisioned hosts") if SETTINGS[:locations_enabled]
40
+ param :organization_ids, Array, :required => true, :desc => N_("organization ID for provisioned hosts") if SETTINGS[:organizations_enabled]
40
41
  end
41
42
  end
42
43
 
@@ -1,7 +1,6 @@
1
1
  module Foreman::Controller::Parameters::DiscoveredHost
2
2
  extend ActiveSupport::Concern
3
- include Foreman::Controller::Parameters::HostBase
4
- include Foreman::Controller::Parameters::HostCommon
3
+ include Foreman::Controller::Parameters::Host
5
4
 
6
5
  class_methods do
7
6
  def discovered_host_params_filter
@@ -21,4 +20,12 @@ module Foreman::Controller::Parameters::DiscoveredHost
21
20
  def discovered_host_params_host
22
21
  self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context, :host)
23
22
  end
23
+
24
+ def managed_host_params_host
25
+ self.class.host_params_filter.filter_params(params, parameter_filter_context, :host)
26
+ end
27
+
28
+ def managed_host_params
29
+ self.class.host_params_filter.filter_params(params, parameter_filter_context)
30
+ end
24
31
  end
@@ -55,7 +55,7 @@ class DiscoveredHostsController < ::ApplicationController
55
55
 
56
56
  def edit
57
57
  @host = ::ForemanDiscovery::HostConverter.to_managed(@host, true, false, discovered_host_params_host) unless @host.nil?
58
- setup_host_class_variables(@host)
58
+ setup_host_class_variables
59
59
  @override_taxonomy = true
60
60
  if params[:quick_submit]
61
61
  perform_update(@host, _('Successfully provisioned %s') % @host.name)
@@ -66,7 +66,7 @@ class DiscoveredHostsController < ::ApplicationController
66
66
  end
67
67
 
68
68
  def update
69
- @host = ::ForemanDiscovery::HostConverter.to_managed(@host, true, true, discovered_host_params_host)
69
+ @host = ::ForemanDiscovery::HostConverter.to_managed(@host, true, true, managed_host_params_host)
70
70
  forward_url_options
71
71
 
72
72
  perform_update(@host)
@@ -135,10 +135,8 @@ class DiscoveredHostsController < ::ApplicationController
135
135
 
136
136
  def submit_multiple_destroy
137
137
  # keep all the ones that were not deleted for notification.
138
- @hosts.to_a.delete_if {|host| host.destroy}
139
-
140
- missed_hosts = @hosts.map(&:name).join('<br/>')
141
- if @hosts.empty?
138
+ missed_hosts = @hosts.select {|host| !host.destroy }
139
+ if missed_hosts
142
140
  notice _("Destroyed selected hosts")
143
141
  else
144
142
  error _("The following hosts were not deleted: %s") % missed_hosts
@@ -189,15 +187,18 @@ class DiscoveredHostsController < ::ApplicationController
189
187
 
190
188
  private
191
189
 
192
- def setup_host_class_variables(host)
193
- if host.hostgroup
194
- @architecture = host.hostgroup.architecture
195
- @operatingsystem = host.hostgroup.operatingsystem
196
- @environment = host.hostgroup.environment
197
- @domain = host.hostgroup.domain
198
- @subnet = host.hostgroup.subnet
199
- @compute_profile = host.hostgroup.compute_profile
200
- @realm = host.hostgroup.realm
190
+ def setup_host_class_variables
191
+ if @host.hostgroup
192
+ @architecture = @host.hostgroup.architecture
193
+ @operatingsystem = @host.hostgroup.operatingsystem
194
+ @environment = @host.hostgroup.environment
195
+ @domain = @host.hostgroup.domain
196
+ @subnet = @host.hostgroup.subnet
197
+ @compute_profile = @host.hostgroup.compute_profile
198
+ @realm = @host.hostgroup.realm
199
+ @host.interfaces.first.assign_attributes(subnet: @subnet,
200
+ domain: @domain)
201
+ @host.environment = @environment
201
202
  end
202
203
  end
203
204
 
@@ -8,7 +8,7 @@ class DiscoveryRulesController < ApplicationController
8
8
 
9
9
  def index
10
10
  base = resource_base.search_for(params[:search], :order => (params[:order]))
11
- @discovery_rules = base.paginate(:page => params[:page]).includes(:hostgroup)
11
+ @discovery_rules = base.paginate(:page => params[:page], :per_page => params[:per_page]).includes(:hostgroup)
12
12
  end
13
13
 
14
14
  def new
@@ -14,14 +14,20 @@ class Host::Discovered < ::Host::Base
14
14
  after_destroy :delete_notification
15
15
 
16
16
  scoped_search :on => :name, :complete_value => true
17
- scoped_search :on => :created_at, :default_order => :desc
18
- scoped_search :on => :last_report, :complete_value => true
17
+ scoped_search :on => :created_at, :default_order => :desc, :only_explicit => true
18
+ scoped_search :on => :last_report, :complete_value => true, :only_explicit => true
19
19
  scoped_search :relation => :primary_interface, :on => :ip, :complete_value => true
20
20
  scoped_search :relation => :primary_interface, :on => :mac, :complete_value => true
21
21
  scoped_search :relation => :model, :on => :name, :complete_value => true, :rename => :model
22
22
  scoped_search :relation => :fact_values, :on => :value, :in_key => :fact_names, :on_key => :name, :rename => :facts, :complete_value => true, :only_explicit => true
23
- scoped_search :relation => :location, :on => :name, :rename => :location, :complete_value => true if SETTINGS[:locations_enabled]
24
- scoped_search :relation => :organization, :on => :name, :rename => :organization, :complete_value => true if SETTINGS[:organizations_enabled]
23
+ if SETTINGS[:locations_enabled]
24
+ scoped_search :relation => :location, :on => :name, :rename => :location, :complete_value => true, :only_explicit => true
25
+ scoped_search :on => :location_id, :complete_value => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
26
+ end
27
+ if SETTINGS[:organizations_enabled]
28
+ scoped_search :relation => :organization, :on => :name, :rename => :organization, :complete_value => true, :only_explicit => true
29
+ scoped_search :on => :organization_id, :complete_value => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
30
+ end
25
31
  scoped_search :relation => :subnet, :on => :network, :complete_value => true, :rename => :subnet
26
32
  scoped_search :relation => :subnet, :on => :name, :complete_value => true, :rename => 'subnet.name'
27
33
  scoped_search :relation => :discovery_attribute_set, :on => :cpu_count, :rename => :cpu_count, :complete_value => true, :only_explicit => true
@@ -12,7 +12,10 @@ module Host::ManagedExtensions
12
12
  end
13
13
 
14
14
  def queue_reboot
15
- return unless errors.empty? && Setting[:discovery_reboot]
15
+ unless errors.empty? && Setting[:discovery_reboot]
16
+ logger.warn("Not queueing Discovery reboot: #{errors.full_messages.to_sentence}")
17
+ return
18
+ end
16
19
  return if new_record? # Discovered Hosts already exist, and new_records will break `find`
17
20
  return unless type_changed? and ::Host::Base.find(self.id).type == "Host::Discovered"
18
21
  # reboot task must be high priority and there is no compensation action apparently
@@ -18,7 +18,7 @@ Please read kexec(8) man page for more information about semantics.
18
18
  -%>
19
19
  <%
20
20
  mac = @host.facts['discovery_bootif']
21
- bootif = '00-' + mac.gsub(':', '-') rescue ''
21
+ bootif = '00-' + mac.gsub(':', '-') if mac
22
22
  ip_cidr = @host.facts['discovery_ip_cidr']
23
23
  ip = @host.facts['discovery_ip']
24
24
  mask = @host.facts['discovery_netmask']
@@ -1,4 +1,4 @@
1
- class CreateDiscoveryRules < ActiveRecord::Migration
1
+ class CreateDiscoveryRules < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :discovery_rules do |t|
4
4
  t.string :name, :length => 254
@@ -1,4 +1,4 @@
1
- class AddDiscoveryRuleToHost < ActiveRecord::Migration
1
+ class AddDiscoveryRuleToHost < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  add_column :hosts, :discovery_rule_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddDiscoveryIdToSubnet < ActiveRecord::Migration
1
+ class AddDiscoveryIdToSubnet < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  add_column :subnets, :discovery_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateDiscoveryAttributeSets < ActiveRecord::Migration
1
+ class CreateDiscoveryAttributeSets < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :discovery_attribute_sets do |t|
4
4
  t.references :host
@@ -2,7 +2,7 @@ class FakeDiscoveredHost < ApplicationRecord
2
2
  self.table_name = 'hosts'
3
3
  end
4
4
 
5
- class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration
5
+ class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration[4.2]
6
6
  def up
7
7
  FakeDiscoveredHost.where(:type => "Host::Discovered").all.each do |host|
8
8
  begin
@@ -1,4 +1,4 @@
1
- class RemoveDuplicateTokensFromHosts < ActiveRecord::Migration
1
+ class RemoveDuplicateTokensFromHosts < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  Token.where('id not in (?)', Host::Managed.all.map(&:token).compact).delete_all
4
4
  end
@@ -1,4 +1,4 @@
1
- class RemoveDiscoveryAttributeSetsFromManagedHosts < ActiveRecord::Migration
1
+ class RemoveDiscoveryAttributeSetsFromManagedHosts < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  DiscoveryAttributeSet.where(:id => DiscoveryAttributeSet.joins(:host).where(:'hosts.managed' => true).pluck("#{DiscoveryAttributeSet.table_name}.id")).delete_all
4
4
  end
@@ -1,4 +1,4 @@
1
- class RemoveOldPermissions < ActiveRecord::Migration
1
+ class RemoveOldPermissions < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  # remove invalid permissions causing http://projects.theforeman.org/issues/9963
4
4
  perms = Permission.where("name like '%_discovered_hosts' and resource_type is null").destroy_all
@@ -1,4 +1,4 @@
1
- class RemoveLeftoverTokens < ActiveRecord::Migration
1
+ class RemoveLeftoverTokens < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  existing_tokens = Host::Managed.all.map(&:token).compact
4
4
  if existing_tokens.empty?
@@ -1,4 +1,4 @@
1
- class RemoveOldDiscoveryReaderPermissions < ActiveRecord::Migration
1
+ class RemoveOldDiscoveryReaderPermissions < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  Permission.where("name like '%_discovery_rules' and resource_type is null").each do |permission|
4
4
  permission.update_attributes(:resource_type => 'DiscoveryRule')
@@ -1,4 +1,4 @@
1
- class ReviewDiscoveryPermissions < ActiveRecord::Migration
1
+ class ReviewDiscoveryPermissions < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  Role.ignore_locking do
4
4
  if (mgr = Role.find_by_name("Discovery Manager"))
@@ -1,4 +1,4 @@
1
- class RegenerateRedHatKexec < ActiveRecord::Migration
1
+ class RegenerateRedHatKexec < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  t = ProvisioningTemplate.find_by_name("Discovery Red Hat kexec")
4
4
  t.update_attributes(:template => t.template.sub(/rescue ''$/, 'if mac')) if t
@@ -1,4 +1,4 @@
1
- class AddMissingViewPermissions < ActiveRecord::Migration
1
+ class AddMissingViewPermissions < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  # migration renamed to db/migrate/20160818091421_add_missing_view_permissions2.rb
4
4
  end
@@ -1,4 +1,4 @@
1
- class RenameLockTemplateSetting < ActiveRecord::Migration
1
+ class RenameLockTemplateSetting < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  reversible do |dir|
4
4
  dir.up do
@@ -1,4 +1,4 @@
1
- class AddPermissionsFromDefaultRoles < ActiveRecord::Migration
1
+ class AddPermissionsFromDefaultRoles < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  # Moved to seeds see http://projects.theforeman.org/issues/17585
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeDiscoveryWidgetNames < ActiveRecord::Migration
1
+ class ChangeDiscoveryWidgetNames < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  Widget.where(:name => 'Discovery widget').\
4
4
  update_all(:name => 'Discovered Hosts')
@@ -1,4 +1,4 @@
1
- class DefineExplicitLengthForDiscoveryRuleAttributes < ActiveRecord::Migration
1
+ class DefineExplicitLengthForDiscoveryRuleAttributes < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_column :discovery_rules, :name, :string, :limit => 255
4
4
  change_column :discovery_rules, :search, :string, :limit => 255
@@ -1,4 +1,4 @@
1
- class AddConstraintsOnSubnetsSmartProxies < ActiveRecord::Migration
1
+ class AddConstraintsOnSubnetsSmartProxies < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  # turn off Foreign Key checks
4
4
  if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
@@ -7,6 +7,9 @@ class AddConstraintsOnSubnetsSmartProxies < ActiveRecord::Migration
7
7
  ActiveRecord::Migration.execute "SET FOREIGN_KEY_CHECKS=0;"
8
8
  end
9
9
 
10
+ # if there's some wrong key already, clean the foreign key first
11
+ Subnet.unscoped.where(["discovery_id IS NOT NULL AND discovery_id NOT IN (?)", SmartProxy.unscoped.pluck(:id)]).update_all(:discovery_id => nil)
12
+
10
13
  add_foreign_key "subnets", "smart_proxies", :name => "subnets_discovery_id_fk", :column => "discovery_id"
11
14
 
12
15
  # turn on Foreign Key checks in MySQL only
@@ -6,6 +6,7 @@ module ForemanDiscovery
6
6
  #Inherit from the Rails module of the parent app (Foreman), not the plugin.
7
7
  #Thus, inherits from ::Rails::Engine and not from Rails::Engine
8
8
  class Engine < ::Rails::Engine
9
+ engine_name 'foreman_discovery'
9
10
 
10
11
  # support pre-4 Rails versions
11
12
  config.autoload_paths += Dir["#{config.root}/app/controllers/foreman_discovery/concerns"]
@@ -42,7 +43,7 @@ module ForemanDiscovery
42
43
 
43
44
  initializer 'foreman_discovery.register_plugin', :before => :finisher_hook do |app|
44
45
  Foreman::Plugin.register :foreman_discovery do
45
- requires_foreman '>= 1.16.0'
46
+ requires_foreman '>= 1.17.0'
46
47
 
47
48
  # discovered hosts permissions
48
49
  security_block :discovery do
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "10.0.0"
2
+ VERSION = "11.0.0"
3
3
  end
@@ -3,14 +3,15 @@
3
3
  # This file is distributed under the same license as the foreman_discovery package.
4
4
  #
5
5
  # Translators:
6
+ # Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2017
6
7
  # Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2015-2016
7
8
  msgid ""
8
9
  msgstr ""
9
- "Project-Id-Version: foreman_discovery 9.1.0\n"
10
+ "Project-Id-Version: foreman_discovery 10.0.0\n"
10
11
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2017-10-17 15:39+0200\n"
12
- "PO-Revision-Date: 2017-10-17 23:23+0000\n"
13
- "Last-Translator: Lukáš Zapletal\n"
12
+ "POT-Creation-Date: 2017-12-11 10:28+0100\n"
13
+ "PO-Revision-Date: 2017-12-12 15:15+0000\n"
14
+ "Last-Translator: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>\n"
14
15
  "Language-Team: Catalan (http://www.transifex.com/foreman/foreman/language/ca/)\n"
15
16
  "MIME-Version: 1.0\n"
16
17
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -53,7 +54,7 @@ msgstr ""
53
54
 
54
55
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:41
55
56
  msgid "Create a discovered host for testing (use /facts to create new hosts)"
56
- msgstr "Crea un amfitrió descobert per a provar-ho (utilitzeu /facts per crear nous amfitrions)"
57
+ msgstr "Crea un amfitrió descobert per a provar-ho (utilitzeu /facts per crear amfitrions nous)"
57
58
 
58
59
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:50
59
60
  msgid "Provision a discovered host"
@@ -61,7 +62,7 @@ msgstr "Aprovisiona un amfitrió descobert"
61
62
 
62
63
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:55
63
64
  msgid "not required if using a subnet with DHCP proxy"
64
- msgstr "no es requereix si s'està utilitzant una subxarxa amb servidor intermediari de DHCP"
65
+ msgstr "no es requereix si s'està utilitzant una subxarxa amb servidor intermediari DHCP"
65
66
 
66
67
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:56
67
68
  msgid "not required if it's a virtual machine"
@@ -98,7 +99,7 @@ msgid "Execute rules against a discovered host"
98
99
  msgstr ""
99
100
 
100
101
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:123
101
- #: ../app/controllers/discovered_hosts_controller.rb:152
102
+ #: ../app/controllers/discovered_hosts_controller.rb:150
102
103
  msgid "Host %{host} was provisioned with rule %{rule}"
103
104
  msgstr "L'amfitrió %{host} va ser aprovisionat amb la regla %{rule}"
104
105
 
@@ -107,7 +108,7 @@ msgid "Unable to provision %{host}: %{errors}"
107
108
  msgstr "No es pot aprovisionar a %{host}: %{errors}"
108
109
 
109
110
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:132
110
- #: ../app/controllers/discovered_hosts_controller.rb:159
111
+ #: ../app/controllers/discovered_hosts_controller.rb:157
111
112
  msgid "No rule found for host %s"
112
113
  msgstr "No s'ha trobat cap regla per a l'amfitrió %s"
113
114
 
@@ -116,12 +117,12 @@ msgid "Execute rules against all currently discovered hosts"
116
117
  msgstr "Executa les regles contra tots els amfitrions detectats actualment"
117
118
 
118
119
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:143
119
- #: ../app/controllers/discovered_hosts_controller.rb:165
120
+ #: ../app/controllers/discovered_hosts_controller.rb:163
120
121
  msgid "Errors during auto provisioning: %s"
121
122
  msgstr "Erros durant l'auto aprovisionament: %s"
122
123
 
123
124
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:146
124
- #: ../app/controllers/discovered_hosts_controller.rb:168
125
+ #: ../app/controllers/discovered_hosts_controller.rb:166
125
126
  msgid "No discovered hosts to provision"
126
127
  msgstr "Sense amfitrions descoberts per aprovisionar"
127
128
 
@@ -184,15 +185,23 @@ msgstr ""
184
185
  msgid "flag is used for temporary shutdown of rules"
185
186
  msgstr ""
186
187
 
187
- #: ../app/controllers/api/v2/discovery_rules_controller.rb:43
188
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:39
189
+ msgid "location ID for provisioned hosts"
190
+ msgstr ""
191
+
192
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:40
193
+ msgid "organization ID for provisioned hosts"
194
+ msgstr ""
195
+
196
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:44
188
197
  msgid "Create a discovery rule"
189
198
  msgstr "Crea una regla de descobriment"
190
199
 
191
- #: ../app/controllers/api/v2/discovery_rules_controller.rb:51
200
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:52
192
201
  msgid "Update a rule"
193
202
  msgstr "Actualitza una regla"
194
203
 
195
- #: ../app/controllers/api/v2/discovery_rules_controller.rb:59
204
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:60
196
205
  msgid "Delete a rule"
197
206
  msgstr "Suprimeix una regla"
198
207
 
@@ -252,59 +261,59 @@ msgstr ""
252
261
  msgid "Failed to reboot hosts with error %s"
253
262
  msgstr ""
254
263
 
255
- #: ../app/controllers/discovered_hosts_controller.rb:142
264
+ #: ../app/controllers/discovered_hosts_controller.rb:140
256
265
  msgid "Destroyed selected hosts"
257
- msgstr ""
266
+ msgstr "S'han destruït els amfitrions seleccionats"
258
267
 
259
- #: ../app/controllers/discovered_hosts_controller.rb:144
268
+ #: ../app/controllers/discovered_hosts_controller.rb:142
260
269
  msgid "The following hosts were not deleted: %s"
261
270
  msgstr ""
262
271
 
263
- #: ../app/controllers/discovered_hosts_controller.rb:156
272
+ #: ../app/controllers/discovered_hosts_controller.rb:154
264
273
  msgid "Failed to auto provision host %s: %s"
265
274
  msgstr "No s'ha pogut auto aprovisionar l'amfitrió %s: %s"
266
275
 
267
- #: ../app/controllers/discovered_hosts_controller.rb:184
276
+ #: ../app/controllers/discovered_hosts_controller.rb:182
268
277
  msgid "Discovered hosts are provisioning now"
269
278
  msgstr "Els amfitrions descoberts ara tenen aprovisionament"
270
279
 
271
- #: ../app/controllers/discovered_hosts_controller.rb:213
280
+ #: ../app/controllers/discovered_hosts_controller.rb:214
272
281
  msgid "Highlights"
273
282
  msgstr ""
274
283
 
275
- #: ../app/controllers/discovered_hosts_controller.rb:213
284
+ #: ../app/controllers/discovered_hosts_controller.rb:214
276
285
  msgid "Storage"
277
286
  msgstr ""
278
287
 
279
- #: ../app/controllers/discovered_hosts_controller.rb:213
288
+ #: ../app/controllers/discovered_hosts_controller.rb:214
280
289
  msgid "Hardware"
281
290
  msgstr ""
282
291
 
283
- #: ../app/controllers/discovered_hosts_controller.rb:213
292
+ #: ../app/controllers/discovered_hosts_controller.rb:214
284
293
  msgid "Network"
285
294
  msgstr ""
286
295
 
287
- #: ../app/controllers/discovered_hosts_controller.rb:213
296
+ #: ../app/controllers/discovered_hosts_controller.rb:214
288
297
  msgid "Software"
289
298
  msgstr ""
290
299
 
291
- #: ../app/controllers/discovered_hosts_controller.rb:213
300
+ #: ../app/controllers/discovered_hosts_controller.rb:214
292
301
  msgid "IPMI"
293
302
  msgstr ""
294
303
 
295
- #: ../app/controllers/discovered_hosts_controller.rb:213
304
+ #: ../app/controllers/discovered_hosts_controller.rb:214
296
305
  msgid "Miscellaneous"
297
306
  msgstr ""
298
307
 
299
- #: ../app/controllers/discovered_hosts_controller.rb:290
308
+ #: ../app/controllers/discovered_hosts_controller.rb:291
300
309
  msgid "No hosts were found with that id or name"
301
- msgstr "No s'ha trobat cap amfitrió amb aquest id. o nom"
310
+ msgstr "No s'ha trobat cap amfitrió amb aquest ID o nom"
302
311
 
303
- #: ../app/controllers/discovered_hosts_controller.rb:294
312
+ #: ../app/controllers/discovered_hosts_controller.rb:295
304
313
  msgid "No hosts selected"
305
314
  msgstr "Cap amfitrió seleccionat"
306
315
 
307
- #: ../app/controllers/discovered_hosts_controller.rb:300
316
+ #: ../app/controllers/discovered_hosts_controller.rb:301
308
317
  msgid "Something went wrong while selecting hosts - %s"
309
318
  msgstr "Alguna cosa va anar malament mentre se seleccionaven els amfitrions - %s"
310
319
 
@@ -494,23 +503,23 @@ msgstr "No es pot realitzar kexec a %{name} a través de %{url}: %{msg}"
494
503
  msgid "Invalid hostname: Could not normalize the hostname"
495
504
  msgstr ""
496
505
 
497
- #: ../app/models/host/managed_extensions.rb:20
506
+ #: ../app/models/host/managed_extensions.rb:23
498
507
  msgid "Reloading kernel on %s"
499
508
  msgstr "S'està tornant a carregar el kernel a %s"
500
509
 
501
- #: ../app/models/host/managed_extensions.rb:22
510
+ #: ../app/models/host/managed_extensions.rb:25
502
511
  msgid "Rebooting %s"
503
512
  msgstr "S'està reiniciant %s"
504
513
 
505
- #: ../app/models/host/managed_extensions.rb:43
514
+ #: ../app/models/host/managed_extensions.rb:46
506
515
  msgid "Kexec template not associated with operating system"
507
516
  msgstr ""
508
517
 
509
- #: ../app/models/host/managed_extensions.rb:48
518
+ #: ../app/models/host/managed_extensions.rb:51
510
519
  msgid "Kernel kexec URL is invalid: '%s'"
511
520
  msgstr ""
512
521
 
513
- #: ../app/models/host/managed_extensions.rb:49
522
+ #: ../app/models/host/managed_extensions.rb:52
514
523
  msgid "Init RAM kexec URL is invalid: '%s'"
515
524
  msgstr ""
516
525
 
@@ -728,7 +737,7 @@ msgstr ""
728
737
 
729
738
  #: ../app/views/discovered_hosts/_discovered_host_modal.html.erb:24
730
739
  msgid "Create Host"
731
- msgstr ""
740
+ msgstr "Crea un amfitrió"
732
741
 
733
742
  #: ../app/views/discovered_hosts/_discovered_hosts_list.html.erb:5
734
743
  msgid "Select all items in this page"
@@ -821,7 +830,7 @@ msgstr "Amfitrions descoberts: %s"
821
830
 
822
831
  #: ../app/views/discovered_hosts/show.html.erb:34
823
832
  msgid "Interfaces"
824
- msgstr ""
833
+ msgstr "Interfícies"
825
834
 
826
835
  #: ../app/views/discovered_hosts/show.html.erb:41
827
836
  msgid "Type"
@@ -851,7 +860,7 @@ msgstr ""
851
860
 
852
861
  #: ../app/views/discovered_hosts/welcome.html.erb:9
853
862
  msgid "Learn more about this in the documentation."
854
- msgstr ""
863
+ msgstr "Obteniu més informació sobre això a la documentació."
855
864
 
856
865
  #: ../app/views/discovered_mailer/discovered_summary.html.erb:6
857
866
  msgid "Summary report for discovered hosts from Foreman"
@@ -993,7 +1002,7 @@ msgstr "Habilitada"
993
1002
 
994
1003
  #: ../app/views/discovery_rules/new.html.erb:1
995
1004
  msgid "New Discovery Rule"
996
- msgstr "Nova regla de descobriment"
1005
+ msgstr "Regla de descobriment nova"
997
1006
 
998
1007
  #: ../db/seeds.d/70_discovery_mail_notification.rb:3
999
1008
  msgid "A summary of discovered hosts"