chef_handler_foreman 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef_handler_foreman/foreman_facts.rb +17 -2
- data/lib/chef_handler_foreman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8566c67617365e32478774ba28f9976c60e58c2a
|
4
|
+
data.tar.gz: 484383d6d43b288f70a4a828be1c70087b9fd0c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae50498ca22ce64b183b49b38abc057b3d332f94ffddf9e7377139101982ea944090757d20849ef1f3f0df6b6c2cfe4295f6f2c401393e9b417b50d570828cc
|
7
|
+
data.tar.gz: f50315cbf3d08035bd9d11d877a7a75e98e61887bb6614684e0b0b232018de296dd422a51fe3260feadc68c69492d36c4dcfd0a8806f66c09c997d64ec285de9
|
@@ -24,16 +24,31 @@ module ChefHandlerForeman
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def prepare_facts
|
27
|
+
os = node.lsb[:id] || node.platform
|
28
|
+
release = node.lsb[:release] || node.platform_version
|
29
|
+
|
27
30
|
{ :name => node.name,
|
28
31
|
:facts => plain_attributes.merge({
|
29
|
-
:operatingsystem =>
|
30
|
-
:operatingsystemrelease =>
|
32
|
+
:operatingsystem => normalize(os),
|
33
|
+
:operatingsystemrelease => release,
|
31
34
|
:_timestamp => Time.now,
|
32
35
|
:_type => 'foreman_chef'
|
33
36
|
})
|
34
37
|
}
|
35
38
|
end
|
36
39
|
|
40
|
+
# if node.lsb[:id] fails and we use platform instead, normalize os names
|
41
|
+
def normalize(os)
|
42
|
+
case os
|
43
|
+
when 'redhat'
|
44
|
+
'RedHat'
|
45
|
+
when 'centos'
|
46
|
+
'CentOS'
|
47
|
+
else
|
48
|
+
os.capitalize
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
37
52
|
def plain_attributes
|
38
53
|
# chef 10 attributes can be access by to_hash directly, chef 11 uses attributes method
|
39
54
|
attributes = node.respond_to?(:attributes) ? node.attributes : node.to_hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef_handler_foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|