foreman_salt 13.2.1 → 14.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/controllers/foreman_salt/api/v2/salt_autosign_controller.rb +31 -1
- data/app/controllers/foreman_salt/api/v2/salt_variables_controller.rb +1 -2
- data/app/lib/proxy_api/salt.rb +16 -2
- data/app/models/foreman_salt/concerns/host_managed_extensions.rb +64 -15
- data/app/models/foreman_salt/salt_status.rb +12 -0
- data/app/services/foreman_salt/report_importer.rb +1 -1
- data/config/routes.rb +1 -0
- data/db/migrate/20210312150333_add_salt_autosign_to_host.rb +6 -0
- data/db/seeds.d/76-job_templates.rb +1 -1
- data/lib/foreman_salt/engine.rb +2 -4
- data/lib/foreman_salt/extensions.rb +0 -3
- data/lib/foreman_salt/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ca/foreman_salt.po +541 -0
- data/locale/cs_CZ/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/cs_CZ/foreman_salt.po +541 -0
- data/locale/de/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/de/foreman_salt.po +0 -18
- data/locale/en/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/en/foreman_salt.po +0 -18
- data/locale/en_GB/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/en_GB/foreman_salt.po +541 -0
- data/locale/es/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/es/foreman_salt.po +541 -0
- data/locale/foreman_salt.pot +22 -46
- data/locale/fr/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/fr/foreman_salt.po +541 -0
- data/locale/gl/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/gl/foreman_salt.po +541 -0
- data/locale/it/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/it/foreman_salt.po +541 -0
- data/locale/ja/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ja/foreman_salt.po +541 -0
- data/locale/ko/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ko/foreman_salt.po +541 -0
- data/locale/nl_NL/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/nl_NL/foreman_salt.po +541 -0
- data/locale/pl/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/pl/foreman_salt.po +542 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/pt_BR/foreman_salt.po +541 -0
- data/locale/ru/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ru/foreman_salt.po +542 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/sv_SE/foreman_salt.po +541 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/zh_CN/foreman_salt.po +541 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/zh_TW/foreman_salt.po +541 -0
- data/test/functional/api/v2/salt_autosign_controller_test.rb +2 -0
- data/test/integration/salt_autosign_test.rb +2 -2
- data/test/integration/salt_keys_test.rb +2 -3
- data/test/unit/host_extensions_test.rb +55 -11
- metadata +40 -15
- data/app/models/foreman_salt/fact_name.rb +0 -14
- data/app/services/foreman_salt/fact_importer.rb +0 -15
- data/app/services/foreman_salt/fact_parser.rb +0 -114
- data/test/unit/grains_centos.json +0 -113
- data/test/unit/salt_fact_importer_test.rb +0 -24
- data/test/unit/salt_fact_parser_test.rb +0 -44
@@ -3,6 +3,8 @@ require 'test_plugin_helper'
|
|
3
3
|
class ::ForemanSalt::Api::V2::SaltAutosignControllerTest < ActionController::TestCase
|
4
4
|
setup do
|
5
5
|
@proxy = FactoryBot.create(:smart_proxy, :with_salt_feature)
|
6
|
+
@host = FactoryBot.create(:host, :managed)
|
7
|
+
@host.salt_proxy = @proxy
|
6
8
|
ProxyAPI::Salt.any_instance.stubs(:autosign_list).returns((%w(foo bar baz)))
|
7
9
|
end
|
8
10
|
|
@@ -19,13 +19,13 @@ module ForemanSalt
|
|
19
19
|
visit smart_proxy_path(@proxy)
|
20
20
|
assert page.has_link? "Salt Autosign"
|
21
21
|
click_link "Salt Autosign"
|
22
|
-
assert page.
|
22
|
+
assert page.has_title?("Autosign entries for #{@proxy.hostname}"), 'Page title does not appear'
|
23
23
|
end
|
24
24
|
|
25
25
|
test 'index page' do
|
26
26
|
visit smart_proxy_salt_autosign_index_path(:smart_proxy_id => @proxy.id)
|
27
27
|
assert find_link('Keys').visible?, 'Keys is not visible'
|
28
|
-
assert
|
28
|
+
assert has_title?("Autosign entries for #{@proxy.hostname}"), 'Page title does not appear'
|
29
29
|
assert has_content?('Displaying'), 'Pagination "Display ..." does not appear'
|
30
30
|
end
|
31
31
|
|
@@ -22,13 +22,12 @@ module ForemanSalt
|
|
22
22
|
visit smart_proxy_path(@proxy)
|
23
23
|
assert page.has_link? "Salt Keys"
|
24
24
|
click_link "Salt Keys"
|
25
|
-
assert page.
|
25
|
+
assert page.has_title?("Salt Keys on #{@proxy}"), 'Page title does not appear'
|
26
26
|
end
|
27
27
|
|
28
28
|
test 'index page' do
|
29
29
|
visit smart_proxy_salt_keys_path(:smart_proxy_id => @proxy.id)
|
30
|
-
assert
|
31
|
-
assert has_content?("Salt Keys on #{@proxy.hostname}"), 'Page title does not appear'
|
30
|
+
assert has_title?("Salt Keys on #{@proxy}"), 'Page title does not appear'
|
32
31
|
assert has_content?('Displaying'), 'Pagination "Display ..." does not appear'
|
33
32
|
end
|
34
33
|
|
@@ -56,23 +56,67 @@ module ForemanSalt
|
|
56
56
|
assert host.configuration?
|
57
57
|
end
|
58
58
|
|
59
|
-
context '
|
59
|
+
context 'autosign handling' do
|
60
60
|
before do
|
61
|
-
@host = FactoryBot.create(:host, :managed
|
61
|
+
@host = FactoryBot.create(:host, :managed)
|
62
62
|
@host.salt_proxy = @proxy
|
63
|
-
|
64
|
-
|
63
|
+
stub_request(:post, "#{@proxy.url}/salt/autosign_key/asdfasdfasfasdf").
|
64
|
+
to_return(status: 200, body: "", headers: {})
|
65
65
|
end
|
66
66
|
|
67
|
-
test 'host
|
68
|
-
|
69
|
-
|
70
|
-
@host.
|
67
|
+
test 'host autosign is created when host is built' do
|
68
|
+
autosign_key = "asdfasdfasfasdf"
|
69
|
+
@host.expects(:generate_provisioning_key).returns(autosign_key)
|
70
|
+
@host.build = true
|
71
|
+
assert @host.save!
|
72
|
+
@host.clear_host_parameters_cache!
|
73
|
+
assert_equal autosign_key, @host.salt_autosign_key
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'function derive_salt_grains' do
|
78
|
+
before do
|
79
|
+
@host = FactoryBot.create(:host, :managed)
|
80
|
+
@host.salt_proxy = @proxy
|
81
|
+
end
|
82
|
+
|
83
|
+
test 'host returns autosign when deriving salt grains' do
|
84
|
+
autosign_key = "asdfasdfasfasdf"
|
85
|
+
expected_hash = { @host.autosign_grain_name => autosign_key }
|
86
|
+
@host.salt_autosign_key = autosign_key
|
87
|
+
assert_equal expected_hash, @host.instance_eval { derive_salt_grains(:use_autosign => true) }
|
88
|
+
end
|
89
|
+
|
90
|
+
test 'host returns empty hash when deriving salt grains without any given' do
|
91
|
+
expected_hash = {}
|
92
|
+
assert_equal expected_hash, @host.instance_eval { derive_salt_grains(:use_autosign => true) }
|
93
|
+
end
|
94
|
+
|
95
|
+
test 'host returns empty hash when deriving salt grains without autosign' do
|
96
|
+
expected_hash = {}
|
97
|
+
assert_equal expected_hash, @host.instance_eval { derive_salt_grains(:use_autosign => false) }
|
98
|
+
end
|
99
|
+
|
100
|
+
test 'host returns host param grains when deriving salt grains' do
|
101
|
+
expected_hash = { "Some key": "Some value", "Another key": "An extraordinary value" }
|
102
|
+
@host.host_params[@host.host_params_grains_name] = expected_hash
|
103
|
+
assert_equal expected_hash, @host.instance_eval { derive_salt_grains(:use_autosign => false) }
|
104
|
+
end
|
105
|
+
|
106
|
+
test 'host returns only host param grains when deriving salt grains' do
|
107
|
+
expected_hash = { "Some key": "Some value", "Another key": "An extraordinary value" }
|
108
|
+
@host.host_params[@host.host_params_grains_name] = expected_hash
|
109
|
+
assert_equal expected_hash, @host.instance_eval { derive_salt_grains(:use_autosign => true) }
|
71
110
|
end
|
72
111
|
|
73
|
-
test 'host
|
74
|
-
|
75
|
-
|
112
|
+
test 'host returns host param grains plus autosign when deriving salt grains' do
|
113
|
+
autosign_key = "asdfasdfasfasdf"
|
114
|
+
host_param_grains = { "Some key": "Some value",
|
115
|
+
"Another key": "An extraordinary value" }
|
116
|
+
expected_hash = host_param_grains.merge(@host.autosign_grain_name => autosign_key)
|
117
|
+
@host.salt_autosign_key = autosign_key
|
118
|
+
@host.host_params[@host.host_params_grains_name] = host_param_grains
|
119
|
+
assert_equal expected_hash, @host.instance_eval { derive_salt_grains(:use_autosign => true) }
|
76
120
|
end
|
77
121
|
end
|
78
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 14.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Benjamin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -42,28 +42,28 @@ dependencies:
|
|
42
42
|
name: foreman_remote_execution
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.71.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.71.0
|
69
69
|
description: Foreman Plug-in for Salt
|
@@ -110,21 +110,19 @@ files:
|
|
110
110
|
- app/lib/proxy_api/salt.rb
|
111
111
|
- app/models/foreman_salt/concerns/host_managed_extensions.rb
|
112
112
|
- app/models/foreman_salt/concerns/hostgroup_extensions.rb
|
113
|
-
- app/models/foreman_salt/fact_name.rb
|
114
113
|
- app/models/foreman_salt/host_salt_module.rb
|
115
114
|
- app/models/foreman_salt/hostgroup_salt_module.rb
|
116
115
|
- app/models/foreman_salt/salt_environment.rb
|
117
116
|
- app/models/foreman_salt/salt_module.rb
|
118
117
|
- app/models/foreman_salt/salt_module_environment.rb
|
119
118
|
- app/models/foreman_salt/salt_provider.rb
|
119
|
+
- app/models/foreman_salt/salt_status.rb
|
120
120
|
- app/models/foreman_salt/salt_variable.rb
|
121
121
|
- app/models/setting/salt.rb
|
122
122
|
- app/overrides/salt_environment_host_selector.rb
|
123
123
|
- app/overrides/salt_environment_hostgroup_selector.rb
|
124
124
|
- app/overrides/salt_modules_selector.rb
|
125
125
|
- app/overrides/salt_proxy_selector.rb
|
126
|
-
- app/services/foreman_salt/fact_importer.rb
|
127
|
-
- app/services/foreman_salt/fact_parser.rb
|
128
126
|
- app/services/foreman_salt/report_importer.rb
|
129
127
|
- app/services/foreman_salt/smart_proxies/salt_keys.rb
|
130
128
|
- app/views/foreman_salt/api/v2/salt_autosign/base.json.rabl
|
@@ -190,6 +188,7 @@ files:
|
|
190
188
|
- db/migrate/20150509101505_add_primary_keys.rb
|
191
189
|
- db/migrate/20161103104146_add_index_to_join_tables.rb
|
192
190
|
- db/migrate/20190515112233_add_salt_module_id_to_lookup_keys.rb
|
191
|
+
- db/migrate/20210312150333_add_salt_autosign_to_host.rb
|
193
192
|
- db/seeds.d/75-salt_seeds.rb
|
194
193
|
- db/seeds.d/76-job_templates.rb
|
195
194
|
- lib/foreman_salt.rb
|
@@ -200,6 +199,10 @@ files:
|
|
200
199
|
- lib/tasks/foreman_salt_tasks.rake
|
201
200
|
- locale/Makefile
|
202
201
|
- locale/action_names.rb
|
202
|
+
- locale/ca/LC_MESSAGES/foreman_salt.mo
|
203
|
+
- locale/ca/foreman_salt.po
|
204
|
+
- locale/cs_CZ/LC_MESSAGES/foreman_salt.mo
|
205
|
+
- locale/cs_CZ/foreman_salt.po
|
203
206
|
- locale/de/LC_MESSAGES/foreman_salt.mo
|
204
207
|
- locale/de/foreman_salt.edit.po
|
205
208
|
- locale/de/foreman_salt.po
|
@@ -208,7 +211,35 @@ files:
|
|
208
211
|
- locale/en/foreman_salt.edit.po
|
209
212
|
- locale/en/foreman_salt.po
|
210
213
|
- locale/en/foreman_salt.po.time_stamp
|
214
|
+
- locale/en_GB/LC_MESSAGES/foreman_salt.mo
|
215
|
+
- locale/en_GB/foreman_salt.po
|
216
|
+
- locale/es/LC_MESSAGES/foreman_salt.mo
|
217
|
+
- locale/es/foreman_salt.po
|
211
218
|
- locale/foreman_salt.pot
|
219
|
+
- locale/fr/LC_MESSAGES/foreman_salt.mo
|
220
|
+
- locale/fr/foreman_salt.po
|
221
|
+
- locale/gl/LC_MESSAGES/foreman_salt.mo
|
222
|
+
- locale/gl/foreman_salt.po
|
223
|
+
- locale/it/LC_MESSAGES/foreman_salt.mo
|
224
|
+
- locale/it/foreman_salt.po
|
225
|
+
- locale/ja/LC_MESSAGES/foreman_salt.mo
|
226
|
+
- locale/ja/foreman_salt.po
|
227
|
+
- locale/ko/LC_MESSAGES/foreman_salt.mo
|
228
|
+
- locale/ko/foreman_salt.po
|
229
|
+
- locale/nl_NL/LC_MESSAGES/foreman_salt.mo
|
230
|
+
- locale/nl_NL/foreman_salt.po
|
231
|
+
- locale/pl/LC_MESSAGES/foreman_salt.mo
|
232
|
+
- locale/pl/foreman_salt.po
|
233
|
+
- locale/pt_BR/LC_MESSAGES/foreman_salt.mo
|
234
|
+
- locale/pt_BR/foreman_salt.po
|
235
|
+
- locale/ru/LC_MESSAGES/foreman_salt.mo
|
236
|
+
- locale/ru/foreman_salt.po
|
237
|
+
- locale/sv_SE/LC_MESSAGES/foreman_salt.mo
|
238
|
+
- locale/sv_SE/foreman_salt.po
|
239
|
+
- locale/zh_CN/LC_MESSAGES/foreman_salt.mo
|
240
|
+
- locale/zh_CN/foreman_salt.po
|
241
|
+
- locale/zh_TW/LC_MESSAGES/foreman_salt.mo
|
242
|
+
- locale/zh_TW/foreman_salt.po
|
212
243
|
- test/factories/foreman_salt_factories.rb
|
213
244
|
- test/functional/api/v2/salt_autosign_controller_test.rb
|
214
245
|
- test/functional/api/v2/salt_environments_controller_test.rb
|
@@ -226,15 +257,12 @@ files:
|
|
226
257
|
- test/integration/salt_module_test.rb
|
227
258
|
- test/integration/salt_variable_test.rb
|
228
259
|
- test/test_plugin_helper.rb
|
229
|
-
- test/unit/grains_centos.json
|
230
260
|
- test/unit/grains_importer_test.rb
|
231
261
|
- test/unit/highstate.json
|
232
262
|
- test/unit/highstate_pchanges.json
|
233
263
|
- test/unit/host_extensions_test.rb
|
234
264
|
- test/unit/hostgroup_extensions_test.rb
|
235
265
|
- test/unit/report_importer_test.rb
|
236
|
-
- test/unit/salt_fact_importer_test.rb
|
237
|
-
- test/unit/salt_fact_parser_test.rb
|
238
266
|
- test/unit/salt_keys_test.rb
|
239
267
|
- test/unit/salt_modules_test.rb
|
240
268
|
- test/unit/salt_variables_test.rb
|
@@ -274,10 +302,7 @@ test_files:
|
|
274
302
|
- test/unit/highstate_pchanges.json
|
275
303
|
- test/unit/hostgroup_extensions_test.rb
|
276
304
|
- test/unit/highstate.json
|
277
|
-
- test/unit/salt_fact_parser_test.rb
|
278
305
|
- test/unit/salt_modules_test.rb
|
279
|
-
- test/unit/grains_centos.json
|
280
|
-
- test/unit/salt_fact_importer_test.rb
|
281
306
|
- test/unit/report_importer_test.rb
|
282
307
|
- test/unit/salt_variables_test.rb
|
283
308
|
- test/unit/salt_keys_test.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module ForemanSalt
|
2
|
-
# Define the class that fact names that come from Salt should have
|
3
|
-
# It allows us to filter facts by origin, and also to display the origin
|
4
|
-
# in the fact values table (/fact_values)
|
5
|
-
class FactName < ::FactName
|
6
|
-
def origin
|
7
|
-
'Salt'
|
8
|
-
end
|
9
|
-
|
10
|
-
def icon_path
|
11
|
-
'foreman_salt/Salt'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
module ForemanSalt
|
2
|
-
class FactParser < ::FactParser
|
3
|
-
attr_reader :facts
|
4
|
-
|
5
|
-
def operatingsystem
|
6
|
-
os = Operatingsystem.where(os_hash).first_or_initialize
|
7
|
-
if os.new_record?
|
8
|
-
os.deduce_family
|
9
|
-
os.release_name = facts[:lsb_distrib_codename]
|
10
|
-
os.save
|
11
|
-
end
|
12
|
-
os if os.persisted?
|
13
|
-
end
|
14
|
-
|
15
|
-
def architecture
|
16
|
-
name = facts[:osarch]
|
17
|
-
name = 'x86_64' if name == 'amd64'
|
18
|
-
Architecture.where(:name => name).first_or_create unless name.blank?
|
19
|
-
end
|
20
|
-
|
21
|
-
def environment
|
22
|
-
# Don't touch the Puppet environment field
|
23
|
-
end
|
24
|
-
|
25
|
-
def model
|
26
|
-
name = facts[:productname]
|
27
|
-
Model.where(:name => name.strip).first_or_create unless name.blank?
|
28
|
-
end
|
29
|
-
|
30
|
-
def domain
|
31
|
-
name = facts[:domain]
|
32
|
-
Domain.where(:name => name).first_or_create unless name.blank?
|
33
|
-
end
|
34
|
-
|
35
|
-
def ip
|
36
|
-
ip = facts.find { |fact, value| fact =~ /^fqdn_ip4/ && value && value != '127.0.0.1' }
|
37
|
-
ip[1] if ip
|
38
|
-
end
|
39
|
-
|
40
|
-
def primary_interface
|
41
|
-
interface = interfaces.find { |_, value| value[:ipaddress] == ip }
|
42
|
-
interface[0] if interface
|
43
|
-
end
|
44
|
-
|
45
|
-
def mac
|
46
|
-
interface = interfaces.find { |_, value| value[:ipaddress] == ip }
|
47
|
-
interface[1][:macaddress] if interface
|
48
|
-
end
|
49
|
-
|
50
|
-
def ipmi_interface
|
51
|
-
nil
|
52
|
-
end
|
53
|
-
|
54
|
-
def interfaces
|
55
|
-
interfaces = {}
|
56
|
-
|
57
|
-
facts.each do |fact, value|
|
58
|
-
next unless value && fact.to_s =~ /^ip_interfaces/
|
59
|
-
|
60
|
-
(_, interface_name) = fact.split(FactName::SEPARATOR)
|
61
|
-
|
62
|
-
next if (IPAddr.new('fe80::/10').include?(value) rescue false)
|
63
|
-
|
64
|
-
if !interface_name.blank? && interface_name != 'lo'
|
65
|
-
interface = interfaces.fetch(interface_name, {})
|
66
|
-
interface[:macaddress] = macs[interface_name]
|
67
|
-
if Net::Validations.validate_ip6(value)
|
68
|
-
interface[:ipaddress6] = value unless interface.include?(:ipaddress6)
|
69
|
-
else
|
70
|
-
interface[:ipaddress] = value unless interface.include?(:ipaddress)
|
71
|
-
end
|
72
|
-
interfaces[interface_name] = interface
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
interfaces.each do |name, interface|
|
77
|
-
set_additional_attributes(interface, name)
|
78
|
-
end
|
79
|
-
|
80
|
-
interfaces
|
81
|
-
end
|
82
|
-
|
83
|
-
def support_interfaces_parsing?
|
84
|
-
true
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def os_hash
|
90
|
-
name = facts[:os]
|
91
|
-
(_, major, minor, sub) = /(\d+)\.?(\d+)?\.?(\d+)?/.match(facts[:osrelease]).to_a
|
92
|
-
if name == 'CentOS'
|
93
|
-
if sub
|
94
|
-
minor += '.' + sub
|
95
|
-
end
|
96
|
-
end
|
97
|
-
{ :name => name, :major => major, :minor => minor }
|
98
|
-
end
|
99
|
-
|
100
|
-
def macs
|
101
|
-
unless @macs
|
102
|
-
@macs = {}
|
103
|
-
facts.each do |fact, value|
|
104
|
-
next unless value && fact.to_s =~ /^hwaddr_interfaces/
|
105
|
-
|
106
|
-
data = fact.split(FactName::SEPARATOR)
|
107
|
-
interface = data[1]
|
108
|
-
macs[interface] = value
|
109
|
-
end
|
110
|
-
end
|
111
|
-
@macs
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"facts": {
|
3
|
-
"kernelrelease": "2.6.32-431.23.3.el6.x86_64",
|
4
|
-
"ipv6::0": "::1",
|
5
|
-
"ipv6::1": "fe80::5054:ff:fe35:302a",
|
6
|
-
"saltversioninfo": [
|
7
|
-
2014,
|
8
|
-
1,
|
9
|
-
7
|
10
|
-
],
|
11
|
-
"operatingsystem": "CentOS",
|
12
|
-
"lsb_distrib_id": "CentOS",
|
13
|
-
"pythonversion::2": 6,
|
14
|
-
"pythonversion::3": "final",
|
15
|
-
"pythonversion::0": 2,
|
16
|
-
"pythonversion::1": 6,
|
17
|
-
"cpu_model": "QEMU Virtual CPU version (cpu64-rhel6)",
|
18
|
-
"pythonversion::4": 0,
|
19
|
-
"oscodename": "Final",
|
20
|
-
"num_gpus": 1,
|
21
|
-
"productname": "KVM",
|
22
|
-
"osarch": "x86_64",
|
23
|
-
"biosversion": "0.5.1",
|
24
|
-
"kernel": "Linux",
|
25
|
-
"domain": "example.com",
|
26
|
-
"pythonpath::4": "/usr/lib64/python2.6/lib-tk",
|
27
|
-
"pythonpath::5": "/usr/lib64/python2.6/lib-old",
|
28
|
-
"pythonpath::6": "/usr/lib64/python2.6/lib-dynload",
|
29
|
-
"pythonpath::7": "/usr/lib64/python2.6/site-packages",
|
30
|
-
"pythonpath::0": "/usr/bin",
|
31
|
-
"mem_total": 742,
|
32
|
-
"pythonpath::2": "/usr/lib64/python2.6",
|
33
|
-
"pythonpath::3": "/usr/lib64/python2.6/plat-linux2",
|
34
|
-
"pythonpath::8": "/usr/lib/python2.6/site-packages",
|
35
|
-
"cpu_flags::25": "pni",
|
36
|
-
"cpu_flags::24": "unfair_spinlock",
|
37
|
-
"cpu_flags::27": "hypervisor",
|
38
|
-
"cpu_flags::26": "cx16",
|
39
|
-
"cpu_flags::21": "nx",
|
40
|
-
"cpu_flags::20": "syscall",
|
41
|
-
"cpu_flags::23": "up",
|
42
|
-
"cpu_flags::22": "lm",
|
43
|
-
"cpu_flags::28": "lahf_lm",
|
44
|
-
"defaultlanguage": "en_US",
|
45
|
-
"osfullname": "CentOS",
|
46
|
-
"localhost": "saltclient01.example.com",
|
47
|
-
"lsb_distrib_release": "6.5",
|
48
|
-
"saltpath": "/usr/lib/python2.6/site-packages/salt",
|
49
|
-
"biosreleasedate": "01/01/2007",
|
50
|
-
"host": "saltclient01",
|
51
|
-
"defaultencoding": "UTF8",
|
52
|
-
"path": "/sbin:/usr/sbin:/bin:/usr/bin",
|
53
|
-
"ip_interfaces::eth0::0": "10.7.13.141",
|
54
|
-
"ip_interfaces::eth0::1": "10.7.23.141",
|
55
|
-
"manufacturer": "Red Hat",
|
56
|
-
"fqdn": "saltclient01.example.com",
|
57
|
-
"os": "CentOS",
|
58
|
-
"osfinger": "CentOS-6",
|
59
|
-
"ps": "ps -efH",
|
60
|
-
"server_id": 654860635,
|
61
|
-
"zmqversion": "3.2.4",
|
62
|
-
"osmajorrelease::1": "5",
|
63
|
-
"osmajorrelease::0": "6",
|
64
|
-
"ip_interfaces::lo::0": "127.0.0.1",
|
65
|
-
"master": "saltstack.example.com",
|
66
|
-
"shell": "/bin/sh",
|
67
|
-
"saltversion": "2014.1.7",
|
68
|
-
"hwaddr_interfaces::lo": "00:00:00:00:00:00",
|
69
|
-
"_timestamp": "2014-08-28 10:02:16 ",
|
70
|
-
"cpu_flags::18": "sse",
|
71
|
-
"cpu_flags::19": "sse2",
|
72
|
-
"cpu_flags::14": "pse36",
|
73
|
-
"cpu_flags::15": "clflush",
|
74
|
-
"cpu_flags::16": "mmx",
|
75
|
-
"cpu_flags::17": "fxsr",
|
76
|
-
"cpu_flags::10": "mtrr",
|
77
|
-
"cpu_flags::11": "pge",
|
78
|
-
"cpu_flags::12": "mca",
|
79
|
-
"cpu_flags::13": "cmov",
|
80
|
-
"cpuarch": "x86_64",
|
81
|
-
"pythonpath::1": "/usr/lib64/python26.zip",
|
82
|
-
"cpu_flags::6": "mce",
|
83
|
-
"cpu_flags::7": "cx8",
|
84
|
-
"cpu_flags::4": "msr",
|
85
|
-
"cpu_flags::5": "pae",
|
86
|
-
"cpu_flags::2": "pse",
|
87
|
-
"cpu_flags::3": "tsc",
|
88
|
-
"cpu_flags::0": "fpu",
|
89
|
-
"cpu_flags::1": "de",
|
90
|
-
"serialnumber": "Not Specified",
|
91
|
-
"hwaddr_interfaces::eth0": "52:54:00:35:30:2a",
|
92
|
-
"cpu_flags::8": "apic",
|
93
|
-
"cpu_flags::9": "sep",
|
94
|
-
"gpus::0::model": "GD 5446",
|
95
|
-
"id": "saltclient01.example.com",
|
96
|
-
"osrelease": "6.5",
|
97
|
-
"num_cpus": 1,
|
98
|
-
"virtual": "kvm",
|
99
|
-
"ipv4::0": "10.7.23.141",
|
100
|
-
"ipv4::1": "10.7.13.141",
|
101
|
-
"ipv4::2": "127.0.0.1",
|
102
|
-
"_type": "foreman_salt",
|
103
|
-
"nodename": "saltclient01.example.com",
|
104
|
-
"os_family": "RedHat",
|
105
|
-
"operatingsystemrelease": "6.5",
|
106
|
-
"gpus::0::vendor": "unknown",
|
107
|
-
"lsb_distrib_codename": "Final",
|
108
|
-
"fqdn_ip4::0": "10.7.13.141",
|
109
|
-
"ip_interfaces::eth1::0": "1.2.3.4",
|
110
|
-
"hwaddr_interfaces::eth1": "DE:AD:BE:EF:07:13"
|
111
|
-
},
|
112
|
-
"name": "saltclient01.example.com"
|
113
|
-
}
|