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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49c01dca38d7420f316e78ade7faa9e20fc9425b
4
- data.tar.gz: 8531d0ada4f9a736f388818a31f5f53d75769660
3
+ metadata.gz: 8566c67617365e32478774ba28f9976c60e58c2a
4
+ data.tar.gz: 484383d6d43b288f70a4a828be1c70087b9fd0c5
5
5
  SHA512:
6
- metadata.gz: a2ff1df5aaa5210bc607972e421079ee63e54bc7a48c93955be664760278bf73514fe7596e52dd2ebb1bc042e54daad17b4165d1b3efbea32a81676dd0d0fc54
7
- data.tar.gz: c7210bcc5041df77a33258892df8cb024dd00539dc0abb7780244f5d8a579fabec525a059b5823df491fd76ed8505b9d9d15ddf35e79a140ced49a5cedf3bbc7
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 => node.lsb[:id],
30
- :operatingsystemrelease => node.lsb.release,
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
@@ -1,3 +1,3 @@
1
1
  module ChefHandlerForeman
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.6
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-07 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler