foreman_discovery 7.0.1 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/discovered_hosts_controller.rb +2 -2
  3. data/app/controllers/discovered_hosts_controller.rb +2 -5
  4. data/app/models/host/discovered.rb +18 -10
  5. data/app/models/setting/discovered.rb +4 -2
  6. data/app/services/foreman_discovery/host_converter.rb +6 -1
  7. data/app/views/api/v2/discovered_hosts/main.json.rabl +4 -0
  8. data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +3 -3
  9. data/app/views/discovery_rules/_form.html.erb +3 -5
  10. data/app/views/discovery_rules/index.html.erb +1 -1
  11. data/db/migrate/20160805104605_rename_lock_template_setting.rb +14 -0
  12. data/db/migrate/20160925213030_change_discovery_widget_names.rb +11 -0
  13. data/db/migrate/20160927164411_define_explicit_length_for_discovery_rule_attributes.rb +7 -0
  14. data/db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb +17 -0
  15. data/lib/foreman_discovery/engine.rb +10 -6
  16. data/lib/foreman_discovery/version.rb +1 -1
  17. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  18. data/locale/ca/foreman_discovery.edit.po +120 -163
  19. data/locale/ca/foreman_discovery.po +36 -12
  20. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  21. data/locale/de/foreman_discovery.edit.po +123 -163
  22. data/locale/de/foreman_discovery.po +38 -14
  23. data/locale/en/foreman_discovery.edit.po +73 -49
  24. data/locale/en/foreman_discovery.po +23 -5
  25. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  26. data/locale/en_GB/foreman_discovery.edit.po +130 -165
  27. data/locale/en_GB/foreman_discovery.po +39 -15
  28. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  29. data/locale/es/foreman_discovery.edit.po +120 -163
  30. data/locale/es/foreman_discovery.po +37 -13
  31. data/locale/foreman_discovery.pot +79 -50
  32. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  33. data/locale/fr/foreman_discovery.edit.po +128 -164
  34. data/locale/fr/foreman_discovery.po +39 -15
  35. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  36. data/locale/gl/foreman_discovery.edit.po +116 -163
  37. data/locale/gl/foreman_discovery.po +36 -12
  38. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  39. data/locale/it/foreman_discovery.edit.po +120 -163
  40. data/locale/it/foreman_discovery.po +37 -13
  41. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  42. data/locale/ja/foreman_discovery.edit.po +122 -163
  43. data/locale/ja/foreman_discovery.po +37 -13
  44. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  45. data/locale/ko/foreman_discovery.edit.po +120 -162
  46. data/locale/ko/foreman_discovery.po +37 -13
  47. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  48. data/locale/pt_BR/foreman_discovery.edit.po +120 -163
  49. data/locale/pt_BR/foreman_discovery.po +39 -15
  50. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  51. data/locale/ru/foreman_discovery.edit.po +123 -164
  52. data/locale/ru/foreman_discovery.po +37 -13
  53. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  54. data/locale/sv_SE/foreman_discovery.edit.po +116 -163
  55. data/locale/sv_SE/foreman_discovery.po +36 -12
  56. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  57. data/locale/zh_CN/foreman_discovery.edit.po +122 -163
  58. data/locale/zh_CN/foreman_discovery.po +37 -13
  59. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  60. data/locale/zh_TW/foreman_discovery.edit.po +122 -163
  61. data/locale/zh_TW/foreman_discovery.po +37 -13
  62. data/test/functional/api/v2/discovered_hosts_controller_test.rb +54 -27
  63. data/test/functional/api/v2/discovery_rules_controller_test.rb +1 -9
  64. data/test/functional/discovered_hosts_controller_test.rb +35 -17
  65. data/test/test_helper_discovery.rb +17 -0
  66. data/test/unit/discovered_extensions_test.rb +1 -9
  67. data/test/unit/discovery_rule_test.rb +51 -0
  68. data/test/unit/discovery_taxonomy_extensions_test.rb +1 -8
  69. data/test/unit/host_discovered_test.rb +16 -50
  70. metadata +7 -19
  71. data/app/models/concerns/discovery_subnet.rb +0 -7
  72. data/app/overrides/subnet_form_with_discovery_proxy.rb +0 -9
@@ -2,30 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class HostDiscoveredTest < ActiveSupport::TestCase
4
4
  setup do
5
- FactoryGirl.create(:setting,
6
- :name => 'discovery_fact',
7
- :value => 'discovery_bootif',
8
- :category => 'Setting::Discovered')
9
- FactoryGirl.create(:setting,
10
- :name => 'discovery_hostname',
11
- :value => 'discovery_bootif',
12
- :category => 'Setting::Discovered')
13
- FactoryGirl.create(:setting,
14
- :name => 'discovery_prefix',
15
- :value => 'mac',
16
- :category => 'Setting::Discovered')
17
- FactoryGirl.create(:setting,
18
- :name => 'discovery_lock',
19
- :value => 'false',
20
- :category => 'Setting::Discovered')
21
- FactoryGirl.create(:setting,
22
- :name => 'discovery_lock_template',
23
- :value => 'pxelinux_discovery',
24
- :category => 'Setting::Discovered')
25
- FactoryGirl.create(:setting,
26
- :name => 'discovery_clean_facts',
27
- :value => false,
28
- :category => 'Setting::Discovered')
5
+ set_default_settings
29
6
  end
30
7
 
31
8
  test "should be able to create Host::Discovered objects" do
@@ -41,7 +18,7 @@ class HostDiscoveredTest < ActiveSupport::TestCase
41
18
 
42
19
  test "should setup subnet" do
43
20
  raw = parse_json_fixture('/facts.json')
44
- subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '192.168.99.0', :organizations => [Organization.first], :locations => [Location.first])
21
+ subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [Organization.first], :locations => [Location.first])
45
22
  Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
46
23
  host = Host::Discovered.import_host(raw['facts'])
47
24
  assert_equal subnet, host.primary_interface.subnet
@@ -50,16 +27,10 @@ class HostDiscoveredTest < ActiveSupport::TestCase
50
27
  test "should setup subnet with org and loc" do
51
28
  org = FactoryGirl.create(:organization, :name => "subnet_org")
52
29
  loc = FactoryGirl.create(:location, :name => "subnet_loc")
53
- FactoryGirl.create(:setting,
54
- :name => 'discovery_organization',
55
- :value => org.name,
56
- :category => 'Setting::Discovered')
57
- FactoryGirl.create(:setting,
58
- :name => 'discovery_location',
59
- :value => loc.name,
60
- :category => 'Setting::Discovered')
30
+ Setting['discovery_organization'] = org.name
31
+ Setting['discovery_location'] = loc.name
61
32
  raw = parse_json_fixture('/facts.json')
62
- subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '192.168.99.0', :organizations => [org], :locations => [loc])
33
+ subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org], :locations => [loc])
63
34
  Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
64
35
  host = Host::Discovered.import_host(raw['facts'])
65
36
  assert_equal subnet, host.primary_interface.subnet
@@ -70,16 +41,10 @@ class HostDiscoveredTest < ActiveSupport::TestCase
70
41
  org = FactoryGirl.create(:organization, :name => "suborg", :parent_id => org_parent.id)
71
42
  loc_parent = FactoryGirl.create(:location, :name => "loc")
72
43
  loc = FactoryGirl.create(:location, :name => "subloc", :parent_id => loc_parent.id)
73
- FactoryGirl.create(:setting,
74
- :name => 'discovery_organization',
75
- :value => org.name,
76
- :category => 'Setting::Discovered')
77
- FactoryGirl.create(:setting,
78
- :name => 'discovery_location',
79
- :value => loc.name,
80
- :category => 'Setting::Discovered')
44
+ Setting['discovery_organization'] = org.name
45
+ Setting['discovery_location'] = loc.name
81
46
  raw = parse_json_fixture('/facts.json')
82
- subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '192.168.99.0', :organizations => [org], :locations => [loc])
47
+ subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org], :locations => [loc])
83
48
  Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
84
49
  host = Host::Discovered.import_host(raw['facts'])
85
50
  assert_equal org, host.organization
@@ -114,7 +79,6 @@ class HostDiscoveredTest < ActiveSupport::TestCase
114
79
  test "should lock host into discovery via PXE configuration" do
115
80
  Host::Discovered.delete('mace41f13cc3658')
116
81
  Setting[:discovery_lock] = "true"
117
- Setting[:discovery_lock_template] = 'discovery_lock_template'
118
82
  raw = parse_json_fixture('/facts.json')
119
83
  subnet = FactoryGirl.create(:subnet,
120
84
  :tftp,
@@ -125,12 +89,14 @@ class HostDiscoveredTest < ActiveSupport::TestCase
125
89
  :locations => [Location.first]
126
90
  )
127
91
  Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
128
- ProxyAPI::TFTP.any_instance.expects(:set).with('e4:1f:13:cc:36:58', anything).returns(true)
129
- ProvisioningTemplate.where(:name => 'discovery_lock_template').first_or_create(
130
- :template_kind_id => template_kinds(:ipxe),
131
- :snippet => true,
132
- :template => "test"
133
- )
92
+ ProxyAPI::TFTP.any_instance.expects(:set).with(anything, 'e4:1f:13:cc:36:58', anything).returns(true).times(3)
93
+ TemplateKind::PXE.each do |kind|
94
+ ProvisioningTemplate.where(:name => "#{kind.downcase}_discovery").first_or_create(
95
+ :template_kind_id => template_kinds(kind.downcase.to_sym),
96
+ :snippet => true,
97
+ :template => "test"
98
+ )
99
+ end
134
100
  assert Host::Discovered.import_host(raw['facts'])
135
101
  assert Host::Discovered.find_by_name('mace41f13cc3658')
136
102
  refute Host::Managed.find_by_name('mace41f13cc3658')
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: 7.0.1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amos Benari
@@ -32,22 +32,8 @@ authors:
32
32
  autorequire:
33
33
  bindir: bin
34
34
  cert_chain: []
35
- date: 2016-12-23 00:00:00.000000000 Z
36
- dependencies:
37
- - !ruby/object:Gem::Dependency
38
- name: deface
39
- requirement: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "<"
42
- - !ruby/object:Gem::Version
43
- version: '2.0'
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '2.0'
35
+ date: 2017-01-06 00:00:00.000000000 Z
36
+ dependencies: []
51
37
  description: MaaS Discovery Plugin engine for Foreman
52
38
  email: gsutclif@redhat.com
53
39
  executables: []
@@ -71,7 +57,6 @@ files:
71
57
  - app/helpers/discovery_rules_helper.rb
72
58
  - app/lib/facter_utils.rb
73
59
  - app/mailers/discovered_mailer.rb
74
- - app/models/concerns/discovery_subnet.rb
75
60
  - app/models/concerns/discovery_taxonomy_extensions.rb
76
61
  - app/models/concerns/fact_value_extensions.rb
77
62
  - app/models/discovery_attribute_set.rb
@@ -81,7 +66,6 @@ files:
81
66
  - app/models/hostgroup_extensions.rb
82
67
  - app/models/nic/managed_extensions.rb
83
68
  - app/models/setting/discovered.rb
84
- - app/overrides/subnet_form_with_discovery_proxy.rb
85
69
  - app/services/foreman_discovery/fact_parser.rb
86
70
  - app/services/foreman_discovery/host_converter.rb
87
71
  - app/services/foreman_discovery/node_api/inventory.rb
@@ -136,7 +120,11 @@ files:
136
120
  - db/migrate/20150714144500_review_discovery_permissions.rb
137
121
  - db/migrate/20151023144501_regenerate_red_hat_kexec.rb
138
122
  - db/migrate/20160719124942_add_missing_view_permissions.rb
123
+ - db/migrate/20160805104605_rename_lock_template_setting.rb
139
124
  - db/migrate/20160818091421_add_permissions_from_default_roles.rb
125
+ - db/migrate/20160925213030_change_discovery_widget_names.rb
126
+ - db/migrate/20160927164411_define_explicit_length_for_discovery_rule_attributes.rb
127
+ - db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb
140
128
  - db/seeds.d/50_discovery_templates.rb
141
129
  - db/seeds.d/60_discovery_proxy_feature.rb
142
130
  - db/seeds.d/70_discovery_mail_notification.rb
@@ -1,7 +0,0 @@
1
- module DiscoverySubnet
2
- extend ActiveSupport::Concern
3
- included do
4
- belongs_to :discovery, :class_name => "SmartProxy"
5
- end
6
- end
7
-
@@ -1,9 +0,0 @@
1
- selector_text = " <%= select_f f, :discovery_id, SmartProxy.with_features('Discovery'), :id, :name,
2
- {:include_blank => _('None')},
3
- :label => _('Discovery Proxy'),
4
- :help_inline => _('Discovery Proxy to use within this subnet for managing connection to discovered hosts') %>"
5
-
6
- Deface::Override.new(:virtual_path => "subnets/_form",
7
- :name => "add_discovery_proxy_to_subnet",
8
- :insert_bottom => 'div#proxies',
9
- :text => selector_text)