foreman_discovery 4.0.0 → 4.1.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/discovered_hosts_controller.rb +12 -3
  3. data/app/models/host/discovered.rb +28 -25
  4. data/app/models/host/managed_extensions.rb +24 -3
  5. data/app/services/foreman_discovery/host_converter.rb +16 -2
  6. data/app/services/foreman_discovery/node_api/node_resource.rb +117 -0
  7. data/app/services/foreman_discovery/node_api/power.rb +57 -0
  8. data/{lib → app/services}/foreman_discovery/proxy_operations.rb +0 -0
  9. data/app/views/foreman_discovery/redhat_kexec.erb +44 -0
  10. data/db/seeds.d/50_discovery_templates.rb +18 -0
  11. data/lib/foreman_discovery/engine.rb +1 -1
  12. data/lib/foreman_discovery/version.rb +1 -1
  13. data/locale/de/foreman_discovery.po +146 -64
  14. data/locale/en_GB/foreman_discovery.po +146 -64
  15. data/locale/es/foreman_discovery.po +146 -64
  16. data/locale/foreman_discovery.pot +97 -41
  17. data/locale/fr/foreman_discovery.po +146 -64
  18. data/locale/gl/foreman_discovery.po +100 -59
  19. data/locale/it/foreman_discovery.po +106 -59
  20. data/locale/ja/foreman_discovery.po +132 -61
  21. data/locale/ko/foreman_discovery.po +104 -58
  22. data/locale/pt_BR/foreman_discovery.po +106 -59
  23. data/locale/ru/foreman_discovery.po +152 -66
  24. data/locale/sv_SE/foreman_discovery.po +103 -59
  25. data/locale/zh_CN/foreman_discovery.po +104 -58
  26. data/locale/zh_TW/foreman_discovery.po +104 -58
  27. data/test/functional/api/v2/discovered_hosts_controller_test.rb +30 -11
  28. data/test/functional/discovered_hosts_controller_test.rb +30 -26
  29. data/test/unit/discovered_extensions_test.rb +8 -8
  30. metadata +10 -34
  31. data/app/views/api/v2/discovered_hosts/auto_provision.json.rabl +0 -3
  32. data/app/views/api/v2/discovered_hosts/auto_provision_all.json.rabl +0 -3
  33. data/locale/Makefile +0 -62
  34. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/de/foreman_discovery.pox +0 -40
  36. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  37. data/locale/en_GB/foreman_discovery.pox +0 -0
  38. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  39. data/locale/es/foreman_discovery.pox +0 -41
  40. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/fr/foreman_discovery.pox +0 -69
  42. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  43. data/locale/gl/foreman_discovery.pox +0 -21
  44. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  45. data/locale/it/foreman_discovery.pox +0 -0
  46. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  47. data/locale/ja/foreman_discovery.pox +0 -29
  48. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  49. data/locale/ko/foreman_discovery.pox +0 -189
  50. data/locale/messages.mo +0 -0
  51. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  52. data/locale/pt_BR/foreman_discovery.pox +0 -0
  53. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  54. data/locale/ru/foreman_discovery.pox +0 -0
  55. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  56. data/locale/zanata.xml +0 -28
  57. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  58. data/locale/zh_CN/foreman_discovery.pox +0 -33
  59. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  60. data/locale/zh_TW/foreman_discovery.pox +0 -23
@@ -13,17 +13,23 @@ 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
- "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",
20
- "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
21
- "memorysize_mb" => "42000.42",
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",
20
+ "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
21
+ "memorysize_mb" => "42000.42",
22
+ "discovery_version" => "3.0.0",
22
23
  }
23
24
  FactoryGirl.create(:setting,
24
25
  :name => 'discovery_auto',
25
26
  :value => true,
26
27
  :category => 'Setting::Discovered')
28
+ FactoryGirl.create(:setting,
29
+ :name => 'discovery_reboot',
30
+ :value => true,
31
+ :category => 'Setting::Discovered')
32
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.stubs(:reboot).returns(true)
27
33
  end
28
34
 
29
35
  def test_get_index
@@ -75,13 +81,26 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
75
81
 
76
82
  def test_auto_provision_success
77
83
  disable_orchestration
78
- facts = @facts.merge({"somefact" => "abc"})
84
+ facts = @facts.merge({"somefact" => "abc", "discovery_version" => "2.9.9"})
79
85
  host = Host::Discovered.import_host_and_facts(facts).first
80
- FactoryGirl.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc",
86
+ rule = FactoryGirl.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc",
81
87
  :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass),
82
88
  :organizations => [host.organization], :locations => [host.location])
83
89
  post :auto_provision, { :id => host.id }
84
- assert_match host.name, @response.body
90
+ assert_match /Host #{host.name} was provisioned with rule #{rule.name}/, @response.body
91
+ assert_response :success
92
+ end
93
+
94
+ def test_auto_provision_kexec_success
95
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.stubs(:kexec).returns(true)
96
+ Host::Managed::any_instance.stubs(:provisioning_template).with(:kind => 'kexec').returns("")
97
+ facts = @facts.merge({"somefact" => "abc", "discovery_kexec" => "kexec-tools 2.0.8 released 15 February 2015"})
98
+ host = Host::Discovered.import_host_and_facts(facts).first
99
+ rule = FactoryGirl.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc",
100
+ :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass),
101
+ :organizations => [host.organization], :locations => [host.location])
102
+ post :auto_provision, { :id => host.id }
103
+ assert_match /Host #{host.name} was provisioned with rule #{rule.name}/, @response.body
85
104
  assert_response :success
86
105
  end
87
106
 
@@ -144,7 +163,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
144
163
  :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass), :organizations => [host.organization],
145
164
  :locations => [host.location])
146
165
  post :auto_provision_all, {}
147
- assert_equal '{}', @response.body
166
+ assert_match /1 discovered hosts were provisioned/, @response.body
148
167
  assert_response :success
149
168
  end
150
169
 
@@ -153,7 +172,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
153
172
  facts = @facts.merge({"somefact" => "abc"})
154
173
  Host::Discovered.import_host_and_facts(facts).first
155
174
  post :auto_provision_all, {}
156
- assert_equal '{}', @response.body
175
+ assert_match /0 discovered hosts were provisioned/, @response.body
157
176
  assert_response :success
158
177
  end
159
178
 
@@ -12,11 +12,13 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
12
12
  "macaddress_eth0" => "AA:BB:CC:DD:EE:FF",
13
13
  "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
14
14
  "physicalprocessorcount" => "42",
15
+ "discovery_version" => "3.0.0",
15
16
  }
16
17
  FactoryGirl.create(:setting,
17
18
  :name => 'discovery_reboot',
18
19
  :value => true,
19
20
  :category => 'Setting::Discovered')
21
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.stubs(:reboot).returns(true)
20
22
  end
21
23
 
22
24
  def test_index
@@ -63,21 +65,31 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
63
65
 
64
66
  def test_reboot_success
65
67
  @request.env["HTTP_REFERER"] = discovered_hosts_url
66
- host = FactoryGirl.create(:host,
67
- :ip => '1.2.3.4',
68
- :type => "Host::Discovered")
69
- ::ProxyAPI::BMC.any_instance.stubs(:power).returns(true)
68
+ host = Host::Discovered.import_host_and_facts(@facts).first
69
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(true)
70
70
  post "reboot", { :id => host.id }, set_session_user
71
71
  assert_redirected_to discovered_hosts_url
72
+ assert_nil flash[:error]
73
+ assert_equal "Rebooting host #{host.name}", flash[:notice]
74
+ end
75
+
76
+ def test_reboot_success_legacy
77
+ @request.env["HTTP_REFERER"] = discovered_hosts_url
78
+ facts = @facts.merge({"somefact" => "abc", "discovery_version" => "2.9.9"})
79
+ host = Host::Discovered.import_host_and_facts(facts).first
80
+ Host::Discovered::any_instance.stubs(:proxied?).returns(false)
81
+ Host::Discovered::any_instance.stubs(:proxy_url).returns("http://1.2.3.4:8443")
82
+ ::ForemanDiscovery::NodeAPI::PowerLegacyDirectService.any_instance.expects(:reboot).returns(true)
83
+ post "reboot", { :id => host.id }, set_session_user
84
+ assert_redirected_to discovered_hosts_url
85
+ assert_nil flash[:error]
72
86
  assert_equal "Rebooting host #{host.name}", flash[:notice]
73
87
  end
74
88
 
75
89
  def test_reboot_failure
76
90
  @request.env["HTTP_REFERER"] = discovered_hosts_url
77
- host = FactoryGirl.create(:host,
78
- :ip => '1.2.3.4',
79
- :type => "Host::Discovered")
80
- ::ProxyAPI::BMC.any_instance.stubs(:power).returns(false)
91
+ host = Host::Discovered.import_host_and_facts(@facts).first
92
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
81
93
  post "reboot", { :id => host.id }, set_session_user
82
94
  assert_redirected_to discovered_hosts_url
83
95
  assert_equal "Failed to reboot host #{host.name}", flash[:error]
@@ -85,13 +97,11 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
85
97
 
86
98
  def test_reboot_error
87
99
  @request.env["HTTP_REFERER"] = discovered_hosts_url
88
- host = FactoryGirl.create(:host,
89
- :ip => '1.2.3.4',
90
- :type => "Host::Discovered")
91
- ::ProxyAPI::BMC.any_instance.expects(:power).raises("request failed")
100
+ host = Host::Discovered.import_host_and_facts(@facts).first
101
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
92
102
  post "reboot", { :id => host.id }, set_session_user
93
103
  assert_redirected_to discovered_hosts_url
94
- assert_match(/ERF50-6734/, flash[:error])
104
+ assert_match(/ERF50-4973/, flash[:error])
95
105
  end
96
106
 
97
107
  def test_auto_provision_success
@@ -135,10 +145,8 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
135
145
 
136
146
  def test_reboot_all_success
137
147
  @request.env["HTTP_REFERER"] = discovered_hosts_url
138
- host = FactoryGirl.create(:host,
139
- :ip => '1.2.3.4',
140
- :type => "Host::Discovered")
141
- ::ProxyAPI::BMC.any_instance.stubs(:power).returns(true)
148
+ host = Host::Discovered.import_host_and_facts(@facts).first
149
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(true)
142
150
  post "reboot", { :id => host.id }, set_session_user
143
151
  assert_redirected_to discovered_hosts_url
144
152
  assert_equal "Rebooting host #{host.name}", flash[:notice]
@@ -146,10 +154,8 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
146
154
 
147
155
  def test_reboot_all_failure
148
156
  @request.env["HTTP_REFERER"] = discovered_hosts_url
149
- host = FactoryGirl.create(:host,
150
- :ip => '1.2.3.4',
151
- :type => "Host::Discovered")
152
- ::ProxyAPI::BMC.any_instance.stubs(:power).returns(false)
157
+ host = Host::Discovered.import_host_and_facts(@facts).first
158
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
153
159
  post "reboot_all", { }, set_session_user
154
160
  assert_redirected_to discovered_hosts_url
155
161
  assert_equal "Errors during reboot: #{host.name}: failed to reboot", flash[:error]
@@ -157,13 +163,11 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
157
163
 
158
164
  def test_reboot_all_error
159
165
  @request.env["HTTP_REFERER"] = discovered_hosts_url
160
- FactoryGirl.create(:host,
161
- :ip => '1.2.3.4',
162
- :type => "Host::Discovered")
163
- ::ProxyAPI::BMC.any_instance.expects(:power).raises("request must fail")
166
+ host = Host::Discovered.import_host_and_facts(@facts).first
167
+ ::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
164
168
  post "reboot_all", { }, set_session_user
165
169
  assert_redirected_to discovered_hosts_url
166
- assert_match(/ERF50-6734/, flash[:error])
170
+ assert_match(/ERF50-4973/, flash[:error])
167
171
  end
168
172
 
169
173
  private
@@ -135,7 +135,7 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
135
135
  :hostname => '<%= "" %>',
136
136
  :organizations => [host.organization],
137
137
  :locations => [host.location])
138
- perform_auto_provision host, r1
138
+ refute perform_auto_provision host, r1
139
139
  assert_equal "macaabbccddeeff", host.name
140
140
  end
141
141
 
@@ -146,7 +146,7 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
146
146
  :hostname => 'x<%= 1+1 %>',
147
147
  :organizations => [host.organization],
148
148
  :locations => [host.location])
149
- perform_auto_provision host, r1
149
+ refute perform_auto_provision host, r1
150
150
  assert_equal "x2", host.name
151
151
  end
152
152
 
@@ -157,7 +157,7 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
157
157
  :hostname => 'x<%= rand(4) %>',
158
158
  :organizations => [host.organization],
159
159
  :locations => [host.location])
160
- perform_auto_provision host, r1
160
+ refute perform_auto_provision host, r1
161
161
  assert_match(/x[0123]/, host.name)
162
162
  end
163
163
 
@@ -168,7 +168,7 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
168
168
  :hostname => 'x<%= @host.name %>',
169
169
  :organizations => [host.organization],
170
170
  :locations => [host.location])
171
- perform_auto_provision host, r1
171
+ refute perform_auto_provision host, r1
172
172
  assert_equal "xmacaabbccddeeff", host.name
173
173
  end
174
174
 
@@ -179,19 +179,19 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
179
179
  :hostname => 'x<%= @host.ip.gsub(".","-") %>',
180
180
  :organizations => [host.organization],
181
181
  :locations => [host.location])
182
- perform_auto_provision host, r1
182
+ refute perform_auto_provision host, r1
183
183
  assert_equal "x192-168-100-42", host.name
184
184
  end
185
185
 
186
186
  test "hostname attribute facts_hash is renderer properly using #{renderer_name}" do
187
- skip "until http://projects.theforeman.org/issues/2948 is fixed"
188
- host = Host::Discovered.import_host_and_facts(@facts).first
187
+ facts = @facts.merge({"somefact" => "abc"})
188
+ host = Host::Discovered.import_host_and_facts(facts).first
189
189
  r1 = FactoryGirl.create(:discovery_rule,
190
190
  :search => "facts.somefact = abc",
191
191
  :hostname => 'x<%= @host.facts["somefact"] %>',
192
192
  :organizations => [host.organization],
193
193
  :locations => [host.location])
194
- perform_auto_provision host, r1
194
+ refute perform_auto_provision host, r1
195
195
  assert_equal "xabc", host.name
196
196
  end
197
197
 
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Sutcliffe
8
+ - Lukas Zapletal
9
+ - Ori Rabin
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2015-08-12 00:00:00.000000000 Z
13
+ date: 2015-09-21 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: deface
@@ -39,6 +41,9 @@ files:
39
41
  - app/controllers/api/v2/discovered_hosts_controller.rb
40
42
  - app/lib/puppet_fact_parser_extensions.rb
41
43
  - app/lib/facter_utils.rb
44
+ - app/services/foreman_discovery/node_api/node_resource.rb
45
+ - app/services/foreman_discovery/node_api/power.rb
46
+ - app/services/foreman_discovery/proxy_operations.rb
42
47
  - app/services/foreman_discovery/host_converter.rb
43
48
  - app/helpers/discovery_rules_helper.rb
44
49
  - app/helpers/discovered_hosts_helper.rb
@@ -71,11 +76,10 @@ files:
71
76
  - app/views/api/v2/discovery_rules/show.json.rabl
72
77
  - app/views/api/v2/discovered_hosts/index.json.rabl
73
78
  - app/views/api/v2/discovered_hosts/update.json.rabl
74
- - app/views/api/v2/discovered_hosts/auto_provision_all.json.rabl
75
79
  - app/views/api/v2/discovered_hosts/base.json.rabl
76
80
  - app/views/api/v2/discovered_hosts/main.json.rabl
77
- - app/views/api/v2/discovered_hosts/auto_provision.json.rabl
78
81
  - app/views/api/v2/discovered_hosts/show.json.rabl
82
+ - app/views/foreman_discovery/redhat_kexec.erb
79
83
  - extra/build_iso.sh
80
84
  - extra/wait_for_network.sh
81
85
  - extra/disk_facts.rb
@@ -97,54 +101,26 @@ files:
97
101
  - db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb
98
102
  - db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb
99
103
  - db/migrate/20150714144500_review_discovery_permissions.rb
104
+ - db/seeds.d/50_discovery_templates.rb
100
105
  - db/seeds.d/60_discovery_proxy_feature.rb
101
106
  - lib/discovery.rake
102
107
  - lib/foreman_discovery.rb
103
- - lib/foreman_discovery/proxy_operations.rb
104
108
  - lib/foreman_discovery/version.rb
105
109
  - lib/foreman_discovery/engine.rb
106
- - locale/foreman_discovery.pot
107
- - locale/Makefile
108
110
  - locale/ru/foreman_discovery.po
109
- - locale/ru/foreman_discovery.pox
110
- - locale/ru/LC_MESSAGES/foreman_discovery.mo
111
111
  - locale/de/foreman_discovery.po
112
- - locale/de/foreman_discovery.pox
113
- - locale/de/LC_MESSAGES/foreman_discovery.mo
114
112
  - locale/pt_BR/foreman_discovery.po
115
- - locale/pt_BR/foreman_discovery.pox
116
- - locale/pt_BR/LC_MESSAGES/foreman_discovery.mo
117
113
  - locale/en_GB/foreman_discovery.po
118
- - locale/en_GB/foreman_discovery.pox
119
- - locale/en_GB/LC_MESSAGES/foreman_discovery.mo
120
114
  - locale/zh_TW/foreman_discovery.po
121
- - locale/zh_TW/foreman_discovery.pox
122
- - locale/zh_TW/LC_MESSAGES/foreman_discovery.mo
123
115
  - locale/es/foreman_discovery.po
124
- - locale/es/foreman_discovery.pox
125
- - locale/es/LC_MESSAGES/foreman_discovery.mo
126
116
  - locale/fr/foreman_discovery.po
127
- - locale/fr/foreman_discovery.pox
128
- - locale/fr/LC_MESSAGES/foreman_discovery.mo
129
117
  - locale/it/foreman_discovery.po
130
- - locale/it/foreman_discovery.pox
131
- - locale/it/LC_MESSAGES/foreman_discovery.mo
132
- - locale/messages.mo
133
118
  - locale/ja/foreman_discovery.po
134
- - locale/ja/foreman_discovery.pox
135
- - locale/ja/LC_MESSAGES/foreman_discovery.mo
136
119
  - locale/ko/foreman_discovery.po
137
- - locale/ko/foreman_discovery.pox
138
- - locale/ko/LC_MESSAGES/foreman_discovery.mo
139
120
  - locale/zh_CN/foreman_discovery.po
140
- - locale/zh_CN/foreman_discovery.pox
141
- - locale/zh_CN/LC_MESSAGES/foreman_discovery.mo
142
- - locale/zanata.xml
143
121
  - locale/gl/foreman_discovery.po
144
- - locale/gl/foreman_discovery.pox
145
- - locale/gl/LC_MESSAGES/foreman_discovery.mo
146
122
  - locale/sv_SE/foreman_discovery.po
147
- - locale/sv_SE/LC_MESSAGES/foreman_discovery.mo
123
+ - locale/foreman_discovery.pot
148
124
  - LICENSE
149
125
  - README.md
150
126
  - test/functional/discovery_rules_controller_test.rb
@@ -1,3 +0,0 @@
1
- object @discovered_host
2
-
3
- extends "api/v2/hosts/main"
@@ -1,3 +0,0 @@
1
- object @discovered_host
2
-
3
- extends "api/v2/hosts/main"
data/locale/Makefile DELETED
@@ -1,62 +0,0 @@
1
- #
2
- # Makefile for PO merging and MO generation. More info in the README.
3
- #
4
- # make all-mo (default) - generate MO files
5
- # make check - check translations using translate-tool
6
- # make tx-update - download and merge translations from Transifex
7
- # make clean - clean everything
8
- #
9
- DOMAIN = foreman_discovery
10
- VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load(Dir.glob("../*.gemspec")[0]);puts spec.version')
11
- POTFILE = $(DOMAIN).pot
12
- MOFILE = $(DOMAIN).mo
13
- POFILES = $(shell find . -name '*.po')
14
- MOFILES = $(patsubst %.po,%.mo,$(POFILES))
15
- POXFILES = $(patsubst %.po,%.pox,$(POFILES))
16
-
17
- %.mo: %.po
18
- mkdir -p $(shell dirname $@)/LC_MESSAGES
19
- msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
20
-
21
- # Generate MO files from PO files
22
- all-mo: $(MOFILES)
23
-
24
- # Check for malformed strings
25
- %.pox: %.po
26
- msgfmt -c $<
27
- pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
28
- -t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
29
- cat $@
30
- ! grep -q msgid $@
31
-
32
- check: $(POXFILES)
33
- msgfmt -c ${POTFILE}
34
-
35
- # Merge PO files
36
- update-po:
37
- for f in $(shell find ./ -name "*.po") ; do \
38
- msgmerge -N --backup=none -U $$f ${POTFILE} ; \
39
- done
40
-
41
- # Unify duplicate translations
42
- uniq-po:
43
- for f in $(shell find ./ -name "*.po") ; do \
44
- msguniq $$f -o $$f ; \
45
- done
46
-
47
- tx-pull:
48
- tx pull -f
49
- for f in $(POFILES) ; do \
50
- sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
51
- done
52
- -git commit -a -m "i18n - pulling from tx"
53
-
54
- reset-po:
55
- # merging po files is unnecessary when using transifex.com
56
- git checkout -- ../locale/*/*po
57
-
58
- tx-update: tx-pull reset-po $(MOFILES)
59
- # amend mo files
60
- git add ../locale/*/LC_MESSAGES
61
- git commit -a --amend -m "i18n - pulling from tx"
62
- -echo Changes commited!
@@ -1,40 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: foreman_discovery 3.0.0\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-01-28 17:53+0100\n"
6
- "PO-Revision-Date: 2015-06-29 19:06+0000\n"
7
- "Last-Translator: Christina Gurski <Gurski_christina@yahoo.de>\n"
8
- "Language-Team: German "
9
- "(http://www.transifex.com/foreman/foreman/language/de/)\n"
10
- "Language: de\n"
11
- "MIME-Version: 1.0\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
- "Content-Transfer-Encoding: 8bit\n"
14
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
- "X-Generator: Translate Toolkit 1.9.0\n"
16
-
17
- # (pofilter) puncspacing: Different spacing around punctuation
18
- msgid "Could not get facts from proxy %{url}: %{error}"
19
- msgstr "Konnte keine Facts von Proxy %{url} empfangen: %{error}"
20
-
21
- # (pofilter) endwhitespace: Different whitespace at the end
22
- msgid ""
23
- "Specify target hostname template pattern in the same syntax as in "
24
- "Provisioning Templates (ERB)."
25
- msgstr "Spezifizieren Sie die Ziel-Hostnamen-Bereitstellungsvorlage in derselben Syntax wie in Bereitstellungstabellen (ERB). "
26
-
27
- # (pofilter) puncspacing: Different spacing around punctuation
28
- msgid ""
29
- "When creating hostname patterns, make sure the resulting host names are "
30
- "unique. Hostnames must not start with numbers. A good approach is to use "
31
- "unique information provided by facter (MAC address, BIOS or serial ID)."
32
- msgstr "Versichern Sie sich beim Erstellen von Hostnamen-Patterns, dass die resultierenden Hostnamen eindeutig sind. Hostnamen dürfen nicht mit Zahlen beginnen. Ein guter Ansatz besteht darin, eindeutige vom Facter gelieferte Informationen (MAC-Adresse, BIOS oder serielle Kennung) zu verwenden."
33
-
34
- # (pofilter) endpunc: Different punctuation at the end
35
- msgid "can't contain white spaces."
36
- msgstr "kann keine Leerzeichen enthalten"
37
-
38
- # (pofilter) endpunc: Different punctuation at the end
39
- msgid "must start with a letter or ERB."
40
- msgstr "muss mit einem Buchstaben oder ERB beginnen"