ohai 14.5.4 → 14.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ohai/application.rb +19 -0
  3. data/lib/ohai/exception.rb +1 -0
  4. data/lib/ohai/hints.rb +5 -0
  5. data/lib/ohai/log.rb +2 -0
  6. data/lib/ohai/plugins/cpu.rb +416 -0
  7. data/lib/ohai/plugins/darwin/hardware.rb +1 -7
  8. data/lib/ohai/plugins/darwin/system_profiler.rb +19 -19
  9. data/lib/ohai/plugins/filesystem.rb +326 -115
  10. data/lib/ohai/plugins/linux/platform.rb +1 -1
  11. data/lib/ohai/plugins/os.rb +16 -0
  12. data/lib/ohai/system.rb +12 -2
  13. data/lib/ohai/version.rb +1 -1
  14. data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
  15. data/spec/unit/plugins/aix/filesystem_spec.rb +23 -1
  16. data/spec/unit/plugins/darwin/cpu_spec.rb +3 -3
  17. data/spec/unit/plugins/freebsd/cpu_spec.rb +2 -2
  18. data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
  19. data/spec/unit/plugins/linux/platform_spec.rb +2 -1
  20. data/spec/unit/plugins/os_spec.rb +33 -0
  21. data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
  22. data/spec/unit/plugins/solaris2/filesystem.rb +355 -32
  23. data/spec/unit/plugins/windows/cpu_spec.rb +1 -1
  24. metadata +3 -18
  25. data/lib/ohai/plugins/aix/cpu.rb +0 -64
  26. data/lib/ohai/plugins/aix/filesystem.rb +0 -90
  27. data/lib/ohai/plugins/aix/os.rb +0 -30
  28. data/lib/ohai/plugins/darwin/cpu.rb +0 -50
  29. data/lib/ohai/plugins/dragonflybsd/cpu.rb +0 -58
  30. data/lib/ohai/plugins/dragonflybsd/os.rb +0 -31
  31. data/lib/ohai/plugins/freebsd/cpu.rb +0 -70
  32. data/lib/ohai/plugins/freebsd/os.rb +0 -32
  33. data/lib/ohai/plugins/linux/cpu.rb +0 -120
  34. data/lib/ohai/plugins/netbsd/cpu.rb +0 -50
  35. data/lib/ohai/plugins/openbsd/cpu.rb +0 -43
  36. data/lib/ohai/plugins/solaris2/cpu.rb +0 -70
  37. data/lib/ohai/plugins/solaris2/filesystem.rb +0 -106
  38. data/lib/ohai/plugins/windows/cpu.rb +0 -59
  39. data/spec/unit/plugins/aix/os_spec.rb +0 -35
  40. data/spec/unit/plugins/freebsd/os_spec.rb +0 -32
@@ -1,70 +0,0 @@
1
- #
2
- # Author:: Bryan McLellan (btm@loftninjas.org)
3
- # Author:: Tim Smith (tsmith@chef.io)
4
- # Copyright:: Copyright (c) 2008 Bryan McLellan
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- Ohai.plugin(:CPU) do
21
- provides "cpu"
22
-
23
- collect_data(:freebsd) do
24
- # all dmesg output for smp I can find only provides info about a single processor
25
- # identical processors is probably a hardware requirement so we'll duplicate data for each cpu
26
- # old examples: http://www.bnv-bamberg.de/home/ba3294/smp/rbuild/index.htm
27
- cpuinfo = Mash.new
28
- cpuinfo["flags"] = []
29
-
30
- # /var/run/dmesg.boot
31
- # CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (2793.59-MHz K8-class CPU)
32
- # Origin="GenuineIntel" Id=0x40661 Family=0x6 Model=0x46 Stepping=1
33
- # Features=0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
34
- # Features2=0x5ed8220b<SSE3,PCLMULQDQ,MON,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>
35
- # AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
36
- # AMD Features2=0x21<LAHF,ABM>
37
- # Structured Extended Features=0x2000<NFPUSG>
38
- # TSC: P-state invariant
39
- # ...
40
- # FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs
41
- # FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads
42
-
43
- File.open("/var/run/dmesg.boot").each do |line|
44
- case line
45
- when /CPU:\s+(.+) \(([\d.]+).+\)/
46
- cpuinfo["model_name"] = $1
47
- cpuinfo["mhz"] = $2
48
- when /Origin.*"(.*)".*Family.*0x(\S+).*Model.*0x(\S+).*Stepping.*(\S+)/
49
- cpuinfo["vendor_id"] = $1
50
- # convert from hex value to int, but keep a string to match Linux ohai
51
- cpuinfo["family"] = $2.to_i(16).to_s
52
- cpuinfo["model"] = $3.to_i(16).to_s
53
- cpuinfo["stepping"] = $4
54
- # These _should_ match /AMD Features2?/ lines as well
55
- when /Features=.+<(.+)>/
56
- cpuinfo["flags"].concat($1.downcase.split(","))
57
- # Features2=0x80000001<SSE3,<b31>>
58
- when /Features2=[a-f\dx]+<(.+)>/
59
- cpuinfo["flags"].concat($1.downcase.split(","))
60
- when /FreeBSD\/SMP: Multiprocessor System Detected: (\d*) CPUs/
61
- cpuinfo["total"] = $1.to_i
62
- when /FreeBSD\/SMP: (\d*) package\(s\) x (\d*) core\(s\)/
63
- cpuinfo["real"] = $1.to_i
64
- cpuinfo["cores"] = $1.to_i * $2.to_i
65
- end
66
- end
67
-
68
- cpu cpuinfo
69
- end
70
- end
@@ -1,32 +0,0 @@
1
- #
2
- # Authors:: Adam Jacob (<adam@chef.io>)
3
- # Richard Manyanza (<liseki@nyikacraftsmen.com>)
4
- # Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
5
- # Copyright:: Copyright (c) 2014 Richard Manyanza.
6
- # License:: Apache License, Version 2.0
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- Ohai.plugin(:OS) do
22
- provides "os", "os_version"
23
- require "ohai/mixin/os"
24
-
25
- collect_data(:freebsd) do
26
- os collect_os
27
-
28
- # This is __FreeBSD_version. See sys/param.h or
29
- # http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
30
- os_version shell_out("sysctl -n kern.osreldate").stdout.split($/)[0]
31
- end
32
- end
@@ -1,120 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@chef.io>)
3
- # Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- Ohai.plugin(:CPU) do
20
- provides "cpu"
21
-
22
- collect_data(:linux) do
23
- cpuinfo = Mash.new
24
- real_cpu = Mash.new
25
- cpu_number = 0
26
- current_cpu = nil
27
-
28
- File.open("/proc/cpuinfo").each do |line|
29
- case line
30
- when /processor\s+:\s(.+)/
31
- cpuinfo[$1] = Mash.new
32
- current_cpu = $1
33
- cpu_number += 1
34
- when /vendor_id\s+:\s(.+)/
35
- vendor_id = $1
36
- if vendor_id =~ (/IBM\/S390/)
37
- cpuinfo["vendor_id"] = vendor_id
38
- else
39
- cpuinfo[current_cpu]["vendor_id"] = vendor_id
40
- end
41
- when /cpu family\s+:\s(.+)/
42
- cpuinfo[current_cpu]["family"] = $1
43
- when /model\s+:\s(.+)/
44
- cpuinfo[current_cpu]["model"] = $1
45
- when /stepping\s+:\s(.+)/
46
- cpuinfo[current_cpu]["stepping"] = $1
47
- when /physical id\s+:\s(.+)/
48
- cpuinfo[current_cpu]["physical_id"] = $1
49
- real_cpu[$1] = true
50
- when /core id\s+:\s(.+)/
51
- cpuinfo[current_cpu]["core_id"] = $1
52
- when /cpu cores\s+:\s(.+)/
53
- cpuinfo[current_cpu]["cores"] = $1
54
- when /model name\s+:\s(.+)/
55
- cpuinfo[current_cpu]["model_name"] = $1
56
- when /cpu MHz\s+:\s(.+)/
57
- cpuinfo[current_cpu]["mhz"] = $1
58
- when /cache size\s+:\s(.+)/
59
- cpuinfo[current_cpu]["cache_size"] = $1
60
- when /flags\s+:\s(.+)/
61
- cpuinfo[current_cpu]["flags"] = $1.split(" ")
62
- when /BogoMIPS\s+:\s(.+)/
63
- cpuinfo[current_cpu]["bogomips"] = $1
64
- when /Features\s+:\s(.+)/
65
- cpuinfo[current_cpu]["features"] = $1.split(" ")
66
- when /bogomips per cpu:\s(.+)/
67
- cpuinfo["bogomips_per_cpu"] = $1
68
- when /features\s+:\s(.+)/
69
- cpuinfo["features"] = $1.split(" ")
70
- when /processor\s(\d):\s(.+)/
71
- current_cpu = $1
72
- cpu_number += 1
73
- cpuinfo[current_cpu] = Mash.new
74
- current_cpu_info = $2.split(",")
75
- current_cpu_info.each do |i|
76
- name_value = i.split("=")
77
- name = name_value[0].strip
78
- value = name_value[1].strip
79
- cpuinfo[current_cpu][name] = value
80
- end
81
- end
82
- end
83
-
84
- cpu cpuinfo
85
-
86
- cpu[:total] = cpu_number
87
-
88
- # use data we collected unless cpuinfo is lacking core information
89
- # which is the case on older linux distros
90
- if !real_cpu.empty? && cpu["0"]["cores"]
91
- cpu[:real] = real_cpu.keys.length
92
- cpu[:cores] = real_cpu.keys.length * cpu["0"]["cores"].to_i
93
- else
94
- begin
95
- logger.trace("Plugin CPU: Falling back to aggregate data from lscpu as real cpu & core data is missing in /proc/cpuinfo")
96
- so = shell_out("lscpu")
97
- if so.exitstatus == 0
98
- lscpu_data = Mash.new
99
- so.stdout.each_line do |line|
100
- case line
101
- when /^Thread\(s\) per core:\s(.+)/ # http://rubular.com/r/lOw2pRrw1q
102
- lscpu_data[:threads] = $1.to_i
103
- when /^Core\(s\) per socket:\s(.+)/ # http://rubular.com/r/lOw2pRrw1q
104
- lscpu_data[:cores] = $1.to_i
105
- when /^Socket\(s\):\s(.+)/ # http://rubular.com/r/DIzmPtJFvK
106
- lscpu_data[:sockets] = $1.to_i
107
- end
108
- end
109
- cpu[:total] = lscpu_data[:sockets] * lscpu_data[:cores] * lscpu_data[:threads]
110
- cpu[:real] = lscpu_data[:sockets]
111
- cpu[:cores] = lscpu_data[:sockets] * lscpu_data[:cores]
112
- else
113
- logger.trace("Plugin CPU: Error executing lscpu. CPU data may not be available.")
114
- end
115
- rescue Ohai::Exceptions::Exec # util-linux isn't installed most likely
116
- logger.trace("Plugin CPU: Error executing lscpu. util-linux may not be installed.")
117
- end
118
- end
119
- end
120
- end
@@ -1,50 +0,0 @@
1
- #
2
- # Author:: Mathieu Sauve-Frankel <msf@kisoku.net>
3
- # Copyright:: Copyright (c) 2009 Mathieu Sauve-Frankel
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- Ohai.plugin(:CPU) do
20
- provides "cpu"
21
-
22
- collect_data(:netbsd) do
23
- cpuinfo = Mash.new
24
-
25
- # NetBSD provides some cpu information via sysctl, and a little via dmesg.boot
26
- # unlike OpenBSD and FreeBSD, NetBSD does not provide information about the
27
- # available instruction set
28
- # cpu0 at mainbus0 apid 0: Intel 686-class, 2134MHz, id 0x6f6
29
-
30
- File.open("/var/run/dmesg.boot").each do |line|
31
- case line
32
- when /cpu[\d\w\s]+:\s([\w\s\-]+),\s+(\w+),/
33
- cpuinfo[:model_name] = $1
34
- cpuinfo[:mhz] = $2.gsub(/mhz/i, "")
35
- end
36
- end
37
-
38
- flags = []
39
- so = shell_out("dmidecode")
40
- so.stdout.lines do |line|
41
- if line =~ /^\s+([A-Z\d-]+)\s+\([\w\s-]+\)$/
42
- flags << $1.downcase
43
- end
44
- end
45
-
46
- cpuinfo[:flags] = flags unless flags.empty?
47
-
48
- cpu cpuinfo
49
- end
50
- end
@@ -1,43 +0,0 @@
1
- #
2
- # Author:: Mathieu Sauve-Frankel <msf@kisoku.net>
3
- # Copyright:: Copyright (c) 2009 Mathieu Sauve-Frankel
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- Ohai.plugin(:CPU) do
20
- provides "cpu"
21
-
22
- collect_data(:openbsd) do
23
- cpuinfo = Mash.new
24
-
25
- # OpenBSD provides most cpu information via sysctl, the only thing we need to
26
- # to scrape from dmesg.boot is the cpu feature list.
27
- # cpu0: FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,SBF,EST,TM2
28
-
29
- File.open("/var/run/dmesg.boot").each do |line|
30
- case line
31
- when /cpu\d+:\s+([A-Z]+$|[A-Z]+,.*$)/
32
- cpuinfo["flags"] = $1.downcase.split(",")
33
- end
34
- end
35
-
36
- [["hw.model", :model_name], ["hw.ncpu", :total], ["hw.cpuspeed", :mhz]].each do |param, node|
37
- so = shell_out("sysctl -n #{param}")
38
- cpuinfo[node] = so.stdout.split($/)[0]
39
- end
40
-
41
- cpu cpuinfo
42
- end
43
- end
@@ -1,70 +0,0 @@
1
- #
2
- # License:: Apache License, Version 2.0
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- Ohai.plugin(:CPU) do
18
- provides "cpu"
19
-
20
- collect_data(:solaris2) do
21
- cpu Mash.new
22
- # This does assume that /usr/bin/kstat is in the path
23
- processor_info = shell_out("kstat -p cpu_info").stdout.lines
24
- cpu["total"] = 0
25
- cpu["sockets"] = 0
26
- cpu["cores"] = 0
27
- cpu["corethreads"] = 0
28
- cpu["cpustates"] = Mash.new
29
-
30
- currentcpu = 0
31
- cpucores = Array.new
32
- cpusockets = Array.new
33
- processor_info.each do |processor|
34
- _desc, instance, _record, keyvalue = processor.split(":")
35
- cpu[instance] ||= Mash.new
36
- if currentcpu != instance
37
- cpu["total"] += 1
38
- currentcpu = instance
39
- end
40
- kv = keyvalue.split(/\s+/)
41
- key = kv.shift
42
- value = kv.join(" ").chomp
43
- case key
44
- when /chip_id/
45
- cpu[instance]["socket"] = value
46
- cpusockets.push(value) if cpusockets.index(value).nil?
47
- when /cpu_type/
48
- cpu[instance]["arch"] = value
49
- when /clock_MHz/
50
- cpu[instance]["mhz"] = value
51
- when /brand/
52
- cpu[instance]["model_name"] = value.sub(/\s+/, " ")
53
- when /^state$/
54
- cpu[instance]["state"] = value
55
- cpu["cpustates"][value] ||= 0
56
- cpu["cpustates"][value] += 1
57
- when /core_id/
58
- cpu[instance]["core_id"] = value
59
- # Detect hyperthreading/multithreading
60
- cpucores.push(value) if cpucores.index(value).nil?
61
- when /family|fpu_type|model|stepping|vendor_id/
62
- cpu[instance][key] = value
63
- end
64
- end
65
- cpu["cores"] = cpucores.size
66
- cpu["corethreads"] = (cpu["total"] / cpucores.size)
67
- cpu["sockets"] = cpusockets.size
68
- cpu["real"] = cpusockets.size
69
- end
70
- end
@@ -1,106 +0,0 @@
1
- #
2
- # Author:: Kurt Yoder (ktyopscode@yoderhome.com)
3
- # Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- Ohai.plugin(:Filesystem) do
20
- provides "filesystem"
21
-
22
- collect_data(:solaris2) do
23
- fs = Mash.new
24
-
25
- # Grab filesystem data from df
26
- so = shell_out("df -Pka")
27
- so.stdout.lines do |line|
28
- case line
29
- when /^Filesystem\s+kbytes/
30
- next
31
- when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
32
- filesystem = $1
33
- fs[filesystem] = Mash.new
34
- fs[filesystem][:kb_size] = $2
35
- fs[filesystem][:kb_used] = $3
36
- fs[filesystem][:kb_available] = $4
37
- fs[filesystem][:percent_used] = $5
38
- fs[filesystem][:mount] = $6
39
- end
40
- end
41
-
42
- # Grab file system type from df (must be done separately)
43
- so = shell_out("df -na")
44
- so.stdout.lines do |line|
45
- next unless line =~ /^(.+?)\s*: (\S+)\s*$/
46
- mount = $1
47
- fs.each do |filesystem, fs_attributes|
48
- next unless fs_attributes[:mount] == mount
49
- fs[filesystem][:fs_type] = $2
50
- end
51
- end
52
-
53
- # Grab mount information from /bin/mount
54
- so = shell_out("mount")
55
- so.stdout.lines do |line|
56
- next unless line =~ /^(.+?) on (.+?) (.+?) on (.+?)$/
57
- filesystem = $2
58
- fs[filesystem] = Mash.new unless fs.key?(filesystem)
59
- fs[filesystem][:mount] = $1
60
- fs[filesystem][:mount_time] = $4 # $4 must come before "split", else it becomes nil
61
- fs[filesystem][:mount_options] = $3.split("/")
62
- end
63
-
64
- # Grab any zfs data from "zfs get"
65
- zfs = Mash.new
66
- # ohai.plugin[:filesystem][:zfs_properties] = 'used'
67
- # ohai.plugin[:filesystem][:zfs_properties] = ['mountpoint', 'creation', 'available', 'used']
68
- zfs_get = "zfs get -p -H "
69
- if configuration(:zfs_properties).nil? || configuration(:zfs_properties).empty?
70
- zfs_get << "all"
71
- else
72
- zfs_get << [configuration(:zfs_properties)].join(",")
73
- end
74
- so = shell_out(zfs_get)
75
- so.stdout.lines do |line|
76
- next unless line =~ /^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)$/
77
- filesystem = $1
78
- zfs[filesystem] = Mash.new unless zfs.key?(filesystem)
79
- zfs[filesystem][:values] = Mash.new unless zfs[filesystem].key?("values")
80
- zfs[filesystem][:sources] = Mash.new unless zfs[filesystem].key?("sources")
81
- zfs[filesystem][:values][$2] = $3
82
- zfs[filesystem][:sources][$2] = $4.chomp
83
- end
84
-
85
- zfs.each do |filesystem, attributes|
86
- fs[filesystem] = Mash.new unless fs.key?(filesystem)
87
- fs[filesystem][:fs_type] = "zfs"
88
- fs[filesystem][:mount] = attributes[:values][:mountpoint] if attributes[:values].key?("mountpoint")
89
- fs[filesystem][:zfs_values] = attributes[:values]
90
- fs[filesystem][:zfs_sources] = attributes[:sources]
91
- # find all zfs parents
92
- parents = filesystem.split("/")
93
- zfs_parents = []
94
- (0..parents.length - 1).to_a.each do |parent_indexes|
95
- next_parent = parents[0..parent_indexes].join("/")
96
- zfs_parents.push(next_parent)
97
- end
98
- zfs_parents.pop
99
- fs[filesystem][:zfs_parents] = zfs_parents
100
- fs[filesystem][:zfs_zpool] = (zfs_parents.length == 0)
101
- end
102
-
103
- # Set the filesystem data
104
- filesystem fs
105
- end
106
- end