ohai 8.10.0 → 8.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/Rakefile +13 -4
  4. data/bin/ohai +3 -4
  5. data/lib/ohai.rb +4 -4
  6. data/lib/ohai/application.rb +7 -6
  7. data/lib/ohai/common/dmi.rb +56 -56
  8. data/lib/ohai/config.rb +12 -8
  9. data/lib/ohai/dsl.rb +3 -3
  10. data/lib/ohai/dsl/plugin.rb +5 -5
  11. data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
  12. data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
  13. data/lib/ohai/hints.rb +1 -1
  14. data/lib/ohai/loader.rb +7 -7
  15. data/lib/ohai/log.rb +1 -1
  16. data/lib/ohai/mash.rb +3 -2
  17. data/lib/ohai/mixin/command.rb +25 -23
  18. data/lib/ohai/mixin/dmi_decode.rb +10 -10
  19. data/lib/ohai/mixin/ec2_metadata.rb +40 -39
  20. data/lib/ohai/mixin/gce_metadata.rb +9 -9
  21. data/lib/ohai/mixin/network_constants.rb +1 -1
  22. data/lib/ohai/mixin/os.rb +3 -3
  23. data/lib/ohai/mixin/seconds_to_human.rb +0 -2
  24. data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
  25. data/lib/ohai/mixin/string.rb +2 -2
  26. data/lib/ohai/plugin_config.rb +1 -1
  27. data/lib/ohai/plugins/aix/cpu.rb +2 -2
  28. data/lib/ohai/plugins/aix/filesystem.rb +2 -2
  29. data/lib/ohai/plugins/aix/memory.rb +2 -2
  30. data/lib/ohai/plugins/aix/network.rb +9 -10
  31. data/lib/ohai/plugins/aix/os.rb +2 -2
  32. data/lib/ohai/plugins/aix/uptime.rb +3 -3
  33. data/lib/ohai/plugins/aix/virtualization.rb +23 -23
  34. data/lib/ohai/plugins/azure.rb +32 -5
  35. data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
  36. data/lib/ohai/plugins/c.rb +3 -3
  37. data/lib/ohai/plugins/chef.rb +1 -1
  38. data/lib/ohai/plugins/cloud.rb +59 -60
  39. data/lib/ohai/plugins/cloud_v2.rb +37 -39
  40. data/lib/ohai/plugins/darwin/cpu.rb +1 -1
  41. data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
  42. data/lib/ohai/plugins/darwin/memory.rb +5 -6
  43. data/lib/ohai/plugins/darwin/network.rb +7 -7
  44. data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
  45. data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
  46. data/lib/ohai/plugins/digital_ocean.rb +16 -16
  47. data/lib/ohai/plugins/dmi.rb +6 -6
  48. data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
  49. data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
  50. data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
  51. data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
  52. data/lib/ohai/plugins/ec2.rb +39 -15
  53. data/lib/ohai/plugins/elixir.rb +1 -1
  54. data/lib/ohai/plugins/erlang.rb +3 -3
  55. data/lib/ohai/plugins/eucalyptus.rb +16 -12
  56. data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
  57. data/lib/ohai/plugins/freebsd/memory.rb +0 -1
  58. data/lib/ohai/plugins/freebsd/network.rb +4 -4
  59. data/lib/ohai/plugins/freebsd/os.rb +1 -1
  60. data/lib/ohai/plugins/gce.rb +6 -6
  61. data/lib/ohai/plugins/hostname.rb +7 -7
  62. data/lib/ohai/plugins/init_package.rb +1 -1
  63. data/lib/ohai/plugins/ip_scopes.rb +9 -9
  64. data/lib/ohai/plugins/java.rb +1 -1
  65. data/lib/ohai/plugins/joyent.rb +7 -7
  66. data/lib/ohai/plugins/kernel.rb +8 -8
  67. data/lib/ohai/plugins/linode.rb +7 -4
  68. data/lib/ohai/plugins/linux/cpu.rb +5 -5
  69. data/lib/ohai/plugins/linux/filesystem.rb +16 -16
  70. data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
  71. data/lib/ohai/plugins/linux/mdadm.rb +3 -3
  72. data/lib/ohai/plugins/linux/network.rb +85 -51
  73. data/lib/ohai/plugins/linux/platform.rb +24 -24
  74. data/lib/ohai/plugins/linux/virtualization.rb +8 -8
  75. data/lib/ohai/plugins/mono.rb +1 -1
  76. data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
  77. data/lib/ohai/plugins/netbsd/network.rb +2 -2
  78. data/lib/ohai/plugins/network.rb +11 -11
  79. data/lib/ohai/plugins/network_listeners.rb +30 -26
  80. data/lib/ohai/plugins/ohai.rb +3 -3
  81. data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
  82. data/lib/ohai/plugins/openbsd/memory.rb +4 -4
  83. data/lib/ohai/plugins/openbsd/network.rb +3 -3
  84. data/lib/ohai/plugins/openstack.rb +12 -12
  85. data/lib/ohai/plugins/os.rb +2 -2
  86. data/lib/ohai/plugins/packages.rb +22 -22
  87. data/lib/ohai/plugins/passwd.rb +4 -4
  88. data/lib/ohai/plugins/powershell.rb +9 -9
  89. data/lib/ohai/plugins/ps.rb +2 -2
  90. data/lib/ohai/plugins/python.rb +1 -1
  91. data/lib/ohai/plugins/rackspace.rb +13 -13
  92. data/lib/ohai/plugins/root_group.rb +4 -4
  93. data/lib/ohai/plugins/ruby.rb +6 -6
  94. data/lib/ohai/plugins/rust.rb +1 -1
  95. data/lib/ohai/plugins/sigar/cpu.rb +1 -1
  96. data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
  97. data/lib/ohai/plugins/sigar/network.rb +13 -13
  98. data/lib/ohai/plugins/sigar/network_route.rb +34 -29
  99. data/lib/ohai/plugins/softlayer.rb +8 -7
  100. data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
  101. data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
  102. data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
  103. data/lib/ohai/plugins/solaris2/memory.rb +2 -2
  104. data/lib/ohai/plugins/solaris2/network.rb +5 -5
  105. data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
  106. data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
  107. data/lib/ohai/plugins/ssh_host_key.rb +2 -2
  108. data/lib/ohai/plugins/uptime.rb +4 -5
  109. data/lib/ohai/plugins/virtualbox.rb +2 -2
  110. data/lib/ohai/plugins/virtualization.rb +17 -17
  111. data/lib/ohai/plugins/vmware.rb +2 -2
  112. data/lib/ohai/plugins/windows/cpu.rb +14 -14
  113. data/lib/ohai/plugins/windows/drivers.rb +8 -8
  114. data/lib/ohai/plugins/windows/filesystem.rb +4 -4
  115. data/lib/ohai/plugins/windows/memory.rb +1 -1
  116. data/lib/ohai/plugins/windows/network.rb +10 -10
  117. data/lib/ohai/plugins/windows/platform.rb +1 -2
  118. data/lib/ohai/plugins/windows/virtualization.rb +17 -17
  119. data/lib/ohai/provides_map.rb +7 -7
  120. data/lib/ohai/runner.rb +3 -3
  121. data/lib/ohai/system.rb +21 -20
  122. data/lib/ohai/util/file_helper.rb +1 -2
  123. data/lib/ohai/util/ip_helper.rb +4 -4
  124. data/lib/ohai/util/win32.rb +5 -5
  125. data/lib/ohai/util/win32/group_helper.rb +4 -5
  126. data/lib/ohai/version.rb +1 -1
  127. data/ohai.gemspec +7 -5
  128. data/spec/functional/application_spec.rb +23 -23
  129. data/spec/functional/loader_spec.rb +1 -1
  130. data/spec/functional/plugins/powershell_spec.rb +13 -13
  131. data/spec/functional/plugins/root_group_spec.rb +5 -5
  132. data/spec/ohai_spec.rb +1 -1
  133. data/spec/spec_helper.rb +9 -9
  134. data/spec/support/integration_helper.rb +7 -7
  135. data/spec/support/platform_helpers.rb +1 -1
  136. data/spec/unit/application_spec.rb +17 -17
  137. data/spec/unit/config_spec.rb +2 -2
  138. data/spec/unit/dsl/plugin_spec.rb +28 -28
  139. data/spec/unit/hints_spec.rb +3 -3
  140. data/spec/unit/loader_spec.rb +9 -9
  141. data/spec/unit/mixin/command_spec.rb +5 -5
  142. data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
  143. data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
  144. data/spec/unit/plugin_config_spec.rb +5 -5
  145. data/spec/unit/plugins/abort_spec.rb +3 -3
  146. data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
  147. data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
  148. data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
  149. data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
  150. data/spec/unit/plugins/aix/memory_spec.rb +8 -8
  151. data/spec/unit/plugins/aix/network_spec.rb +38 -38
  152. data/spec/unit/plugins/aix/os_spec.rb +1 -2
  153. data/spec/unit/plugins/aix/platform_spec.rb +1 -1
  154. data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
  155. data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
  156. data/spec/unit/plugins/azure_spec.rb +118 -20
  157. data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
  158. data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
  159. data/spec/unit/plugins/c_spec.rb +12 -12
  160. data/spec/unit/plugins/chef_spec.rb +2 -2
  161. data/spec/unit/plugins/cloud_spec.rb +37 -37
  162. data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
  163. data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
  164. data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
  165. data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
  166. data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
  167. data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
  168. data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
  169. data/spec/unit/plugins/darwin/network_spec.rb +352 -353
  170. data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
  171. data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
  172. data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
  173. data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
  174. data/spec/unit/plugins/dmi_spec.rb +3 -3
  175. data/spec/unit/plugins/ec2_spec.rb +97 -88
  176. data/spec/unit/plugins/elixir_spec.rb +1 -2
  177. data/spec/unit/plugins/erlang_spec.rb +2 -2
  178. data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
  179. data/spec/unit/plugins/fail_spec.rb +2 -2
  180. data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
  181. data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
  182. data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
  183. data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
  184. data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
  185. data/spec/unit/plugins/gce_spec.rb +9 -9
  186. data/spec/unit/plugins/go_spec.rb +1 -1
  187. data/spec/unit/plugins/groovy_spec.rb +1 -2
  188. data/spec/unit/plugins/hostname_spec.rb +1 -2
  189. data/spec/unit/plugins/init_package_spec.rb +1 -1
  190. data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
  191. data/spec/unit/plugins/java_spec.rb +52 -1
  192. data/spec/unit/plugins/joyent_spec.rb +9 -11
  193. data/spec/unit/plugins/kernel_spec.rb +11 -12
  194. data/spec/unit/plugins/linode_spec.rb +29 -29
  195. data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
  196. data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
  197. data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
  198. data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
  199. data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
  200. data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
  201. data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
  202. data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
  203. data/spec/unit/plugins/linux/memory_spec.rb +29 -33
  204. data/spec/unit/plugins/linux/network_spec.rb +463 -245
  205. data/spec/unit/plugins/linux/platform_spec.rb +64 -65
  206. data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
  207. data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
  208. data/spec/unit/plugins/lua_spec.rb +1 -2
  209. data/spec/unit/plugins/mono_spec.rb +1 -2
  210. data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
  211. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
  212. data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
  213. data/spec/unit/plugins/network_spec.rb +118 -118
  214. data/spec/unit/plugins/nodejs_spec.rb +1 -1
  215. data/spec/unit/plugins/ohai_spec.rb +1 -1
  216. data/spec/unit/plugins/ohai_time_spec.rb +1 -2
  217. data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
  218. data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
  219. data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
  220. data/spec/unit/plugins/openstack_spec.rb +35 -37
  221. data/spec/unit/plugins/os_spec.rb +7 -8
  222. data/spec/unit/plugins/packages_spec.rb +118 -118
  223. data/spec/unit/plugins/passwd_spec.rb +18 -18
  224. data/spec/unit/plugins/perl_spec.rb +1 -1
  225. data/spec/unit/plugins/php_spec.rb +4 -4
  226. data/spec/unit/plugins/platform_spec.rb +8 -9
  227. data/spec/unit/plugins/powershell_spec.rb +3 -3
  228. data/spec/unit/plugins/python_spec.rb +1 -1
  229. data/spec/unit/plugins/rackspace_spec.rb +66 -68
  230. data/spec/unit/plugins/root_group_spec.rb +26 -26
  231. data/spec/unit/plugins/ruby_spec.rb +14 -15
  232. data/spec/unit/plugins/rust_spec.rb +2 -2
  233. data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
  234. data/spec/unit/plugins/softlayer_spec.rb +10 -10
  235. data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
  236. data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
  237. data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
  238. data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
  239. data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
  240. data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
  241. data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
  242. data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
  243. data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
  244. data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
  245. data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
  246. data/spec/unit/plugins/virtualbox_spec.rb +19 -19
  247. data/spec/unit/plugins/vmware_spec.rb +28 -28
  248. data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
  249. data/spec/unit/plugins/windows/memory_spec.rb +5 -5
  250. data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
  251. data/spec/unit/provides_map_spec.rb +10 -10
  252. data/spec/unit/runner_spec.rb +10 -10
  253. data/spec/unit/system_spec.rb +19 -19
  254. data/spec/unit/util/file_helper_spec.rb +5 -6
  255. data/spec/unit/util/ip_helper_spec.rb +39 -39
  256. metadata +31 -4
@@ -18,8 +18,7 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
-
22
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
21
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
23
22
 
24
23
  describe Ohai::System, "plugin lua" do
25
24
 
@@ -16,8 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
-
20
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
19
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
21
20
 
22
21
  describe Ohai::System, "plugin mono" do
23
22
 
@@ -16,8 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
-
20
- require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
21
20
 
22
21
  describe Ohai::System, "NetBSD hostname plugin" do
23
22
  before(:each) do
@@ -16,8 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
-
20
- require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
21
20
 
22
21
  describe Ohai::System, "NetBSD kernel plugin" do
23
22
  before(:each) do
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
20
20
 
21
21
  describe Ohai::System, "NetBSD plugin platform" do
22
22
  before(:each) do
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
19
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
20
20
 
21
21
  def it_doesnt_fail
22
22
  it "doesnt fail" do
@@ -55,7 +55,7 @@ describe Ohai::System, "Network Plugin" do
55
55
  "vr0" => {
56
56
  "type" => "vr",
57
57
  "number" => "0",
58
- "flags" => ["UP", "BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"],
58
+ "flags" => %w{UP BROADCAST RUNNING SIMPLEX MULTICAST},
59
59
  "addresses" => {
60
60
  "00:00:24:c9:5e:b8" => {
61
61
  "family" => "lladdr"
@@ -64,23 +64,23 @@ describe Ohai::System, "Network Plugin" do
64
64
  "family" => "inet6",
65
65
  "zoneid" => "vr0",
66
66
  "prefixlen" => "64",
67
- "scopeid" => "0x1"
67
+ "scopeid" => "0x1",
68
68
  },
69
69
  "76.91.1.255" => {
70
70
  "family" => "inet",
71
71
  "netmask" => "255.255.252.0",
72
- "broadcast" => "255.255.255.255"
73
- }
72
+ "broadcast" => "255.255.255.255",
73
+ },
74
74
  },
75
75
  "arp" => {
76
76
  "76.91.1.255" => "00:00:24:c9:5e:b8",
77
- "76.91.0.1" => "00:01:5c:24:8c:01"
78
- }
77
+ "76.91.0.1" => "00:01:5c:24:8c:01",
78
+ },
79
79
  },
80
80
  "vr1" => {
81
81
  "type" => "vr",
82
82
  "number" => "1",
83
- "flags" => ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"],
83
+ "flags" => %w{UP BROADCAST RUNNING PROMISC SIMPLEX MULTICAST},
84
84
  "addresses" => {
85
85
  "00:00:24:c9:5e:b9" => {
86
86
  "family" => "lladdr"
@@ -89,14 +89,14 @@ describe Ohai::System, "Network Plugin" do
89
89
  "family" => "inet6",
90
90
  "zoneid" => "vr1",
91
91
  "prefixlen" => "64",
92
- "scopeid" => "0x2"
93
- }
94
- }
92
+ "scopeid" => "0x2",
93
+ },
94
+ },
95
95
  },
96
96
  "vr2" => {
97
97
  "type" => "vr",
98
98
  "number" => "2",
99
- "flags" => ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"],
99
+ "flags" => %w{UP BROADCAST RUNNING PROMISC SIMPLEX MULTICAST},
100
100
  "addresses" => {
101
101
  "00:00:24:c9:5e:ba" => {
102
102
  "family" => "lladdr"
@@ -105,14 +105,14 @@ describe Ohai::System, "Network Plugin" do
105
105
  "family" => "inet6",
106
106
  "zoneid" => "vr2",
107
107
  "prefixlen" => "64",
108
- "scopeid" => "0x3"
109
- }
110
- }
108
+ "scopeid" => "0x3",
109
+ },
110
+ },
111
111
  },
112
112
  "vr3" => {
113
113
  "type" => "vr",
114
114
  "number" => "3",
115
- "flags" => ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"],
115
+ "flags" => %w{UP BROADCAST RUNNING PROMISC SIMPLEX MULTICAST},
116
116
  "addresses" => {
117
117
  "00:00:24:c9:5e:bb" => {
118
118
  "family" => "lladdr"
@@ -121,60 +121,60 @@ describe Ohai::System, "Network Plugin" do
121
121
  "family" => "inet6",
122
122
  "zoneid" => "vr3",
123
123
  "prefixlen" => "64",
124
- "scopeid" => "0x4"
125
- }
126
- }
124
+ "scopeid" => "0x4",
125
+ },
126
+ },
127
127
  },
128
128
  "ipfw0" => {
129
129
  # OHAI-492: Ensure network plugin works with interfaces without addresses.
130
130
  "type" => "ipfw",
131
131
  "number" => "0",
132
- "flags" => ["UP", "SIMPLEX", "MULTICAST"]
132
+ "flags" => %w{UP SIMPLEX MULTICAST},
133
133
  },
134
134
  "lo0" => {
135
135
  "type" => "lo",
136
136
  "number" => "0",
137
- "flags" => ["UP", "LOOPBACK", "RUNNING", "MULTICAST"],
137
+ "flags" => %w{UP LOOPBACK RUNNING MULTICAST},
138
138
  "addresses" => {
139
139
  "127.0.0.1" => {
140
140
  "family" => "inet",
141
- "netmask" => "255.0.0.0"
141
+ "netmask" => "255.0.0.0",
142
142
  },
143
143
  "::1" => {
144
144
  "family" => "inet6",
145
- "prefixlen" => "128"
145
+ "prefixlen" => "128",
146
146
  },
147
147
  "fe80::1" => {
148
148
  "family" => "inet6",
149
149
  "zoneid" => "lo0",
150
150
  "prefixlen" => "64",
151
- "scopeid" => "0x8"
152
- }
153
- }
151
+ "scopeid" => "0x8",
152
+ },
153
+ },
154
154
  },
155
155
  "bridge0" => {
156
156
  "type" => "bridge",
157
157
  "number" => "0",
158
- "flags" => ["LEARNING", "DISCOVER", "AUTOEDGE", "AUTOPTP"],
158
+ "flags" => %w{LEARNING DISCOVER AUTOEDGE AUTOPTP},
159
159
  "addresses" => {
160
160
  "02:20:6f:d2:c4:00" => {
161
- "family"=>"lladdr"
161
+ "family" => "lladdr"
162
162
  },
163
163
  "192.168.2.1" => {
164
164
  "family" => "inet",
165
165
  "netmask" => "255.255.255.0",
166
- "broadcast" => "192.168.2.255"
166
+ "broadcast" => "192.168.2.255",
167
167
  },
168
168
  "2001:470:d:cb4::1" => {
169
169
  "family" => "inet6",
170
- "prefixlen" => "64"
170
+ "prefixlen" => "64",
171
171
  },
172
172
  "fe80::cafe:babe:dead:beef" => {
173
173
  "family" => "inet6",
174
174
  "zoneid" => "bridge0",
175
175
  "prefixlen" => "64",
176
- "scopeid" => "0x9"
177
- }
176
+ "scopeid" => "0x9",
177
+ },
178
178
  },
179
179
  "arp" => {
180
180
  "192.168.2.142" => "60:67:20:75:a2:0c",
@@ -184,27 +184,27 @@ describe Ohai::System, "Network Plugin" do
184
184
  "192.168.2.135" => "f8:0c:f3:d7:c6:b6",
185
185
  "192.168.2.165" => "f8:8f:ca:24:49:ad",
186
186
  "192.168.2.158" => "48:5d:60:1f:ea:d1",
187
- "192.168.2.150" => "60:a4:4c:60:b3:d9"
188
- }
187
+ "192.168.2.150" => "60:a4:4c:60:b3:d9",
188
+ },
189
189
  },
190
190
  "gif0" => {
191
191
  "type" => "gif",
192
192
  "number" => "0",
193
- "flags" => ["UP", "POINTOPOINT", "RUNNING", "MULTICAST"],
193
+ "flags" => %w{UP POINTOPOINT RUNNING MULTICAST},
194
194
  "addresses" => {
195
195
  "fe80::200:24ff:fec9:5eb8" => {
196
196
  "family" => "inet6",
197
197
  "zoneid" => "gif0",
198
198
  "prefixlen" => "64",
199
- "scopeid" => "0xa"
199
+ "scopeid" => "0xa",
200
200
  }
201
- }
202
- }
201
+ },
202
+ },
203
203
  },
204
204
  "default_gateway" => "76.91.0.1",
205
205
  "default_interface" => "vr0",
206
206
  "default_inet6_gateway" => "2001:470:d:cb4::2",
207
- "default_inet6_interface" => "bridge0"
207
+ "default_inet6_interface" => "bridge0",
208
208
  }
209
209
  },
210
210
  "linux" => {
@@ -213,32 +213,32 @@ describe Ohai::System, "Network Plugin" do
213
213
  # have just removed the neighbour and route entries by hand
214
214
  "interfaces" => {
215
215
  "lo" => {
216
- "flags" => ["LOOPBACK", "UP"],
216
+ "flags" => %w{LOOPBACK UP},
217
217
  "addresses" => {
218
218
  "::1" => {
219
219
  "scope" => "Node",
220
220
  "prefixlen" => "128",
221
- "family" => "inet6"
221
+ "family" => "inet6",
222
222
  },
223
223
  "127.0.0.1" => {
224
224
  "scope" => "Node",
225
225
  "netmask" => "255.0.0.0",
226
226
  "prefixlen" => "8",
227
- "family" => "inet"
228
- }
227
+ "family" => "inet",
228
+ },
229
229
  },
230
230
  "mtu" => "16436",
231
231
  "encapsulation" => "Loopback",
232
- "state" => "unknown"
232
+ "state" => "unknown",
233
233
  },
234
234
  "eth0" => {
235
- "flags" => ["BROADCAST", "MULTICAST", "UP"],
235
+ "flags" => %w{BROADCAST MULTICAST UP},
236
236
  "number" => "0",
237
237
  "addresses" => {
238
238
  "fe80::216:3eff:fe2f:3679" => {
239
239
  "scope" => "Link",
240
240
  "prefixlen" => "64",
241
- "family" => "inet6"
241
+ "family" => "inet6",
242
242
  },
243
243
  "00:16:3E:2F:36:79" => {
244
244
  "family" => "lladdr"
@@ -248,27 +248,27 @@ describe Ohai::System, "Network Plugin" do
248
248
  "netmask" => "255.255.255.0",
249
249
  "broadcast" => "192.168.66.255",
250
250
  "prefixlen" => "24",
251
- "family" => "inet"
251
+ "family" => "inet",
252
252
  },
253
253
  "3ffe:1111:2222::33" => {
254
254
  "prefixlen" => "48",
255
255
  "family" => "inet6",
256
256
  "scope" => "Global",
257
- "state" => "up"
258
- }
257
+ "state" => "up",
258
+ },
259
259
  },
260
260
  "mtu" => "1500",
261
261
  "type" => "eth",
262
- "encapsulation" => "Ethernet"
262
+ "encapsulation" => "Ethernet",
263
263
  },
264
264
  "eth1" => {
265
- "flags" => ["BROADCAST", "MULTICAST", "UP"],
265
+ "flags" => %w{BROADCAST MULTICAST UP},
266
266
  "number" => "1",
267
267
  "addresses" => {
268
268
  "fe80::216:3eff:fe2f:3680" => {
269
269
  "scope" => "Link",
270
270
  "prefixlen" => "64",
271
- "family" => "inet6"
271
+ "family" => "inet6",
272
272
  },
273
273
  "00:16:3E:2F:36:80" => {
274
274
  "family" => "lladdr"
@@ -278,23 +278,23 @@ describe Ohai::System, "Network Plugin" do
278
278
  "netmask" => "255.255.255.0",
279
279
  "broadcast" => "192.168.99.255",
280
280
  "prefixlen" => "24",
281
- "family" => "inet"
281
+ "family" => "inet",
282
282
  },
283
283
  "3ffe:1111:3333::1" => {
284
284
  "prefixlen" => "48",
285
285
  "family" => "inet6",
286
- "scope" => "Global"
287
- }
286
+ "scope" => "Global",
287
+ },
288
288
  },
289
289
  "mtu" => "1500",
290
290
  "type" => "eth",
291
- "encapsulation" => "Ethernet"
292
- }
291
+ "encapsulation" => "Ethernet",
292
+ },
293
293
  },
294
294
  "default_gateway" => "192.168.66.15",
295
295
  "default_interface" => "eth0",
296
296
  "default_inet6_gateway" => "3ffe:1111:2222::",
297
- "default_inet6_interface" => "eth0"
297
+ "default_inet6_interface" => "eth0",
298
298
  }
299
299
  },
300
300
  "windows" => {
@@ -306,26 +306,26 @@ describe Ohai::System, "Network Plugin" do
306
306
  "prefixlen" => "24",
307
307
  "netmask" => "255.255.255.0",
308
308
  "broadcast" => "172.19.0.255",
309
- "family" => "inet"
309
+ "family" => "inet",
310
310
  },
311
311
  "fe80::698d:3e37:7950:b28c" => {
312
312
  "prefixlen" => "64",
313
313
  "family" => "inet6",
314
- "scope" => "Link"
314
+ "scope" => "Link",
315
315
  },
316
316
  "52:54:44:66:66:02" => {
317
317
  "family" => "lladdr"
318
- }
318
+ },
319
319
  },
320
320
  "mtu" => nil,
321
321
  "type" => "Ethernet 802.3",
322
- "encapsulation" => "Ethernet"
322
+ "encapsulation" => "Ethernet",
323
323
  }
324
324
  },
325
325
  "default_gateway" => "172.19.0.1",
326
- "default_interface" => "0xb"
326
+ "default_interface" => "0xb",
327
327
  }
328
- }
328
+ },
329
329
  }
330
330
 
331
331
  describe "on linux" do
@@ -375,7 +375,7 @@ describe Ohai::System, "Network Plugin" do
375
375
 
376
376
  describe "ipv4 interface has no ARP" do
377
377
  before do
378
- @plugin["network"]["interfaces"]["eth0"]["addresses"].delete_if{|k,kv| kv["family"] == "lladdr" }
378
+ @plugin["network"]["interfaces"]["eth0"]["addresses"].delete_if { |k, kv| kv["family"] == "lladdr" }
379
379
  # not really checked by this pluging
380
380
  @plugin["network"]["interfaces"]["eth0"]["flags"] << "NOARP"
381
381
  @plugin["network"]["default_inet6_gateway"] = "3ffe:1111:3333::"
@@ -446,7 +446,7 @@ describe Ohai::System, "Network Plugin" do
446
446
 
447
447
  describe "no ip address for the given default interface/gateway" do
448
448
  before do
449
- @plugin["network"]["interfaces"]["eth0"]["addresses"].delete_if{|k,v| %w[inet inet6].include? v["family"]}
449
+ @plugin["network"]["interfaces"]["eth0"]["addresses"].delete_if { |k, v| %w{inet inet6}.include? v["family"] }
450
450
  end
451
451
 
452
452
  it_doesnt_fail
@@ -475,8 +475,8 @@ describe Ohai::System, "Network Plugin" do
475
475
  @plugin["network"]["default_interface"] = nil
476
476
  @plugin["network"]["default_inet6_gateway"] = nil
477
477
  @plugin["network"]["default_inet6_interface"] = nil
478
- @plugin["network"]["interfaces"].each do |i,iv|
479
- iv["addresses"].delete_if{|k,kv| %w[inet inet6].include? kv["family"]}
478
+ @plugin["network"]["interfaces"].each do |i, iv|
479
+ iv["addresses"].delete_if { |k, kv| %w{inet inet6}.include? kv["family"] }
480
480
  end
481
481
  end
482
482
 
@@ -503,28 +503,28 @@ describe Ohai::System, "Network Plugin" do
503
503
  describe "bigger prefix not set on the default interface" do
504
504
  before do
505
505
  @plugin["network"]["interfaces"]["eth2"] = {
506
- "flags" => ["BROADCAST", "MULTICAST", "UP"],
506
+ "flags" => %w{BROADCAST MULTICAST UP},
507
507
  "number" => "2",
508
508
  "addresses" => {
509
509
  "fe80::216:3eff:fe2f:3681" => {
510
510
  "scope" => "Link",
511
511
  "prefixlen" => "64",
512
- "family" => "inet6"
512
+ "family" => "inet6",
513
513
  },
514
- "00:16:3E:2F:36:81" => {"family" => "lladdr"},
514
+ "00:16:3E:2F:36:81" => { "family" => "lladdr" },
515
515
  "192.168.66.99" => {
516
516
  "scope" => "Global",
517
517
  "netmask" => "255.255.255.128",
518
518
  "broadcast" => "192.168.99.127",
519
519
  "prefixlen" => "25",
520
- "family" => "inet"
520
+ "family" => "inet",
521
521
  },
522
522
  "3ffe:1111:2222:0:4444::1" => {
523
523
  "prefixlen" => "64",
524
524
  "family" => "inet6",
525
- "scope" => "Global"
526
- }
527
- }
525
+ "scope" => "Global",
526
+ },
527
+ },
528
528
  }
529
529
  end
530
530
 
@@ -545,12 +545,12 @@ describe Ohai::System, "Network Plugin" do
545
545
  "netmask" => "255.255.255.128",
546
546
  "broadcast" => "192.168.66.127",
547
547
  "prefixlen" => "25",
548
- "family" => "inet"
548
+ "family" => "inet",
549
549
  }
550
550
  @plugin["network"]["interfaces"]["eth0"]["addresses"]["3ffe:1111:2222:0:4444::1"] = {
551
551
  "prefixlen" => "64",
552
552
  "family" => "inet6",
553
- "scope" => "Global"
553
+ "scope" => "Global",
554
554
  }
555
555
  end
556
556
 
@@ -567,28 +567,28 @@ describe Ohai::System, "Network Plugin" do
567
567
  describe "smallest ip not set on the default_interface" do
568
568
  before do
569
569
  @plugin["network"]["interfaces"]["eth2"] = {
570
- "flags" => ["BROADCAST", "MULTICAST", "UP"],
570
+ "flags" => %w{BROADCAST MULTICAST UP},
571
571
  "number" => "2",
572
572
  "addresses" => {
573
573
  "fe80::216:3eff:fe2f:3681" => {
574
574
  "scope" => "Link",
575
575
  "prefixlen" => "64",
576
- "family" => "inet6"
576
+ "family" => "inet6",
577
577
  },
578
- "00:16:3E:2F:36:81" => {"family" => "lladdr"},
578
+ "00:16:3E:2F:36:81" => { "family" => "lladdr" },
579
579
  "192.168.66.32" => {
580
580
  "scope" => "Global",
581
581
  "netmask" => "255.255.255.0",
582
582
  "broadcast" => "192.168.66.255",
583
583
  "prefixlen" => "24",
584
- "family" => "inet"
584
+ "family" => "inet",
585
585
  },
586
586
  "3ffe:1111:2222::32" => {
587
587
  "prefixlen" => "48",
588
588
  "family" => "inet6",
589
- "scope" => "Global"
590
- }
591
- }
589
+ "scope" => "Global",
590
+ },
591
+ },
592
592
  }
593
593
  end
594
594
 
@@ -609,12 +609,12 @@ describe Ohai::System, "Network Plugin" do
609
609
  "netmask" => "255.255.255.0",
610
610
  "broadcast" => "192.168.66.255",
611
611
  "prefixlen" => "24",
612
- "family" => "inet"
612
+ "family" => "inet",
613
613
  }
614
614
  @plugin["network"]["interfaces"]["eth0"]["addresses"]["3ffe:1111:2222::32"] = {
615
615
  "prefixlen" => "48",
616
616
  "family" => "inet6",
617
- "scope" => "Global"
617
+ "scope" => "Global",
618
618
  }
619
619
  end
620
620
 
@@ -637,7 +637,7 @@ describe Ohai::System, "Network Plugin" do
637
637
  @plugin["network"]["default_inet6_gateway"] = nil
638
638
  @plugin["network"]["default_inet6_interface"] = nil
639
639
  # removing inet* addresses from eth0, to complicate things a bit
640
- @plugin["network"]["interfaces"]["eth0"]["addresses"].delete_if{|k,v| %w[inet inet6].include? v["family"]}
640
+ @plugin["network"]["interfaces"]["eth0"]["addresses"].delete_if { |k, v| %w{inet inet6}.include? v["family"] }
641
641
  end
642
642
 
643
643
  it_populates_ipaddress_attributes
@@ -660,7 +660,7 @@ describe Ohai::System, "Network Plugin" do
660
660
  @plugin["network"]["default_inet6_gateway"] = nil
661
661
  @plugin["network"]["default_inet6_interface"] = nil
662
662
  # just changing scopes to lInK for eth0 addresses
663
- @plugin["network"]["interfaces"]["eth0"]["addresses"].each{|k,v| v[:scope]="lInK" if %w[inet inet6].include? v["family"]}
663
+ @plugin["network"]["interfaces"]["eth0"]["addresses"].each { |k, v| v[:scope] = "lInK" if %w{inet inet6}.include? v["family"] }
664
664
  end
665
665
 
666
666
  it_populates_ipaddress_attributes
@@ -719,7 +719,7 @@ describe Ohai::System, "Network Plugin" do
719
719
  "scope" => "host",
720
720
  "netmask" => "255.255.255.255",
721
721
  "prefixlen" => "32",
722
- "family" => "inet"
722
+ "family" => "inet",
723
723
  }
724
724
  end
725
725
 
@@ -737,29 +737,29 @@ describe Ohai::System, "Network Plugin" do
737
737
  describe "point to point address" do
738
738
  before do
739
739
  @plugin["network"]["interfaces"]["eth2"] = {
740
- "flags" => ["POINTOPOINT", "BROADCAST", "MULTICAST", "UP"],
740
+ "flags" => %w{POINTOPOINT BROADCAST MULTICAST UP},
741
741
  "number" => "2",
742
742
  "addresses" => {
743
743
  "fe80::216:3eff:fe2f:3681" => {
744
744
  "scope" => "Link",
745
745
  "prefixlen" => "64",
746
- "family" => "inet6"
746
+ "family" => "inet6",
747
747
  },
748
- "00:16:3E:2F:36:81" => {"family" => "lladdr"},
748
+ "00:16:3E:2F:36:81" => { "family" => "lladdr" },
749
749
  "192.168.66.99" => {
750
750
  "scope" => "Global",
751
751
  "netmask" => "255.255.255.255",
752
752
  "peer" => "192.168.99.126",
753
753
  "prefixlen" => "32",
754
- "family" => "inet"
754
+ "family" => "inet",
755
755
  },
756
756
  "3ffe:1111:2222:0:4444::1" => {
757
757
  "prefixlen" => "128",
758
758
  "peer" => "3ffe:1111:2222:0:4444::2",
759
759
  "family" => "inet6",
760
- "scope" => "Global"
761
- }
762
- }
760
+ "scope" => "Global",
761
+ },
762
+ },
763
763
  }
764
764
  @plugin["network"]["default_gateway"] = "192.168.99.126"
765
765
  @plugin["network"]["default_interface"] = "eth2"
@@ -781,8 +781,8 @@ describe Ohai::System, "Network Plugin" do
781
781
  before do
782
782
  @plugin["network"]["default_gateway"] = nil
783
783
  @plugin["network"]["default_interface"] = nil
784
- @plugin["network"]["interfaces"].each do |i,iv|
785
- iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
784
+ @plugin["network"]["interfaces"].each do |i, iv|
785
+ iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
786
786
  end
787
787
  end
788
788
 
@@ -820,9 +820,9 @@ describe Ohai::System, "Network Plugin" do
820
820
  before do
821
821
  @plugin["network"]["default_gateway"] = nil
822
822
  @plugin["network"]["default_interface"] = nil
823
- @plugin["network"]["interfaces"].each do |i,iv|
824
- next if i == 'lo'
825
- iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
823
+ @plugin["network"]["interfaces"].each do |i, iv|
824
+ next if i == "lo"
825
+ iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
826
826
  end
827
827
  end
828
828
 
@@ -863,16 +863,16 @@ describe Ohai::System, "Network Plugin" do
863
863
  @expected_results = {
864
864
  "freebsd" => {
865
865
  "ip6address" => "2001:470:d:cb4::1",
866
- "macaddress" => "02:20:6f:d2:c4:00"
866
+ "macaddress" => "02:20:6f:d2:c4:00",
867
867
  },
868
868
  "linux" => {
869
869
  "ip6address" => "3ffe:1111:2222::33",
870
- "macaddress" => "00:16:3E:2F:36:79"
870
+ "macaddress" => "00:16:3E:2F:36:79",
871
871
  },
872
872
  "windows" => {
873
873
  "ip6address" => "fe80::698d:3e37:7950:b28c",
874
- "macaddress" => "00:AA:BB:CC:DD:EE"
875
- }
874
+ "macaddress" => "00:AA:BB:CC:DD:EE",
875
+ },
876
876
  }
877
877
  end
878
878
 
@@ -897,16 +897,16 @@ describe Ohai::System, "Network Plugin" do
897
897
  @expected_results = {
898
898
  "freebsd" => {
899
899
  "ipaddress" => "76.91.1.255",
900
- "macaddress" => "00:00:24:c9:5e:b8"
900
+ "macaddress" => "00:00:24:c9:5e:b8",
901
901
  },
902
902
  "linux" => {
903
903
  "ipaddress" => "192.168.66.33",
904
- "macaddress" => "00:16:3E:2F:36:79"
904
+ "macaddress" => "00:16:3E:2F:36:79",
905
905
  },
906
906
  "windows" => {
907
907
  "ipaddress" => "172.19.0.130",
908
- "macaddress" => "52:54:44:66:66:02"
909
- }
908
+ "macaddress" => "52:54:44:66:66:02",
909
+ },
910
910
  }
911
911
  end
912
912
 
@@ -928,9 +928,9 @@ describe Ohai::System, "Network Plugin" do
928
928
  before do
929
929
  @plugin["network"]["default_gateway"] = nil
930
930
  @plugin["network"]["default_interface"] = nil
931
- @plugin["network"]["interfaces"].each do |i,iv|
931
+ @plugin["network"]["interfaces"].each do |i, iv|
932
932
  if iv.has_key? "addresses"
933
- iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
933
+ iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
934
934
  end
935
935
  end
936
936
  @plugin["ip6address"] = "3ffe:8888:9999::1"
@@ -943,7 +943,7 @@ describe Ohai::System, "Network Plugin" do
943
943
  },
944
944
  "windows" => {
945
945
  "macaddress" => "52:54:44:66:66:02"
946
- }
946
+ },
947
947
  }
948
948
  end
949
949
 
@@ -982,16 +982,16 @@ describe Ohai::System, "Network Plugin" do
982
982
  @expected_results = {
983
983
  "freebsd" => {
984
984
  "ipaddress" => "76.91.1.255",
985
- "macaddress" => "00:00:24:c9:5e:b8"
985
+ "macaddress" => "00:00:24:c9:5e:b8",
986
986
  },
987
987
  "linux" => {
988
988
  "ipaddress" => "192.168.66.33",
989
- "macaddress" => "00:16:3E:2F:36:79"
989
+ "macaddress" => "00:16:3E:2F:36:79",
990
990
  },
991
991
  "windows" => {
992
992
  "ipaddress" => "172.19.0.130",
993
- "macaddress" => "52:54:44:66:66:02"
994
- }
993
+ "macaddress" => "52:54:44:66:66:02",
994
+ },
995
995
  }
996
996
  end
997
997
 
@@ -1013,9 +1013,9 @@ describe Ohai::System, "Network Plugin" do
1013
1013
  before do
1014
1014
  @plugin["network"]["default_gateway"] = nil
1015
1015
  @plugin["network"]["default_interface"] = nil
1016
- @plugin["network"]["interfaces"].each do |i,iv|
1016
+ @plugin["network"]["interfaces"].each do |i, iv|
1017
1017
  if iv.has_key? "addresses"
1018
- iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
1018
+ iv["addresses"].delete_if { |k, kv| kv["family"] == "inet" }
1019
1019
  end
1020
1020
  end
1021
1021
  @plugin["macaddress"] = "00:AA:BB:CC:DD:EE"