Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-cloud / recipes-support / facter / files / 0002-personality.patch
1 ---
2  lib/facter/personality.rb |   21 ++++++++++++++++++
3  lib/facter/subfunction.rb |   61 ++++++++++++++++++++++++++++++++++++++++++++++
4  2 files changed, 82 insertions(+)
5
6 --- /dev/null
7 +++ b/lib/facter/personality.rb
8 @@ -0,0 +1,21 @@
9 +#
10 +# personality.rb
11 +#
12 +# This fact gives the personality of this node.
13 +#
14 +require 'facter/util/file_read'
15 +
16 +Facter.add('personality') do
17 +  confine :kernel => :linux
18 +
19 +  setcode do
20 +    if release = Facter::Util::FileRead.read('/etc/platform/platform.conf')
21 +      if match = release.match(/^nodetype\=(.*)/)
22 +        match[1]
23 +      end
24 +    end
25 +  end
26 +end
27 +
28 +# vim: set ts=2 sw=2 et :
29 +# encoding: utf-8
30 --- /dev/null
31 +++ b/lib/facter/subfunction.rb
32 @@ -0,0 +1,61 @@
33 +#
34 +# subfunction.rb
35 +#
36 +# This fact gives the subfunction of this node.
37 +#
38 +require 'facter/util/file_read'
39 +
40 +Facter.add('subfunction') do
41 +  confine :kernel => :linux
42 +
43 +  setcode do
44 +    if release = Facter::Util::FileRead.read('/etc/platform/platform.conf')
45 +      if match = release.match(/^subfunction\=(.*)/)
46 +        match[1]
47 +      end
48 +    end
49 +  end
50 +end
51 +
52 +Facter.add('is_worker_subfunction') do
53 +  confine :kernel => :linux
54 +
55 +  setcode do
56 +    if release = Facter::Util::FileRead.read('/etc/platform/platform.conf')
57 +      match = release.match(/^subfunction\=.*worker/) ? true : false
58 +    end
59 +  end
60 +end
61 +
62 +Facter.add('is_controller_subfunction') do
63 +  confine :kernel => :linux
64 +
65 +  setcode do
66 +    if release = Facter::Util::FileRead.read('/etc/platform/platform.conf')
67 +      match = release.match(/^subfunction\=.*controller/) ? true : false
68 +    end
69 +  end
70 +end
71 +
72 +Facter.add('is_storage_subfunction') do
73 +  confine :kernel => :linux
74 +
75 +  setcode do
76 +    if release = Facter::Util::FileRead.read('/etc/platform/platform.conf')
77 +      match = release.match(/^subfunction\=.*storage/) ? true : false
78 +    end
79 +  end
80 +end
81 +
82 +Facter.add('is_lowlatency_subfunction') do
83 +  confine :kernel => :linux
84 +
85 +  setcode do
86 +    if release = Facter::Util::FileRead.read('/etc/platform/platform.conf')
87 +      match = release.match(/^subfunction\=.*lowlatency/) ? true : false
88 +    end
89 +  end
90 +end
91 +
92 +# vim: set ts=2 sw=2 et :
93 +# encoding: utf-8