ohai 6.24.2 → 7.0.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. data/lib/ohai.rb +1 -1
  2. data/lib/ohai/application.rb +5 -12
  3. data/lib/ohai/common/dmi.rb +126 -0
  4. data/lib/ohai/config.rb +9 -9
  5. data/lib/ohai/{plugins/darwin/hostname.rb → dsl.rb} +7 -7
  6. data/lib/ohai/dsl/plugin.rb +186 -0
  7. data/lib/ohai/dsl/plugin/versionvi.rb +62 -0
  8. data/lib/ohai/dsl/plugin/versionvii.rb +106 -0
  9. data/lib/ohai/exception.rb +11 -2
  10. data/lib/ohai/hints.rb +48 -0
  11. data/lib/ohai/loader.rb +205 -0
  12. data/lib/ohai/mixin/command.rb +14 -18
  13. data/lib/ohai/mixin/constant_helper.rb +53 -0
  14. data/lib/ohai/mixin/gce_metadata.rb +0 -2
  15. data/lib/ohai/{plugins/freebsd/uptime.rb → mixin/network_constants.rb} +15 -13
  16. data/lib/ohai/mixin/os.rb +59 -0
  17. data/lib/ohai/mixin/seconds_to_human.rb +48 -0
  18. data/lib/ohai/plugins/aix/cpu.rb +26 -22
  19. data/lib/ohai/plugins/aix/filesystem.rb +47 -48
  20. data/lib/ohai/plugins/aix/kernel.rb +11 -7
  21. data/lib/ohai/plugins/aix/memory.rb +8 -4
  22. data/lib/ohai/plugins/aix/network.rb +73 -82
  23. data/lib/ohai/plugins/aix/platform.rb +9 -6
  24. data/lib/ohai/plugins/aix/uptime.rb +14 -12
  25. data/lib/ohai/plugins/azure.rb +33 -11
  26. data/lib/ohai/plugins/c.rb +103 -78
  27. data/lib/ohai/plugins/chef.rb +20 -8
  28. data/lib/ohai/plugins/cloud.rb +234 -230
  29. data/lib/ohai/plugins/command.rb +6 -2
  30. data/lib/ohai/plugins/darwin/cpu.rb +10 -4
  31. data/lib/ohai/plugins/darwin/filesystem.rb +32 -32
  32. data/lib/ohai/plugins/darwin/network.rb +157 -154
  33. data/lib/ohai/plugins/darwin/platform.rb +18 -16
  34. data/lib/ohai/plugins/darwin/system_profiler.rb +49 -46
  35. data/lib/ohai/plugins/dmi.rb +102 -102
  36. data/lib/ohai/plugins/ec2.rb +30 -28
  37. data/lib/ohai/plugins/erlang.rb +19 -16
  38. data/lib/ohai/plugins/eucalyptus.rb +37 -36
  39. data/lib/ohai/plugins/freebsd/cpu.rb +34 -29
  40. data/lib/ohai/plugins/freebsd/filesystem.rb +32 -32
  41. data/lib/ohai/plugins/freebsd/memory.rb +35 -25
  42. data/lib/ohai/plugins/freebsd/network.rb +94 -89
  43. data/lib/ohai/plugins/freebsd/platform.rb +10 -4
  44. data/lib/ohai/plugins/freebsd/virtualization.rb +62 -61
  45. data/lib/ohai/plugins/gce.rb +30 -36
  46. data/lib/ohai/plugins/groovy.rb +14 -11
  47. data/lib/ohai/plugins/hostname.rb +132 -10
  48. data/lib/ohai/plugins/ip_scopes.rb +31 -16
  49. data/lib/ohai/plugins/java.rb +45 -21
  50. data/lib/ohai/plugins/kernel.rb +186 -19
  51. data/lib/ohai/plugins/keys.rb +6 -2
  52. data/lib/ohai/plugins/languages.rb +6 -2
  53. data/lib/ohai/plugins/linode.rb +38 -30
  54. data/lib/ohai/plugins/linux/block_device.rb +19 -15
  55. data/lib/ohai/plugins/linux/cpu.rb +42 -38
  56. data/lib/ohai/plugins/linux/filesystem.rb +70 -130
  57. data/lib/ohai/plugins/linux/lsb.rb +35 -35
  58. data/lib/ohai/plugins/linux/memory.rb +65 -61
  59. data/lib/ohai/plugins/linux/network.rb +343 -362
  60. data/lib/ohai/plugins/linux/platform.rb +90 -88
  61. data/lib/ohai/plugins/linux/virtualization.rb +95 -90
  62. data/lib/ohai/plugins/lua.rb +14 -10
  63. data/lib/ohai/plugins/mono.rb +17 -13
  64. data/lib/ohai/plugins/netbsd/cpu.rb +25 -23
  65. data/lib/ohai/plugins/netbsd/filesystem.rb +32 -32
  66. data/lib/ohai/plugins/netbsd/memory.rb +59 -59
  67. data/lib/ohai/plugins/netbsd/network.rb +92 -88
  68. data/lib/ohai/plugins/netbsd/platform.rb +10 -3
  69. data/lib/ohai/plugins/netbsd/virtualization.rb +41 -38
  70. data/lib/ohai/plugins/network.rb +131 -130
  71. data/lib/ohai/plugins/network_listeners.rb +26 -22
  72. data/lib/ohai/plugins/nodejs.rb +14 -10
  73. data/lib/ohai/plugins/ohai.rb +11 -6
  74. data/lib/ohai/plugins/ohai_time.rb +6 -2
  75. data/lib/ohai/plugins/openbsd/cpu.rb +20 -15
  76. data/lib/ohai/plugins/openbsd/filesystem.rb +32 -32
  77. data/lib/ohai/plugins/openbsd/memory.rb +59 -59
  78. data/lib/ohai/plugins/openbsd/network.rb +92 -88
  79. data/lib/ohai/plugins/openbsd/platform.rb +10 -4
  80. data/lib/ohai/plugins/openbsd/virtualization.rb +41 -39
  81. data/lib/ohai/plugins/openstack.rb +23 -21
  82. data/lib/ohai/plugins/os.rb +8 -32
  83. data/lib/ohai/plugins/passwd.rb +27 -22
  84. data/lib/ohai/plugins/perl.rb +21 -16
  85. data/lib/ohai/plugins/php.rb +15 -12
  86. data/lib/ohai/plugins/platform.rb +9 -9
  87. data/lib/ohai/plugins/{linux/kernel.rb → ps.rb} +13 -12
  88. data/lib/ohai/plugins/python.rb +16 -12
  89. data/lib/ohai/plugins/rackspace.rb +82 -77
  90. data/lib/ohai/plugins/root_group.rb +13 -9
  91. data/lib/ohai/plugins/ruby.rb +50 -48
  92. data/lib/ohai/plugins/sigar/cpu.rb +21 -17
  93. data/lib/ohai/plugins/sigar/filesystem.rb +26 -23
  94. data/lib/ohai/plugins/sigar/memory.rb +17 -14
  95. data/lib/ohai/plugins/sigar/network.rb +133 -67
  96. data/lib/ohai/plugins/sigar/network_route.rb +33 -28
  97. data/lib/ohai/plugins/sigar/platform.rb +10 -6
  98. data/lib/ohai/plugins/solaris2/cpu.rb +41 -33
  99. data/lib/ohai/plugins/solaris2/dmi.rb +146 -146
  100. data/lib/ohai/plugins/solaris2/filesystem.rb +74 -77
  101. data/lib/ohai/plugins/{aix/hostname.rb → solaris2/memory.rb} +7 -4
  102. data/lib/ohai/plugins/solaris2/network.rb +91 -86
  103. data/lib/ohai/plugins/solaris2/platform.rb +40 -36
  104. data/lib/ohai/plugins/solaris2/virtualization.rb +54 -59
  105. data/lib/ohai/plugins/solaris2/zpools.rb +38 -38
  106. data/lib/ohai/plugins/ssh_host_key.rb +49 -45
  107. data/lib/ohai/plugins/uptime.rb +87 -25
  108. data/lib/ohai/plugins/virtualization.rb +59 -55
  109. data/lib/ohai/plugins/windows/cpu.rb +44 -40
  110. data/lib/ohai/plugins/windows/filesystem.rb +28 -22
  111. data/lib/ohai/plugins/windows/network.rb +88 -79
  112. data/lib/ohai/plugins/windows/platform.rb +10 -3
  113. data/lib/ohai/provides_map.rb +184 -0
  114. data/lib/ohai/runner.rb +109 -0
  115. data/lib/ohai/system.rb +103 -184
  116. data/lib/ohai/version.rb +4 -3
  117. data/spec/data/plugins/___lib64___libc.so.6.output +135 -0
  118. data/spec/data/plugins/___lib___libc.so.6.output +135 -0
  119. data/spec/data/plugins/cc.output +135 -0
  120. data/spec/data/plugins/cl.output +135 -0
  121. data/spec/data/plugins/devenv.com.output +135 -0
  122. data/spec/data/plugins/env.output +71 -0
  123. data/spec/data/plugins/erl.output +144 -0
  124. data/spec/data/plugins/gcc.output +135 -0
  125. data/spec/data/plugins/groovy.output +159 -0
  126. data/spec/data/plugins/java.output +143 -0
  127. data/spec/data/plugins/lua.output +143 -0
  128. data/spec/data/plugins/messages.rb +8 -0
  129. data/spec/data/plugins/node.output +143 -0
  130. data/spec/data/plugins/perl.output +143 -0
  131. data/spec/data/plugins/php.output +143 -0
  132. data/spec/data/plugins/python.output +143 -0
  133. data/spec/data/plugins/uname.output +71 -0
  134. data/spec/data/plugins/v6message.rb +2 -0
  135. data/spec/data/plugins/v7message.rb +7 -0
  136. data/spec/data/plugins/what.output +135 -0
  137. data/spec/data/plugins/xlc.output +135 -0
  138. data/spec/spec_helper.rb +52 -18
  139. data/spec/support/integration_helper.rb +44 -0
  140. data/spec/unit/dsl/plugin_spec.rb +298 -0
  141. data/spec/unit/hints_spec.rb +65 -0
  142. data/spec/unit/loader_spec.rb +226 -0
  143. data/spec/unit/mixin/ec2_metadata_spec.rb +9 -9
  144. data/spec/unit/plugins/aix/cpu_spec.rb +17 -18
  145. data/spec/unit/plugins/aix/filesystem_spec.rb +20 -18
  146. data/spec/unit/plugins/aix/hostname_spec.rb +8 -4
  147. data/spec/unit/plugins/aix/kernel_spec.rb +13 -12
  148. data/spec/unit/plugins/aix/network_spec.rb +66 -45
  149. data/spec/unit/plugins/aix/platform_spec.rb +11 -10
  150. data/spec/unit/plugins/aix/uptime_spec.rb +7 -8
  151. data/spec/unit/plugins/azure_spec.rb +20 -21
  152. data/spec/unit/plugins/c_spec.rb +88 -87
  153. data/spec/unit/plugins/chef_spec.rb +5 -6
  154. data/spec/unit/plugins/cloud_spec.rb +81 -82
  155. data/spec/unit/plugins/darwin/cpu_spec.rb +8 -9
  156. data/spec/unit/plugins/darwin/hostname_spec.rb +23 -11
  157. data/spec/unit/plugins/darwin/kernel_spec.rb +39 -16
  158. data/spec/unit/plugins/darwin/network_spec.rb +375 -378
  159. data/spec/unit/plugins/darwin/platform_spec.rb +23 -50
  160. data/spec/unit/plugins/darwin/system_profiler_spec.rb +7 -8
  161. data/spec/unit/plugins/dmi_spec.rb +7 -12
  162. data/spec/unit/plugins/ec2_spec.rb +70 -59
  163. data/spec/unit/plugins/erlang_spec.rb +18 -20
  164. data/spec/unit/plugins/eucalyptus_spec.rb +37 -33
  165. data/spec/unit/plugins/fail_spec.rb +276 -23
  166. data/spec/unit/plugins/freebsd/hostname_spec.rb +11 -9
  167. data/spec/unit/plugins/freebsd/kernel_spec.rb +8 -8
  168. data/spec/unit/plugins/freebsd/platform_spec.rb +9 -10
  169. data/spec/unit/plugins/freebsd/virtualization_spec.rb +32 -32
  170. data/spec/unit/plugins/gce_spec.rb +19 -25
  171. data/spec/unit/plugins/groovy_spec.rb +10 -16
  172. data/spec/unit/plugins/hostname_spec.rb +45 -20
  173. data/spec/unit/plugins/ip_scopes_spec.rb +97 -0
  174. data/spec/unit/plugins/java_spec.rb +145 -99
  175. data/spec/unit/plugins/kernel_spec.rb +51 -15
  176. data/spec/unit/plugins/linode_spec.rb +31 -29
  177. data/spec/unit/plugins/linux/cpu_spec.rb +42 -43
  178. data/spec/unit/plugins/linux/filesystem_spec.rb +143 -324
  179. data/spec/unit/plugins/linux/hostname_spec.rb +16 -23
  180. data/spec/unit/plugins/linux/kernel_spec.rb +22 -8
  181. data/spec/unit/plugins/linux/lsb_spec.rb +54 -56
  182. data/spec/unit/plugins/linux/network_spec.rb +196 -238
  183. data/spec/unit/plugins/linux/platform_spec.rb +186 -205
  184. data/spec/unit/plugins/linux/uptime_spec.rb +13 -25
  185. data/spec/unit/plugins/linux/virtualization_spec.rb +149 -129
  186. data/spec/unit/plugins/lua_spec.rb +12 -15
  187. data/spec/unit/plugins/mono_spec.rb +10 -15
  188. data/spec/unit/plugins/netbsd/hostname_spec.rb +17 -7
  189. data/spec/unit/plugins/netbsd/kernel_spec.rb +8 -8
  190. data/spec/unit/plugins/netbsd/platform_spec.rb +8 -10
  191. data/spec/unit/plugins/network_spec.rb +358 -235
  192. data/spec/unit/plugins/nodejs_spec.rb +13 -15
  193. data/spec/unit/plugins/ohai_spec.rb +3 -4
  194. data/spec/unit/plugins/ohai_time_spec.rb +8 -9
  195. data/spec/unit/plugins/openbsd/hostname_spec.rb +21 -11
  196. data/spec/unit/plugins/openbsd/kernel_spec.rb +8 -8
  197. data/spec/unit/plugins/openbsd/platform_spec.rb +6 -12
  198. data/spec/unit/plugins/openstack_spec.rb +214 -0
  199. data/spec/unit/plugins/os_spec.rb +13 -16
  200. data/spec/unit/plugins/passwd_spec.rb +12 -13
  201. data/spec/unit/plugins/perl_spec.rb +20 -44
  202. data/spec/unit/plugins/php_spec.rb +20 -15
  203. data/spec/unit/plugins/platform_spec.rb +24 -29
  204. data/spec/unit/plugins/python_spec.rb +13 -17
  205. data/spec/unit/plugins/rackspace_spec.rb +90 -57
  206. data/spec/unit/plugins/root_group_spec.rb +17 -19
  207. data/spec/unit/plugins/ruby_spec.rb +15 -16
  208. data/spec/unit/plugins/sigar/network_route_spec.rb +12 -13
  209. data/spec/unit/plugins/solaris2/cpu_spec.rb +82 -0
  210. data/spec/unit/plugins/solaris2/hostname_spec.rb +12 -13
  211. data/spec/unit/plugins/solaris2/kernel_spec.rb +11 -15
  212. data/{lib/ohai/plugins/openbsd/uptime.rb → spec/unit/plugins/solaris2/memory_spec.rb} +10 -12
  213. data/spec/unit/plugins/solaris2/network_spec.rb +44 -20
  214. data/spec/unit/plugins/solaris2/platform_spec.rb +13 -22
  215. data/spec/unit/plugins/solaris2/virtualization_spec.rb +37 -45
  216. data/spec/unit/plugins/ssh_host_keys_spec.rb +11 -15
  217. data/spec/unit/provides_map_spec.rb +208 -0
  218. data/spec/unit/runner_spec.rb +488 -0
  219. data/spec/unit/system_spec.rb +639 -104
  220. metadata +151 -87
  221. checksums.yaml +0 -7
  222. data/lib/ohai/mixin/from_file.rb +0 -36
  223. data/lib/ohai/plugins/aix/ps.rb +0 -23
  224. data/lib/ohai/plugins/darwin/kernel.rb +0 -37
  225. data/lib/ohai/plugins/darwin/ps.rb +0 -23
  226. data/lib/ohai/plugins/darwin/uptime.rb +0 -32
  227. data/lib/ohai/plugins/dmi_common.rb +0 -121
  228. data/lib/ohai/plugins/freebsd/hostname.rb +0 -22
  229. data/lib/ohai/plugins/freebsd/kernel.rb +0 -37
  230. data/lib/ohai/plugins/freebsd/ps.rb +0 -24
  231. data/lib/ohai/plugins/hpux/cpu.rb +0 -19
  232. data/lib/ohai/plugins/hpux/filesystem.rb +0 -19
  233. data/lib/ohai/plugins/hpux/hostname.rb +0 -19
  234. data/lib/ohai/plugins/hpux/memory.rb +0 -19
  235. data/lib/ohai/plugins/hpux/network.rb +0 -19
  236. data/lib/ohai/plugins/hpux/platform.rb +0 -19
  237. data/lib/ohai/plugins/hpux/ps.rb +0 -23
  238. data/lib/ohai/plugins/hpux/uptime.rb +0 -19
  239. data/lib/ohai/plugins/linux/hostname.rb +0 -40
  240. data/lib/ohai/plugins/linux/ps.rb +0 -23
  241. data/lib/ohai/plugins/linux/uptime.rb +0 -28
  242. data/lib/ohai/plugins/netbsd/hostname.rb +0 -22
  243. data/lib/ohai/plugins/netbsd/kernel.rb +0 -35
  244. data/lib/ohai/plugins/netbsd/ps.rb +0 -24
  245. data/lib/ohai/plugins/netbsd/uptime.rb +0 -31
  246. data/lib/ohai/plugins/openbsd/hostname.rb +0 -22
  247. data/lib/ohai/plugins/openbsd/kernel.rb +0 -35
  248. data/lib/ohai/plugins/openbsd/ps.rb +0 -24
  249. data/lib/ohai/plugins/sigar/hostname.rb +0 -28
  250. data/lib/ohai/plugins/sigar/uptime.rb +0 -27
  251. data/lib/ohai/plugins/solaris2/hostname.rb +0 -34
  252. data/lib/ohai/plugins/solaris2/kernel.rb +0 -40
  253. data/lib/ohai/plugins/solaris2/ps.rb +0 -23
  254. data/lib/ohai/plugins/solaris2/uptime.rb +0 -36
  255. data/lib/ohai/plugins/windows/hostname.rb +0 -33
  256. data/lib/ohai/plugins/windows/kernel.rb +0 -58
  257. data/lib/ohai/plugins/windows/kernel_devices.rb +0 -39
  258. data/lib/ohai/plugins/windows/uptime.rb +0 -23
  259. data/spec/unit/mixin/from_file_spec.rb +0 -53
@@ -22,264 +22,249 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
 
23
23
  describe Ohai::System, "Linux plugin platform" do
24
24
  before(:each) do
25
- @ohai = Ohai::System.new
26
- @ohai.stub!(:require_plugin).and_return(true)
27
- @ohai.extend(SimpleFromFile)
28
- @ohai[:os] = "linux"
29
- @ohai[:lsb] = Mash.new
30
- File.stub!(:exists?).with("/etc/debian_version").and_return(false)
31
- File.stub!(:exists?).with("/etc/redhat-release").and_return(false)
32
- File.stub!(:exists?).with("/etc/gentoo-release").and_return(false)
33
- File.stub!(:exists?).with("/etc/SuSE-release").and_return(false)
34
- File.stub!(:exists?).with("/etc/arch-release").and_return(false)
35
- File.stub!(:exists?).with("/etc/system-release").and_return(false)
36
- File.stub!(:exists?).with("/etc/slackware-version").and_return(false)
37
- File.stub!(:exists?).with("/etc/enterprise-release").and_return(false)
38
- File.stub!(:exists?).with("/etc/oracle-release").and_return(false)
39
- File.stub!(:exists?).with("/usr/bin/raspi-config").and_return(false)
25
+ @plugin = get_plugin("linux/platform")
26
+ @plugin.stub(:collect_os).and_return(:linux)
27
+ @plugin[:lsb] = Mash.new
28
+ File.stub(:exists?).with("/etc/debian_version").and_return(false)
29
+ File.stub(:exists?).with("/etc/redhat-release").and_return(false)
30
+ File.stub(:exists?).with("/etc/gentoo-release").and_return(false)
31
+ File.stub(:exists?).with("/etc/SuSE-release").and_return(false)
32
+ File.stub(:exists?).with("/etc/arch-release").and_return(false)
33
+ File.stub(:exists?).with("/etc/system-release").and_return(false)
34
+ File.stub(:exists?).with("/etc/slackware-version").and_return(false)
35
+ File.stub(:exists?).with("/etc/enterprise-release").and_return(false)
36
+ File.stub(:exists?).with("/etc/oracle-release").and_return(false)
37
+ File.stub(:exists?).with("/usr/bin/raspi-config").and_return(false)
40
38
  end
41
-
42
- it "should require the lsb plugin" do
43
- @ohai.should_receive(:require_plugin).with("linux::lsb").and_return(true)
44
- @ohai._require_plugin("linux::platform")
45
- end
46
-
39
+
47
40
  describe "on lsb compliant distributions" do
48
41
  before(:each) do
49
- @ohai[:lsb][:id] = "Ubuntu"
50
- @ohai[:lsb][:release] = "8.04"
42
+ @plugin[:lsb][:id] = "Ubuntu"
43
+ @plugin[:lsb][:release] = "8.04"
51
44
  end
52
45
 
53
46
  it "should set platform to lowercased lsb[:id]" do
54
- @ohai._require_plugin("linux::platform")
55
- @ohai[:platform].should == "ubuntu"
47
+ @plugin.run
48
+ @plugin[:platform].should == "ubuntu"
56
49
  end
57
50
 
58
51
  it "should set platform_version to lsb[:release]" do
59
- @ohai._require_plugin("linux::platform")
60
- @ohai[:platform_version].should == "8.04"
52
+ @plugin.run
53
+ @plugin[:platform_version].should == "8.04"
61
54
  end
62
55
 
63
56
  it "should set platform to ubuntu and platform_family to debian [:lsb][:id] contains Ubuntu" do
64
- @ohai[:lsb][:id] = "Ubuntu"
65
- @ohai._require_plugin("linux::platform")
66
- @ohai[:platform].should == "ubuntu"
67
- @ohai[:platform_family].should == "debian"
57
+ @plugin[:lsb][:id] = "Ubuntu"
58
+ @plugin.run
59
+ @plugin[:platform].should == "ubuntu"
60
+ @plugin[:platform_family].should == "debian"
68
61
  end
69
62
  it "should set platform to linuxmint and platform_family to debian [:lsb][:id] contains LinuxMint" do
70
- @ohai[:lsb][:id] = "LinuxMint"
71
- @ohai._require_plugin("linux::platform")
72
- @ohai[:platform].should == "linuxmint"
73
- @ohai[:platform_family].should == "debian"
63
+ @plugin[:lsb][:id] = "LinuxMint"
64
+ @plugin.run
65
+ @plugin[:platform].should == "linuxmint"
66
+ @plugin[:platform_family].should == "debian"
74
67
  end
75
68
  it "should set platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
76
- @ohai[:lsb][:id] = "Debian"
77
- @ohai._require_plugin("linux::platform")
78
- @ohai[:platform].should == "debian"
79
- @ohai[:platform_family].should == "debian"
69
+ @plugin[:lsb][:id] = "Debian"
70
+ @plugin.run
71
+ @plugin[:platform].should == "debian"
72
+ @plugin[:platform_family].should == "debian"
80
73
  end
81
74
  it "should set platform to redhat and platform_family to rhel when [:lsb][:id] contains Redhat" do
82
- @ohai[:lsb][:id] = "RedHatEnterpriseServer"
83
- @ohai[:lsb][:release] = "5.7"
84
- @ohai._require_plugin("linux::platform")
85
- @ohai[:platform].should == "redhat"
86
- @ohai[:platform_family].should == "rhel"
75
+ @plugin[:lsb][:id] = "RedHatEnterpriseServer"
76
+ @plugin[:lsb][:release] = "5.7"
77
+ @plugin.run
78
+ @plugin[:platform].should == "redhat"
79
+ @plugin[:platform_family].should == "rhel"
87
80
  end
88
81
 
89
82
  it "should set platform to amazon and platform_family to rhel when [:lsb][:id] contains Amazon" do
90
- @ohai[:lsb][:id] = "AmazonAMI"
91
- @ohai[:lsb][:release] = "2011.09"
92
- @ohai._require_plugin("linux::platform")
93
- @ohai[:platform].should == "amazon"
94
- @ohai[:platform_family].should == "rhel"
83
+ @plugin[:lsb][:id] = "AmazonAMI"
84
+ @plugin[:lsb][:release] = "2011.09"
85
+ @plugin.run
86
+ @plugin[:platform].should == "amazon"
87
+ @plugin[:platform_family].should == "rhel"
95
88
  end
96
89
 
97
90
  it "should set platform to scientific when [:lsb][:id] contains ScientificSL" do
98
- @ohai[:lsb][:id] = "ScientificSL"
99
- @ohai[:lsb][:release] = "5.7"
100
- @ohai._require_plugin("linux::platform")
101
- @ohai[:platform].should == "scientific"
91
+ @plugin[:lsb][:id] = "ScientificSL"
92
+ @plugin[:lsb][:release] = "5.7"
93
+ @plugin.run
94
+ @plugin[:platform].should == "scientific"
102
95
  end
103
96
  end
104
97
 
105
98
  describe "on debian" do
106
99
  before(:each) do
107
- @ohai.lsb = nil
100
+ @plugin.lsb = nil
108
101
  File.should_receive(:exists?).with("/etc/debian_version").and_return(true)
109
102
  end
110
-
111
- it "should check for the existance of debian_version" do
112
- @ohai._require_plugin("linux::platform")
113
- end
114
103
 
115
104
  it "should read the version from /etc/debian_version" do
116
105
  File.should_receive(:read).with("/etc/debian_version").and_return("5.0")
117
- @ohai._require_plugin("linux::platform")
118
- @ohai[:platform_version].should == "5.0"
106
+ @plugin.run
107
+ @plugin[:platform_version].should == "5.0"
119
108
  end
120
109
 
121
110
  it "should correctly strip any newlines" do
122
111
  File.should_receive(:read).with("/etc/debian_version").and_return("5.0\n")
123
- @ohai._require_plugin("linux::platform")
124
- @ohai[:platform_version].should == "5.0"
112
+ @plugin.run
113
+ @plugin[:platform_version].should == "5.0"
125
114
  end
126
115
 
127
116
  # Ubuntu has /etc/debian_version as well
128
117
  it "should detect Ubuntu as itself rather than debian" do
129
- @ohai[:lsb][:id] = "Ubuntu"
130
- @ohai[:lsb][:release] = "8.04"
131
- @ohai._require_plugin("linux::platform")
132
- @ohai[:platform].should == "ubuntu"
118
+ @plugin[:lsb][:id] = "Ubuntu"
119
+ @plugin[:lsb][:release] = "8.04"
120
+ @plugin.run
121
+ @plugin[:platform].should == "ubuntu"
133
122
  end
134
123
 
135
124
  # Raspbian is a debian clone
136
125
  it "should detect Raspbian as itself with debian as the family" do
137
126
  File.should_receive(:exists?).with("/usr/bin/raspi-config").and_return(true)
138
127
  File.should_receive(:read).with("/etc/debian_version").and_return("wheezy/sid")
139
- @ohai._require_plugin("linux::platform")
140
- @ohai[:platform].should == "raspbian"
141
- @ohai[:platform_family].should == "debian"
128
+ @plugin.run
129
+ @plugin[:platform].should == "raspbian"
130
+ @plugin[:platform_family].should == "debian"
142
131
  end
143
132
  end
144
133
 
145
134
  describe "on slackware" do
146
135
  before(:each) do
147
- @ohai.lsb = nil
136
+ @plugin.lsb = nil
148
137
  File.should_receive(:exists?).with("/etc/slackware-version").and_return(true)
149
138
  end
150
139
 
151
140
  it "should set platform and platform_family to slackware" do
152
141
  File.should_receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
153
- @ohai._require_plugin("linux::platform")
154
- @ohai[:platform].should == "slackware"
155
- @ohai[:platform_family].should == "slackware"
142
+ @plugin.run
143
+ @plugin[:platform].should == "slackware"
144
+ @plugin[:platform_family].should == "slackware"
156
145
  end
157
146
  end
158
147
 
159
148
  describe "on arch" do
160
149
  before(:each) do
161
- @ohai.lsb = nil
150
+ @plugin.lsb = nil
162
151
  File.should_receive(:exists?).with("/etc/arch-release").and_return(true)
163
152
  end
164
153
 
165
154
  it "should set platform to arch and platform_family to arch" do
166
- @ohai._require_plugin("linux::platform")
167
- @ohai[:platform].should == "arch"
168
- @ohai[:platform_family].should == "arch"
155
+ @plugin.run
156
+ @plugin[:platform].should == "arch"
157
+ @plugin[:platform_family].should == "arch"
169
158
  end
170
159
 
171
160
  end
172
161
 
173
162
  describe "on gentoo" do
174
163
  before(:each) do
175
- @ohai.lsb = nil
164
+ @plugin.lsb = nil
176
165
  File.should_receive(:exists?).with("/etc/gentoo-release").and_return(true)
177
166
  end
178
167
 
179
168
  it "should set platform and platform_family to gentoo" do
180
169
  File.should_receive(:read).with("/etc/gentoo-release").and_return("Gentoo Base System release 1.20.1.1")
181
- @ohai._require_plugin("linux::platform")
182
- @ohai[:platform].should == "gentoo"
183
- @ohai[:platform_family].should == "gentoo"
170
+ @plugin.run
171
+ @plugin[:platform].should == "gentoo"
172
+ @plugin[:platform_family].should == "gentoo"
184
173
  end
185
174
  end
186
175
 
187
176
  describe "on redhat breeds" do
188
177
  describe "with lsb_release results" do
189
178
  it "should set the platform to redhat and platform_family to rhel even if the LSB name is something absurd but redhat like" do
190
- @ohai[:lsb][:id] = "RedHatEnterpriseServer"
191
- @ohai[:lsb][:release] = "6.1"
192
- @ohai._require_plugin("linux::platform")
193
- @ohai[:platform].should == "redhat"
194
- @ohai[:platform_version].should == "6.1"
195
- @ohai[:platform_family].should == "rhel"
179
+ @plugin[:lsb][:id] = "RedHatEnterpriseServer"
180
+ @plugin[:lsb][:release] = "6.1"
181
+ @plugin.run
182
+ @plugin[:platform].should == "redhat"
183
+ @plugin[:platform_version].should == "6.1"
184
+ @plugin[:platform_family].should == "rhel"
196
185
  end
197
186
 
198
187
  it "should set the platform to centos and platform_family to rhel" do
199
- @ohai[:lsb][:id] = "CentOS"
200
- @ohai[:lsb][:release] = "5.4"
201
- @ohai._require_plugin("linux::platform")
202
- @ohai[:platform].should == "centos"
203
- @ohai[:platform_version].should == "5.4"
204
- @ohai[:platform_family].should == "rhel"
188
+ @plugin[:lsb][:id] = "CentOS"
189
+ @plugin[:lsb][:release] = "5.4"
190
+ @plugin.run
191
+ @plugin[:platform].should == "centos"
192
+ @plugin[:platform_version].should == "5.4"
193
+ @plugin[:platform_family].should == "rhel"
205
194
 
206
195
  end
207
196
 
208
197
 
209
198
  it "should set the platform_family to rhel if the LSB name is oracle-ish" do
210
- @ohai[:lsb][:id] = "EnterpriseEnterpriseServer"
211
- @ohai._require_plugin("linux::platform")
212
- @ohai[:platform_family].should == "rhel"
199
+ @plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
200
+ @plugin.run
201
+ @plugin[:platform_family].should == "rhel"
213
202
  end
214
203
 
215
204
  it "should set the platform_family to rhel if the LSB name is amazon-ish" do
216
- @ohai[:lsb][:id] = "Amazon"
217
- @ohai._require_plugin("linux::platform")
218
- @ohai[:platform_family].should == "rhel"
205
+ @plugin[:lsb][:id] = "Amazon"
206
+ @plugin.run
207
+ @plugin[:platform_family].should == "rhel"
219
208
  end
220
209
 
221
210
  it "should set the platform_family to fedora if the LSB name is fedora-ish" do
222
- @ohai[:lsb][:id] = "Fedora"
223
- @ohai._require_plugin("linux::platform")
224
- @ohai[:platform_family].should == "fedora"
211
+ @plugin[:lsb][:id] = "Fedora"
212
+ @plugin.run
213
+ @plugin[:platform_family].should == "fedora"
225
214
  end
226
215
 
227
216
  it "should set the platform_family to redhat if the LSB name is scientific-ish" do
228
- @ohai[:lsb][:id] = "Scientific"
229
- @ohai._require_plugin("linux::platform")
230
- @ohai[:platform_family].should == "rhel"
217
+ @plugin[:lsb][:id] = "Scientific"
218
+ @plugin.run
219
+ @plugin[:platform_family].should == "rhel"
231
220
  end
232
221
  end
233
222
 
234
223
  describe "without lsb_release results" do
235
224
  before(:each) do
236
- @ohai.lsb = nil
225
+ @plugin.lsb = nil
237
226
  File.should_receive(:exists?).with("/etc/redhat-release").and_return(true)
238
227
  end
239
228
 
240
- it "should check for the existance of redhat-release" do
241
- @ohai._require_plugin("linux::platform")
242
- end
243
-
244
229
  it "should read the platform as centos and version as 5.3" do
245
230
  File.should_receive(:read).with("/etc/redhat-release").and_return("CentOS release 5.3")
246
- @ohai._require_plugin("linux::platform")
247
- @ohai[:platform].should == "centos"
231
+ @plugin.run
232
+ @plugin[:platform].should == "centos"
248
233
  end
249
234
 
250
235
  it "may be that someone munged Red Hat to be RedHat" do
251
236
  File.should_receive(:read).with("/etc/redhat-release").and_return("RedHat release 5.3")
252
- @ohai._require_plugin("linux::platform")
253
- @ohai[:platform].should == "redhat"
254
- @ohai[:platform_version].should == "5.3"
237
+ @plugin.run
238
+ @plugin[:platform].should == "redhat"
239
+ @plugin[:platform_version].should == "5.3"
255
240
  end
256
241
 
257
242
  it "should read the platform as redhat and version as 5.3" do
258
243
  File.should_receive(:read).with("/etc/redhat-release").and_return("Red Hat release 5.3")
259
- @ohai._require_plugin("linux::platform")
260
- @ohai[:platform].should == "redhat"
261
- @ohai[:platform_version].should == "5.3"
244
+ @plugin.run
245
+ @plugin[:platform].should == "redhat"
246
+ @plugin[:platform_version].should == "5.3"
262
247
  end
263
248
 
264
249
  it "should read the platform as fedora and version as 13 (rawhide)" do
265
250
  File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
266
- @ohai._require_plugin("linux::platform")
267
- @ohai[:platform].should == "fedora"
268
- @ohai[:platform_version].should == "13 (rawhide)"
251
+ @plugin.run
252
+ @plugin[:platform].should == "fedora"
253
+ @plugin[:platform_version].should == "13 (rawhide)"
269
254
  end
270
255
 
271
256
  it "should read the platform as fedora and version as 10" do
272
257
  File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 10")
273
- @ohai._require_plugin("linux::platform")
274
- @ohai[:platform].should == "fedora"
275
- @ohai[:platform_version].should == "10"
258
+ @plugin.run
259
+ @plugin[:platform].should == "fedora"
260
+ @plugin[:platform_version].should == "10"
276
261
  end
277
262
 
278
263
  it "should read the platform as fedora and version as 13 using to_i" do
279
264
  File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
280
- @ohai._require_plugin("linux::platform")
281
- @ohai[:platform].should == "fedora"
282
- @ohai[:platform_version].to_i.should == 13
265
+ @plugin.run
266
+ @plugin[:platform].should == "fedora"
267
+ @plugin[:platform_version].to_i.should == 13
283
268
  end
284
269
  end
285
270
  end
@@ -287,83 +272,83 @@ describe Ohai::System, "Linux plugin platform" do
287
272
  describe "on oracle enterprise linux" do
288
273
  describe "with lsb_results" do
289
274
  it "should read the platform as oracle and version as 5.7" do
290
- @ohai[:lsb][:id] = "EnterpriseEnterpriseServer"
291
- @ohai[:lsb][:release] = "5.7"
292
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
293
- File.stub!(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
275
+ @plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
276
+ @plugin[:lsb][:release] = "5.7"
277
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
278
+ File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
294
279
  File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
295
280
  File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
296
- @ohai._require_plugin("linux::platform")
297
- @ohai[:platform].should == "oracle"
298
- @ohai[:platform_version].should == "5.7"
281
+ @plugin.run
282
+ @plugin[:platform].should == "oracle"
283
+ @plugin[:platform_version].should == "5.7"
299
284
  end
300
285
 
301
286
  it "should read the platform as oracle and version as 6.1" do
302
- @ohai[:lsb][:id] = "OracleServer"
303
- @ohai[:lsb][:release] = "6.1"
304
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
305
- File.stub!(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
287
+ @plugin[:lsb][:id] = "OracleServer"
288
+ @plugin[:lsb][:release] = "6.1"
289
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
290
+ File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
306
291
  File.should_receive(:exists?).with("/etc/oracle-release").and_return(true)
307
292
  File.should_receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
308
- @ohai._require_plugin("linux::platform")
309
- @ohai[:platform].should == "oracle"
310
- @ohai[:platform_version].should == "6.1"
293
+ @plugin.run
294
+ @plugin[:platform].should == "oracle"
295
+ @plugin[:platform_version].should == "6.1"
311
296
  end
312
297
  end
313
298
 
314
299
  describe "without lsb_results" do
315
300
  before(:each) do
316
- @ohai.lsb = nil
301
+ @plugin.lsb = nil
317
302
  end
318
303
 
319
304
  it "should read the platform as oracle and version as 5" do
320
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
321
- File.stub!(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
305
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
306
+ File.stub(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
322
307
  File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
323
308
  File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
324
- @ohai._require_plugin("linux::platform")
325
- @ohai[:platform].should == "oracle"
326
- @ohai[:platform_version].should == "5"
309
+ @plugin.run
310
+ @plugin[:platform].should == "oracle"
311
+ @plugin[:platform_version].should == "5"
327
312
  end
328
313
 
329
314
  it "should read the platform as oracle and version as 5.1" do
330
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
331
- File.stub!(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
315
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
316
+ File.stub(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
332
317
  File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
333
318
  File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
334
- @ohai._require_plugin("linux::platform")
335
- @ohai[:platform].should == "oracle"
336
- @ohai[:platform_version].should == "5.1"
319
+ @plugin.run
320
+ @plugin[:platform].should == "oracle"
321
+ @plugin[:platform_version].should == "5.1"
337
322
  end
338
323
 
339
324
  it "should read the platform as oracle and version as 5.7" do
340
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
341
- File.stub!(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
325
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
326
+ File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
342
327
  File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
343
328
  File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
344
- @ohai._require_plugin("linux::platform")
345
- @ohai[:platform].should == "oracle"
346
- @ohai[:platform_version].should == "5.7"
329
+ @plugin.run
330
+ @plugin[:platform].should == "oracle"
331
+ @plugin[:platform_version].should == "5.7"
347
332
  end
348
333
 
349
334
  it "should read the platform as oracle and version as 6.0" do
350
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
351
- File.stub!(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
335
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
336
+ File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
352
337
  File.should_receive(:exists?).with("/etc/oracle-release").and_return(true)
353
338
  File.should_receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.0")
354
- @ohai._require_plugin("linux::platform")
355
- @ohai[:platform].should == "oracle"
356
- @ohai[:platform_version].should == "6.0"
339
+ @plugin.run
340
+ @plugin[:platform].should == "oracle"
341
+ @plugin[:platform_version].should == "6.0"
357
342
  end
358
343
 
359
344
  it "should read the platform as oracle and version as 6.1" do
360
- File.stub!(:exists?).with("/etc/redhat-release").and_return(true)
361
- File.stub!(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
345
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
346
+ File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
362
347
  File.should_receive(:exists?).with("/etc/oracle-release").and_return(true)
363
348
  File.should_receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
364
- @ohai._require_plugin("linux::platform")
365
- @ohai[:platform].should == "oracle"
366
- @ohai[:platform_version].should == "6.1"
349
+ @plugin.run
350
+ @plugin[:platform].should == "oracle"
351
+ @plugin[:platform_version].should == "6.1"
367
352
  end
368
353
  end
369
354
  end
@@ -375,73 +360,69 @@ describe Ohai::System, "Linux plugin platform" do
375
360
 
376
361
  describe "with lsb_release results" do
377
362
  before(:each) do
378
- @ohai[:lsb][:id] = "SUSE LINUX"
363
+ @plugin[:lsb][:id] = "SUSE LINUX"
379
364
  end
380
365
 
381
366
  it "should read the platform as suse" do
382
- @ohai[:lsb][:release] = "12.1"
383
- File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
384
- @ohai._require_plugin("linux::platform")
385
- @ohai[:platform].should == "suse"
386
- @ohai[:platform_version].should == "12.1"
387
- @ohai[:platform_family].should == "suse"
367
+ @plugin[:lsb][:release] = "12.1"
368
+ File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
369
+ @plugin.run
370
+ @plugin[:platform].should == "suse"
371
+ @plugin[:platform_version].should == "12.1"
372
+ @plugin[:platform_family].should == "suse"
388
373
  end
389
374
  end
390
375
 
391
376
  describe "without lsb_release results" do
392
377
  before(:each) do
393
- @ohai.lsb = nil
394
- end
395
-
396
- it "should check for the existance of SuSE-release" do
397
- @ohai._require_plugin("linux::platform")
378
+ @plugin.lsb = nil
398
379
  end
399
380
 
400
381
  it "should set platform and platform_family to suse and bogus verion to 10.0" do
401
382
  File.should_receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
402
- @ohai._require_plugin("linux::platform")
403
- @ohai[:platform].should == "suse"
404
- @ohai[:platform_family].should == "suse"
383
+ @plugin.run
384
+ @plugin[:platform].should == "suse"
385
+ @plugin[:platform_family].should == "suse"
405
386
  end
406
387
 
407
388
  it "should read the version as 10.1 for bogus SLES 10" do
408
389
  File.should_receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
409
- @ohai._require_plugin("linux::platform")
410
- @ohai[:platform].should == "suse"
411
- @ohai[:platform_version].should == "10.1"
412
- @ohai[:platform_family].should == "suse"
390
+ @plugin.run
391
+ @plugin[:platform].should == "suse"
392
+ @plugin[:platform_version].should == "10.1"
393
+ @plugin[:platform_family].should == "suse"
413
394
  end
414
395
 
415
396
  it "should read the version as 11.2" do
416
397
  File.should_receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
417
- @ohai._require_plugin("linux::platform")
418
- @ohai[:platform].should == "suse"
419
- @ohai[:platform_version].should == "11.2"
420
- @ohai[:platform_family].should == "suse"
398
+ @plugin.run
399
+ @plugin[:platform].should == "suse"
400
+ @plugin[:platform_version].should == "11.2"
401
+ @plugin[:platform_family].should == "suse"
421
402
  end
422
403
 
423
404
  it "[OHAI-272] should read the version as 11.3" do
424
- File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
425
- @ohai._require_plugin("linux::platform")
426
- @ohai[:platform].should == "suse"
427
- @ohai[:platform_version].should == "11.3"
428
- @ohai[:platform_family].should == "suse"
405
+ File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
406
+ @plugin.run
407
+ @plugin[:platform].should == "suse"
408
+ @plugin[:platform_version].should == "11.3"
409
+ @plugin[:platform_family].should == "suse"
429
410
  end
430
411
 
431
412
  it "[OHAI-272] should read the version as 9.1" do
432
- File.should_receive(:read).with("/etc/SuSE-release").and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
433
- @ohai._require_plugin("linux::platform")
434
- @ohai[:platform].should == "suse"
435
- @ohai[:platform_version].should == "9.1"
436
- @ohai[:platform_family].should == "suse"
413
+ File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
414
+ @plugin.run
415
+ @plugin[:platform].should == "suse"
416
+ @plugin[:platform_version].should == "9.1"
417
+ @plugin[:platform_family].should == "suse"
437
418
  end
438
419
 
439
420
  it "[OHAI-272] should read the version as 11.4" do
440
- File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
441
- @ohai._require_plugin("linux::platform")
442
- @ohai[:platform].should == "suse"
443
- @ohai[:platform_version].should == "11.4"
444
- @ohai[:platform_family].should == "suse"
421
+ File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
422
+ @plugin.run
423
+ @plugin[:platform].should == "suse"
424
+ @plugin[:platform_version].should == "11.4"
425
+ @plugin[:platform_family].should == "suse"
445
426
  end
446
427
  end
447
428
  end