foreman_discovery 2.0.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,16 +1,15 @@
1
- # Template file for strings which can be localized in the Foreman Application.
2
- #
3
- # This file is distributed under the same license as the Foreman.
4
- #
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman package.
5
4
  #
6
5
  # Translators:
7
6
  msgid ""
8
7
  msgstr ""
9
- "Project-Id-Version: foreman_discovery 1.4.0.rc2\n"
8
+ "Project-Id-Version: foreman_discovery 2.0.0.rc1\n"
10
9
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2014-08-20 08:33+0100\n"
12
- "PO-Revision-Date: 2014-09-16 13:21+0000\n"
13
- "Last-Translator: Dominic Cleal <dcleal@redhat.com>\n"
10
+ "POT-Creation-Date: 2015-01-28 17:53+0100\n"
11
+ "PO-Revision-Date: 2015-01-30 11:12+0000\n"
12
+ "Last-Translator: Lukáš Zapletal\n"
14
13
  "Language-Team: Chinese (Taiwan) (http://www.transifex.com/projects/p/foreman/language/zh_TW/)\n"
15
14
  "MIME-Version: 1.0\n"
16
15
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -33,15 +32,32 @@ msgstr "指定位置"
33
32
  msgid "Assign Organization"
34
33
  msgstr "指定組織"
35
34
 
35
+ msgid "Auto Provision"
36
+ msgstr ""
37
+
38
+ msgid "Auto Provision All"
39
+ msgstr ""
40
+
41
+ msgid ""
42
+ "Automatically provision newly discovered hosts, according to the "
43
+ "provisioning rules"
44
+ msgstr ""
45
+
46
+ msgid "CPUs"
47
+ msgstr "CPU"
48
+
36
49
  msgid "Cancel"
37
50
  msgstr "取消"
38
51
 
39
- msgid "Could not get facts from proxy: %s"
40
- msgstr "無法從協定取得詳情:%s"
52
+ msgid "Could not get facts from proxy %{url}: %{error}"
53
+ msgstr ""
41
54
 
42
55
  msgid "Create a discovered host"
43
56
  msgstr ""
44
57
 
58
+ msgid "Create a discovery rule"
59
+ msgstr ""
60
+
45
61
  msgid "Delete"
46
62
  msgstr "刪除"
47
63
 
@@ -51,12 +67,21 @@ msgstr "刪除 %s?"
51
67
  msgid "Delete a discovered host"
52
68
  msgstr ""
53
69
 
70
+ msgid "Delete a rule"
71
+ msgstr ""
72
+
54
73
  msgid "Delete hosts"
55
74
  msgstr "刪除主機"
56
75
 
57
76
  msgid "Destroyed selected hosts"
58
77
  msgstr "刪除選擇的主機"
59
78
 
79
+ msgid "Disable"
80
+ msgstr ""
81
+
82
+ msgid "Disable rule?"
83
+ msgstr ""
84
+
60
85
  msgid "Discovered Host Pool"
61
86
  msgstr ""
62
87
 
@@ -66,9 +91,60 @@ msgstr "發現的主機:%s"
66
91
  msgid "Discovered hosts"
67
92
  msgstr "發現的主機"
68
93
 
94
+ msgid "Discovered hosts are provisioning now"
95
+ msgstr ""
96
+
97
+ msgid "Discovery Rules"
98
+ msgstr ""
99
+
100
+ msgid "Discovery rules"
101
+ msgstr ""
102
+
69
103
  msgid "Discovery widget"
70
104
  msgstr ""
71
105
 
106
+ msgid "DiscoveryRule|Enabled"
107
+ msgstr ""
108
+
109
+ msgid "DiscoveryRule|Name"
110
+ msgstr ""
111
+
112
+ msgid "DiscoveryRule|Priority"
113
+ msgstr ""
114
+
115
+ msgid "DiscoveryRule|Query"
116
+ msgstr ""
117
+
118
+ msgid "Disk count"
119
+ msgstr ""
120
+
121
+ msgid "Disks size"
122
+ msgstr ""
123
+
124
+ msgid ""
125
+ "Domain will be appended automatically. A hostname based on MAC address will "
126
+ "be used when left blank. In addition to @host attribute function rand for "
127
+ "random integers is available. Examples:"
128
+ msgstr ""
129
+
130
+ msgid "Edit Discovery Rule"
131
+ msgstr ""
132
+
133
+ msgid "Enable"
134
+ msgstr ""
135
+
136
+ msgid "Enable rule?"
137
+ msgstr ""
138
+
139
+ msgid "Errors during auto provisioning: %s"
140
+ msgstr ""
141
+
142
+ msgid "Execute rules against a discovered host"
143
+ msgstr ""
144
+
145
+ msgid "Execute rules against all currently discovered hosts"
146
+ msgstr ""
147
+
72
148
  msgid "Fact"
73
149
  msgstr "詳情"
74
150
 
@@ -78,20 +154,50 @@ msgstr "在這部主機上發現的詳情"
78
154
  msgid "Facts refreshed for %s"
79
155
  msgstr "%s 的詳情已刷新"
80
156
 
81
- msgid "Failed to import facts for Host::Discovered"
82
- msgstr "匯入 Host::Discovered 的詳情失敗"
157
+ msgid "Failed to auto provision host %s: %s"
158
+ msgstr ""
83
159
 
84
- msgid "Failed to import facts for Host::Discovered: %s"
85
- msgstr "匯入 Host::Discovered 的詳情失敗:%s"
160
+ msgid "Failed to import facts for discovered host"
161
+ msgstr ""
86
162
 
87
- msgid "Failed to reboot: %s"
88
- msgstr "重新啟動失敗:%s"
163
+ msgid "Failed to import facts for discovered host: %s"
164
+ msgstr ""
165
+
166
+ msgid "Failed to reboot host %s"
167
+ msgstr ""
168
+
169
+ msgid "Failed to reboot host %{hostname} with error %{error_message}"
170
+ msgstr ""
89
171
 
90
172
  msgid "Failed to refresh facts for %s"
91
173
  msgstr "刷新 %s 的詳情失敗"
92
174
 
93
- msgid "Imported Host::Discovered"
94
- msgstr "已匯入 Host::Discovered"
175
+ msgid "Host"
176
+ msgstr "主機"
177
+
178
+ msgid "Host %{host} was provisioned with rule %{rule}"
179
+ msgstr ""
180
+
181
+ msgid "Host group"
182
+ msgstr "主機群組"
183
+
184
+ msgid "Host of type %s can not be rebooted"
185
+ msgstr ""
186
+
187
+ msgid "Hostname for provisioned hosts"
188
+ msgstr ""
189
+
190
+ msgid "Hosts limit"
191
+ msgstr ""
192
+
193
+ msgid "Hosts/limit"
194
+ msgstr ""
195
+
196
+ msgid "IP Address"
197
+ msgstr "IP 位址"
198
+
199
+ msgid "Imported discovered host"
200
+ msgstr ""
95
201
 
96
202
  msgid "Invalid facts, must be a Hash"
97
203
  msgstr "詳情無效,必須是雜湊"
@@ -108,24 +214,48 @@ msgstr "最後上傳的詳情"
108
214
  msgid "List all discovered hosts"
109
215
  msgstr ""
110
216
 
217
+ msgid "List all discovery rules"
218
+ msgstr ""
219
+
111
220
  msgid "Location"
112
221
  msgstr "位置"
113
222
 
223
+ msgid "Maximum hosts provisioned with this rule (0 = unlimited)"
224
+ msgstr ""
225
+
226
+ msgid "Memory"
227
+ msgstr "記憶體"
228
+
114
229
  msgid "Model"
115
230
  msgstr "型號"
116
231
 
232
+ msgid "N/A"
233
+ msgstr "N/A"
234
+
117
235
  msgid "Name"
118
236
  msgstr "名稱"
119
237
 
238
+ msgid "New Discovery Rule"
239
+ msgstr ""
240
+
241
+ msgid "New Rule"
242
+ msgstr ""
243
+
120
244
  msgid "No discovered hosts available"
121
245
  msgstr ""
122
246
 
247
+ msgid "No discovered hosts to provision"
248
+ msgstr ""
249
+
123
250
  msgid "No hosts selected"
124
251
  msgstr "未選擇主機"
125
252
 
126
253
  msgid "No hosts were found with that id or name"
127
254
  msgstr "沒有找到擁有此 ID 或名稱的主機"
128
255
 
256
+ msgid "No rule found for host %s"
257
+ msgstr ""
258
+
129
259
  msgid "Organization"
130
260
  msgstr "組織"
131
261
 
@@ -138,12 +268,33 @@ msgstr "佈建"
138
268
  msgid "Provision a discovered host"
139
269
  msgstr ""
140
270
 
271
+ msgid "Reboot"
272
+ msgstr ""
273
+
141
274
  msgid "Rebooting %s"
142
275
  msgstr "重新啟動 %s"
143
276
 
277
+ msgid "Rebooting a discovered host"
278
+ msgstr ""
279
+
280
+ msgid "Rebooting host %s"
281
+ msgstr ""
282
+
144
283
  msgid "Refresh facts"
145
284
  msgstr "刷新詳情"
146
285
 
286
+ msgid "Refreshing the facts of a discovered host"
287
+ msgstr ""
288
+
289
+ msgid "Rule disabled"
290
+ msgstr ""
291
+
292
+ msgid "Rule enabled"
293
+ msgstr ""
294
+
295
+ msgid "Rule priority (lower integer means higher priority)"
296
+ msgstr ""
297
+
147
298
  msgid "Select Action"
148
299
  msgstr "選擇動作"
149
300
 
@@ -159,15 +310,32 @@ msgstr "選擇組織"
159
310
  msgid "Show a discovered host"
160
311
  msgstr ""
161
312
 
313
+ msgid "Show a discovery rule"
314
+ msgstr ""
315
+
316
+ msgid "Show fact as an extra column in the discovered hosts list"
317
+ msgstr ""
318
+
162
319
  msgid "Something went wrong while selecting hosts - %s"
163
320
  msgstr "選擇主機時發生了錯誤 - %s"
164
321
 
322
+ msgid ""
323
+ "Specify target hostname template pattern in the same syntax as in "
324
+ "Provisioning Templates (ERB)."
325
+ msgstr ""
326
+
165
327
  msgid "Submit"
166
328
  msgstr "提交"
167
329
 
168
330
  msgid "Subnet"
169
331
  msgstr "子網路"
170
332
 
333
+ msgid "Target host group for this rule with all properties set"
334
+ msgstr ""
335
+
336
+ msgid "Template"
337
+ msgstr "範本"
338
+
171
339
  msgid "The default fact name to use for the MAC of the system"
172
340
  msgstr "系統之 MAC 所使用的預設詳情名稱"
173
341
 
@@ -177,6 +345,9 @@ msgstr "放置已發現之主機的預設位置"
177
345
  msgid "The default organization to place discovered hosts in"
178
346
  msgstr "放置已發現之主機的預設組織"
179
347
 
348
+ msgid "The default prefix to use for the host name, must start with a letter"
349
+ msgstr ""
350
+
180
351
  msgid "The following hosts were not deleted: %s"
181
352
  msgstr "下列主機尚未刪除:%s"
182
353
 
@@ -193,6 +364,9 @@ msgid ""
193
364
  "UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks"
194
365
  msgstr ""
195
366
 
367
+ msgid "Update a rule"
368
+ msgstr ""
369
+
196
370
  msgid "Upload facts for a host, creating the host if required"
197
371
  msgstr ""
198
372
 
@@ -202,6 +376,15 @@ msgstr "值"
202
376
  msgid "Warning"
203
377
  msgstr "警告"
204
378
 
379
+ msgid ""
380
+ "When creating hostname patterns, make sure the resulting host names are "
381
+ "unique. Hostnames must not start with numbers. A good approach is to use "
382
+ "unique information provided by facter (MAC address, BIOS or serial ID)."
383
+ msgstr ""
384
+
385
+ msgid "can't contain white spaces."
386
+ msgstr ""
387
+
205
388
  msgid "filter results"
206
389
  msgstr ""
207
390
 
@@ -211,6 +394,9 @@ msgstr ""
211
394
  msgid "items selected. Uncheck to Clear"
212
395
  msgstr "已選取項目。反選以清除"
213
396
 
397
+ msgid "must start with a letter or ERB."
398
+ msgstr ""
399
+
214
400
  msgid "not required if it's a virtual machine"
215
401
  msgstr ""
216
402
 
@@ -223,5 +409,10 @@ msgstr ""
223
409
  msgid "paginate results"
224
410
  msgstr ""
225
411
 
412
+ msgid ""
413
+ "required if value is not inherited from host group or default password in "
414
+ "settings"
415
+ msgstr ""
416
+
226
417
  msgid "sort results"
227
418
  msgstr ""
@@ -10,6 +10,7 @@ FactoryGirl.define do
10
10
  end
11
11
  end
12
12
 
13
+ # Not used yet, we need to refactor core first
13
14
  FactoryGirl.define do
14
15
  factory :discovered_host, class: 'Host::Discovered' do
15
16
  sequence(:name) { |n| "host#{n}" }
@@ -13,10 +13,12 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
13
13
  User.current = User.find_by_login "admin"
14
14
  @request.env['HTTP_REFERER'] = '/discovery_rules'
15
15
  @facts = {
16
- "ipaddress" => "192.168.100.42",
17
- "macaddress" => "AA:BB:CC:DD:EE:FF",
16
+ "interfaces" => "lo,eth0",
17
+ "ipaddress" => "192.168.100.42",
18
+ "ipaddress_eth0" => "192.168.100.42",
19
+ "macaddress_eth0" => "AA:BB:CC:DD:EE:FF",
18
20
  "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
19
- "memorysize_mb" => "42000.42",
21
+ "memorysize_mb" => "42000.42",
20
22
  }
21
23
  FactoryGirl.create(:setting,
22
24
  :name => 'discovery_auto',
@@ -30,6 +32,18 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
30
32
  end
31
33
 
32
34
  def test_show_host
35
+ SETTINGS[:organizations_enabled] = true
36
+ SETTINGS[:locations_enabled] = true
37
+ FactoryGirl.create(:organization, :name => 'SomeOrg')
38
+ FactoryGirl.create(:location, :name => 'SomeLoc')
39
+ FactoryGirl.create(:setting,
40
+ :name => 'discovery_organization',
41
+ :value => 'SomeOrg',
42
+ :category => 'Setting::Discovered')
43
+ FactoryGirl.create(:setting,
44
+ :name => 'discovery_location',
45
+ :value => 'SomeLoc',
46
+ :category => 'Setting::Discovered')
33
47
  host = Host::Discovered.import_host_and_facts(@facts).first
34
48
  get :show, { :id => host.id }
35
49
  assert_response :success
@@ -38,7 +52,8 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
38
52
  assert_equal 42001, show_response["memory"]
39
53
  assert_equal 0, show_response["disk_count"]
40
54
  assert_equal 0, show_response["disks_size"]
41
- assert_equal "Empty Organization", show_response["organization_name"]
55
+ assert_equal 'SomeOrg', show_response["organization_name"]
56
+ assert_equal 'SomeLoc', show_response["location_name"]
42
57
  end
43
58
 
44
59
  def test_delete_discovered_host
@@ -6,8 +6,10 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
6
6
  setup do
7
7
  @request.env['HTTP_REFERER'] = '/discovery_rules'
8
8
  @facts = {
9
- "ipaddress" => "192.168.100.42",
10
- "macaddress" => "AA:BB:CC:DD:EE:FF",
9
+ "interfaces" => "lo,eth0",
10
+ "ipaddress" => "192.168.100.42",
11
+ "ipaddress_eth0" => "192.168.100.42",
12
+ "macaddress_eth0" => "AA:BB:CC:DD:EE:FF",
11
13
  "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
12
14
  }
13
15
  end
@@ -30,7 +32,6 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
30
32
  end
31
33
 
32
34
  def test_edit_form
33
- skip "until foreman 1.8"
34
35
  host = Host::Discovered.import_host_and_facts(@facts).first
35
36
  get :edit, {:id => host.id}, set_session_user
36
37
  assert_select "select" do |elements|
@@ -5,26 +5,28 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
5
5
 
6
6
  setup do
7
7
  @facts = {
8
- "ipaddress" => "192.168.100.42",
9
- "macaddress" => "AA:BB:CC:DD:EE:FF",
8
+ "interfaces" => "lo,eth0",
9
+ "ipaddress" => "192.168.100.42",
10
+ "ipaddress_eth0" => "192.168.100.42",
11
+ "macaddress_eth0" => "AA:BB:CC:DD:EE:FF",
10
12
  "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
11
13
  }
12
14
  end
13
15
 
14
16
  test "no rule is found for empty rule set" do
15
- host = FactoryGirl.create(:host)
17
+ host = Host::Discovered.import_host_and_facts(@facts).first
16
18
  refute find_discovery_rule(host)
17
19
  end
18
20
 
19
21
  test "no rule is found out of one for a discovered host with no facts" do
20
- host = FactoryGirl.create(:host)
22
+ host = Host::Discovered.import_host_and_facts(@facts).first
21
23
  FactoryGirl.create(:discovery_rule, :search => "facts.foo = bar")
22
24
  refute find_discovery_rule(host)
23
25
  end
24
26
 
25
27
  test "no rule is found out of one for a discovered host with some facts" do
26
- host = FactoryGirl.create(:host, :with_facts)
27
- FactoryGirl.create(:discovery_rule, :search => "facts.foo = does not exist")
28
+ host = Host::Discovered.import_host_and_facts(@facts).first
29
+ FactoryGirl.create(:discovery_rule, :search => "facts.foo = doesnotexist")
28
30
  refute find_discovery_rule(host)
29
31
  end
30
32
 
@@ -73,7 +75,7 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
73
75
  host = Host::Discovered.import_host_and_facts(facts).first
74
76
  r1 = FactoryGirl.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc")
75
77
  perform_auto_provision host, r1
76
- assert_equal host.managed, true
78
+ assert_equal host.primary_interface.managed, true
77
79
  assert_equal host.build, true
78
80
  assert_equal host.hostgroup_id, r1.hostgroup_id
79
81
  assert_equal host.discovery_rule_id, r1.id