ohai 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. data/LICENSE +201 -0
  2. data/README.rdoc +98 -0
  3. data/Rakefile +61 -0
  4. data/bin/ohai +24 -0
  5. data/lib/ohai.rb +27 -0
  6. data/lib/ohai/application.rb +113 -0
  7. data/lib/ohai/config.rb +29 -0
  8. data/lib/ohai/exception.rb +23 -0
  9. data/lib/ohai/log.rb +26 -0
  10. data/lib/ohai/mixin/command.rb +208 -0
  11. data/lib/ohai/mixin/from_file.rb +36 -0
  12. data/lib/ohai/mixin/string.rb +29 -0
  13. data/lib/ohai/plugins/command.rb +21 -0
  14. data/lib/ohai/plugins/darwin/filesystem.rb +57 -0
  15. data/lib/ohai/plugins/darwin/hostname.rb +22 -0
  16. data/lib/ohai/plugins/darwin/kernel.rb +37 -0
  17. data/lib/ohai/plugins/darwin/network.rb +187 -0
  18. data/lib/ohai/plugins/darwin/platform.rb +36 -0
  19. data/lib/ohai/plugins/darwin/ps.rb +23 -0
  20. data/lib/ohai/plugins/darwin/ssh_host_key.rb +25 -0
  21. data/lib/ohai/plugins/darwin/system_profiler.rb +33 -0
  22. data/lib/ohai/plugins/darwin/uptime.rb +32 -0
  23. data/lib/ohai/plugins/dmi.rb +59 -0
  24. data/lib/ohai/plugins/ec2.rb +100 -0
  25. data/lib/ohai/plugins/erlang.rb +40 -0
  26. data/lib/ohai/plugins/freebsd/cpu.rb +52 -0
  27. data/lib/ohai/plugins/freebsd/filesystem.rb +57 -0
  28. data/lib/ohai/plugins/freebsd/hostname.rb +22 -0
  29. data/lib/ohai/plugins/freebsd/kernel.rb +37 -0
  30. data/lib/ohai/plugins/freebsd/memory.rb +50 -0
  31. data/lib/ohai/plugins/freebsd/network.rb +112 -0
  32. data/lib/ohai/plugins/freebsd/platform.rb +23 -0
  33. data/lib/ohai/plugins/freebsd/ps.rb +24 -0
  34. data/lib/ohai/plugins/freebsd/ssh_host_key.rb +26 -0
  35. data/lib/ohai/plugins/freebsd/uptime.rb +32 -0
  36. data/lib/ohai/plugins/freebsd/virtualization.rb +66 -0
  37. data/lib/ohai/plugins/hostname.rb +27 -0
  38. data/lib/ohai/plugins/java.rb +36 -0
  39. data/lib/ohai/plugins/kernel.rb +33 -0
  40. data/lib/ohai/plugins/keys.rb +22 -0
  41. data/lib/ohai/plugins/languages.rb +21 -0
  42. data/lib/ohai/plugins/linux/block_device.rb +38 -0
  43. data/lib/ohai/plugins/linux/cpu.rb +60 -0
  44. data/lib/ohai/plugins/linux/filesystem.rb +57 -0
  45. data/lib/ohai/plugins/linux/hostname.rb +26 -0
  46. data/lib/ohai/plugins/linux/kernel.rb +33 -0
  47. data/lib/ohai/plugins/linux/lsb.rb +38 -0
  48. data/lib/ohai/plugins/linux/memory.rb +83 -0
  49. data/lib/ohai/plugins/linux/network.rb +112 -0
  50. data/lib/ohai/plugins/linux/platform.rb +43 -0
  51. data/lib/ohai/plugins/linux/ps.rb +23 -0
  52. data/lib/ohai/plugins/linux/ssh_host_key.rb +26 -0
  53. data/lib/ohai/plugins/linux/uptime.rb +28 -0
  54. data/lib/ohai/plugins/linux/virtualization.rb +77 -0
  55. data/lib/ohai/plugins/netbsd/cpu.rb +48 -0
  56. data/lib/ohai/plugins/netbsd/filesystem.rb +57 -0
  57. data/lib/ohai/plugins/netbsd/hostname.rb +22 -0
  58. data/lib/ohai/plugins/netbsd/kernel.rb +35 -0
  59. data/lib/ohai/plugins/netbsd/memory.rb +98 -0
  60. data/lib/ohai/plugins/netbsd/network.rb +111 -0
  61. data/lib/ohai/plugins/netbsd/platform.rb +22 -0
  62. data/lib/ohai/plugins/netbsd/ps.rb +24 -0
  63. data/lib/ohai/plugins/netbsd/ssh_host_key.rb +26 -0
  64. data/lib/ohai/plugins/netbsd/uptime.rb +31 -0
  65. data/lib/ohai/plugins/netbsd/virtualization.rb +65 -0
  66. data/lib/ohai/plugins/network.rb +52 -0
  67. data/lib/ohai/plugins/ohai_time.rb +21 -0
  68. data/lib/ohai/plugins/openbsd/cpu.rb +38 -0
  69. data/lib/ohai/plugins/openbsd/filesystem.rb +57 -0
  70. data/lib/ohai/plugins/openbsd/hostname.rb +22 -0
  71. data/lib/ohai/plugins/openbsd/kernel.rb +35 -0
  72. data/lib/ohai/plugins/openbsd/memory.rb +98 -0
  73. data/lib/ohai/plugins/openbsd/network.rb +111 -0
  74. data/lib/ohai/plugins/openbsd/platform.rb +23 -0
  75. data/lib/ohai/plugins/openbsd/ps.rb +24 -0
  76. data/lib/ohai/plugins/openbsd/ssh_host_key.rb +26 -0
  77. data/lib/ohai/plugins/openbsd/uptime.rb +32 -0
  78. data/lib/ohai/plugins/openbsd/virtualization.rb +66 -0
  79. data/lib/ohai/plugins/os.rb +48 -0
  80. data/lib/ohai/plugins/perl.rb +37 -0
  81. data/lib/ohai/plugins/platform.rb +25 -0
  82. data/lib/ohai/plugins/python.rb +37 -0
  83. data/lib/ohai/plugins/ruby.rb +39 -0
  84. data/lib/ohai/plugins/solaris2/cpu.rb +33 -0
  85. data/lib/ohai/plugins/solaris2/hostname.rb +25 -0
  86. data/lib/ohai/plugins/solaris2/kernel.rb +40 -0
  87. data/lib/ohai/plugins/solaris2/network.rb +141 -0
  88. data/lib/ohai/plugins/solaris2/platform.rb +33 -0
  89. data/lib/ohai/plugins/solaris2/ps.rb +23 -0
  90. data/lib/ohai/plugins/solaris2/ssh_host_key.rb +26 -0
  91. data/lib/ohai/plugins/uptime.rb +42 -0
  92. data/lib/ohai/plugins/virtualization.rb +86 -0
  93. data/lib/ohai/plugins/windows/filesystem.rb +44 -0
  94. data/lib/ohai/plugins/windows/hostname.rb +25 -0
  95. data/lib/ohai/plugins/windows/kernel.rb +75 -0
  96. data/lib/ohai/plugins/windows/network.rb +114 -0
  97. data/lib/ohai/plugins/windows/platform.rb +26 -0
  98. data/lib/ohai/system.rb +241 -0
  99. data/spec/ohai/mixin/command_spec.rb +37 -0
  100. data/spec/ohai/mixin/from_file_spec.rb +53 -0
  101. data/spec/ohai/plugins/darwin/hostname_spec.rb +34 -0
  102. data/spec/ohai/plugins/darwin/kernel_spec.rb +46 -0
  103. data/spec/ohai/plugins/darwin/platform_spec.rb +67 -0
  104. data/spec/ohai/plugins/dmi_spec.rb +73 -0
  105. data/spec/ohai/plugins/ec2_spec.rb +81 -0
  106. data/spec/ohai/plugins/erlang_spec.rb +63 -0
  107. data/spec/ohai/plugins/freebsd/hostname_spec.rb +34 -0
  108. data/spec/ohai/plugins/freebsd/kernel_spec.rb +37 -0
  109. data/spec/ohai/plugins/freebsd/platform_spec.rb +40 -0
  110. data/spec/ohai/plugins/hostname_spec.rb +39 -0
  111. data/spec/ohai/plugins/java_spec.rb +70 -0
  112. data/spec/ohai/plugins/kernel_spec.rb +43 -0
  113. data/spec/ohai/plugins/linux/cpu_spec.rb +128 -0
  114. data/spec/ohai/plugins/linux/hostname_spec.rb +52 -0
  115. data/spec/ohai/plugins/linux/kernel_spec.rb +31 -0
  116. data/spec/ohai/plugins/linux/lsb_spec.rb +60 -0
  117. data/spec/ohai/plugins/linux/platform_spec.rb +81 -0
  118. data/spec/ohai/plugins/linux/uptime_spec.rb +61 -0
  119. data/spec/ohai/plugins/linux/virtualization_spec.rb +131 -0
  120. data/spec/ohai/plugins/netbsd/hostname_spec.rb +34 -0
  121. data/spec/ohai/plugins/netbsd/kernel_spec.rb +36 -0
  122. data/spec/ohai/plugins/netbsd/platform_spec.rb +40 -0
  123. data/spec/ohai/plugins/ohai_time_spec.rb +46 -0
  124. data/spec/ohai/plugins/openbsd/hostname_spec.rb +34 -0
  125. data/spec/ohai/plugins/openbsd/kernel_spec.rb +37 -0
  126. data/spec/ohai/plugins/openbsd/platform_spec.rb +40 -0
  127. data/spec/ohai/plugins/os_spec.rb +69 -0
  128. data/spec/ohai/plugins/perl_spec.rb +89 -0
  129. data/spec/ohai/plugins/platform_spec.rb +56 -0
  130. data/spec/ohai/plugins/python_spec.rb +53 -0
  131. data/spec/ohai/plugins/ruby_spec.rb +51 -0
  132. data/spec/ohai/plugins/solaris2/hostname_spec.rb +43 -0
  133. data/spec/ohai/plugins/solaris2/kernel_spec.rb +164 -0
  134. data/spec/ohai/system_spec.rb +130 -0
  135. data/spec/ohai_spec.rb +27 -0
  136. data/spec/rcov.opts +2 -0
  137. data/spec/spec.opts +2 -0
  138. data/spec/spec_helper.rb +68 -0
  139. metadata +240 -0
@@ -0,0 +1,24 @@
1
+ #
2
+ # Author:: Bryan McLellan (btm@loftninjas.org)
3
+ # Copyright:: Copyright (c) 2009 Bryan McLellan
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
+ provides "command/ps"
20
+
21
+ require_plugin 'command'
22
+
23
+ # ps -e requires procfs
24
+ command[:ps] = 'ps -ax'
@@ -0,0 +1,26 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, 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
+ provides "keys/ssh"
20
+
21
+ require_plugin "keys"
22
+
23
+ keys[:ssh] = Mash.new
24
+
25
+ keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
26
+ keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
@@ -0,0 +1,32 @@
1
+ #
2
+ # Author:: Bryan McLellan (btm@loftninjas.org)
3
+ # Copyright:: Copyright (c) 2009 Bryan McLellan
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
+ provides "uptime", "uptime_seconds"
20
+
21
+ # kern.boottime: { sec = 1232765114, usec = 823118 } Fri Jan 23 18:45:14 2009
22
+
23
+ popen4("/sbin/sysctl kern.boottime") do |pid, stdin, stdout, stderr|
24
+ stdin.close
25
+ stdout.each do |line|
26
+ if line =~ /kern.boottime:\D+(\d+)/
27
+ uptime_seconds Time.new.to_i - $1.to_i
28
+ uptime self._seconds_to_human(uptime_seconds)
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,66 @@
1
+ #
2
+ # Author:: Bryan McLellan (btm@loftninjas.org)
3
+ # Copyright:: Copyright (c) 2009 Bryan McLellan
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
+ provides "virtualization"
20
+
21
+ virtualization Mash.new
22
+
23
+ # KVM Host support for FreeBSD is in development
24
+ # http://feanor.sssup.it/~fabio/freebsd/lkvm/
25
+
26
+ # Detect KVM/QEMU from cpu, report as KVM
27
+ # hw.model: QEMU Virtual CPU version 0.9.1
28
+ if from("sysctl -n hw.model") =~ /QEMU Virtual CPU/
29
+ virtualization[:system] = "kvm"
30
+ virtualization[:role] = "guest"
31
+ end
32
+
33
+ # http://www.dmo.ca/blog/detecting-virtualization-on-linux
34
+ if File.exists?("/usr/local/sbin/dmidecode")
35
+ popen4("dmidecode") do |pid, stdin, stdout, stderr|
36
+ stdin.close
37
+ found_virt_manufacturer = nil
38
+ found_virt_product = nil
39
+ stdout.each do |line|
40
+ case line
41
+ when /Manufacturer: Microsoft/
42
+ found_virt_manufacturer = "microsoft"
43
+ when /Product Name: Virtual Machine/
44
+ found_virt_product = "microsoft"
45
+ when /Version: 5.0/
46
+ if found_virt_manufacturer == "microsoft" && found_virt_product == "microsoft"
47
+ virtualization[:system] = "virtualpc"
48
+ virtualization[:role] = "guest"
49
+ end
50
+ when /Version: VS2005R2/
51
+ if found_virt_manufacturer == "microsoft" && found_virt_product == "microsoft"
52
+ virtualization[:system] = "virtualserver"
53
+ virtualization[:role] = "guest"
54
+ end
55
+ when /Manufacturer: VMware/
56
+ found_virt_manufacturer = "vmware"
57
+ when /Product Name: VMware Virtual Platform/
58
+ if found_virt_manufacturer == "vmware"
59
+ virtualization[:system] = "vmware"
60
+ virtualization[:role] = "guest"
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+
@@ -0,0 +1,48 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, 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
+ provides "os", "os_version"
20
+
21
+ require_plugin 'ruby'
22
+ require_plugin 'kernel'
23
+
24
+ case languages[:ruby][:host_os]
25
+ when /darwin(.+)$/
26
+ os "darwin"
27
+ when /linux/
28
+ os "linux"
29
+ when /freebsd(.+)$/
30
+ os "freebsd"
31
+ when /openbsd(.+)$/
32
+ os "openbsd"
33
+ when /netbsd(.+)$/
34
+ os "netbsd"
35
+ when /solaris2\.([\d]+)/
36
+ os "solaris2"
37
+ when /mswin/
38
+ # After long discussion in IRC the "powers that be" have come to a concensus
39
+ # that there is no other Windows platforms exist that were not based on the
40
+ # Windows_NT kernel, so we herby decree that "windows" will refer to all
41
+ # platforms built upon the Windows_NT kernel and have access to win32 or win64
42
+ # subsystems.
43
+ os "windows"
44
+ else
45
+ os languages[:ruby][:host_os]
46
+ end
47
+
48
+ os_version kernel[:release]
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, 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
+ provides "languages/perl"
20
+
21
+ require_plugin "languages"
22
+ output = nil
23
+
24
+ perl = Mash.new
25
+ status = popen4("perl -V:version -V:archname") do |pid, stdin, stdout, stderr|
26
+ stdin.close
27
+ stdout.each do |line|
28
+ case line
29
+ when /^version=\'(.+)\';$/: perl[:version] = $1
30
+ when /^archname=\'(.+)\';$/: perl[:archname] = $1
31
+ end
32
+ end
33
+ end
34
+
35
+ if status == 0
36
+ languages[:perl] = perl
37
+ end
@@ -0,0 +1,25 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, 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
+ provides "platform", "platform_version"
20
+
21
+ require_plugin "#{os}::platform"
22
+
23
+ platform os unless attribute?("platform")
24
+
25
+ platform_version os_version unless attribute?("platform_version")
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Thom May (<thom@clearairturbulence.org>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, 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
+ provides "languages/python"
20
+
21
+ require_plugin "languages"
22
+
23
+ output = nil
24
+
25
+ python = Mash.new
26
+
27
+ status, stdout, stderr = run_command(:no_status_check => true, :command => "python -c \"import sys; print sys.version\"")
28
+
29
+ if status == 0
30
+ output = stdout.split
31
+ python[:version] = output[0]
32
+ if output.length >= 6
33
+ python[:builddate] = "%s %s %s %s" % [output[2],output[3],output[4],output[5].gsub!(/\)/,'')]
34
+ end
35
+
36
+ languages[:python] = python if python[:version] and python[:builddate]
37
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, 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
+ provides "languages/ruby"
20
+
21
+ require_plugin "languages"
22
+
23
+ languages[:ruby] = Mash.new
24
+
25
+ languages[:ruby][:platform] = RUBY_PLATFORM
26
+ languages[:ruby][:version] = RUBY_VERSION
27
+ languages[:ruby][:release_date] = RUBY_RELEASE_DATE
28
+ languages[:ruby][:target] = ::Config::CONFIG['target']
29
+ languages[:ruby][:target_cpu] = ::Config::CONFIG['target_cpu']
30
+ languages[:ruby][:target_vendor] = ::Config::CONFIG['target_vendor']
31
+ languages[:ruby][:target_os] = ::Config::CONFIG['target_os']
32
+ languages[:ruby][:host] = ::Config::CONFIG['host']
33
+ languages[:ruby][:host_cpu] = ::Config::CONFIG['host_cpu']
34
+ languages[:ruby][:host_os] = ::Config::CONFIG['host_os']
35
+ languages[:ruby][:host_vendor] = ::Config::CONFIG['host_vendor']
36
+ if File.exists?("#{::Config::CONFIG['bindir']}/gem")
37
+ languages[:ruby][:gems_dir] = %x{#{::Config::CONFIG['bindir']}/gem env gemdir}.chomp!
38
+ end
39
+ languages[:ruby][:ruby_bin] = File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])
@@ -0,0 +1,33 @@
1
+ #$ psrinfo -v
2
+ #Status of virtual processor 0 as of: 01/11/2009 23:31:55
3
+ # on-line since 05/29/2008 15:05:28.
4
+ # The i386 processor operates at 2660 MHz,
5
+ # and has an i387 compatible floating point processor.
6
+ #Status of virtual processor 1 as of: 01/11/2009 23:31:55
7
+ # on-line since 05/29/2008 15:05:30.
8
+ # The i386 processor operates at 2660 MHz,
9
+ # and has an i387 compatible floating point processor.
10
+ #Status of virtual processor 2 as of: 01/11/2009 23:31:55
11
+ # on-line since 05/29/2008 15:05:30.
12
+ # The i386 processor operates at 2660 MHz,
13
+ # and has an i387 compatible floating point processor.
14
+ #Status of virtual processor 3 as of: 01/11/2009 23:31:55
15
+ # on-line since 05/29/2008 15:05:30.
16
+ # The i386 processor operates at 2660 MHz,
17
+ # and has an i387 compatible floating point processor.
18
+ #Status of virtual processor 4 as of: 01/11/2009 23:31:55
19
+ # on-line since 05/29/2008 15:05:30.
20
+ # The i386 processor operates at 2660 MHz,
21
+ # and has an i387 compatible floating point processor.
22
+ #Status of virtual processor 5 as of: 01/11/2009 23:31:55
23
+ # on-line since 05/29/2008 15:05:30.
24
+ # The i386 processor operates at 2660 MHz,
25
+ # and has an i387 compatible floating point processor.
26
+ #Status of virtual processor 6 as of: 01/11/2009 23:31:55
27
+ # on-line since 05/29/2008 15:05:30.
28
+ # The i386 processor operates at 2660 MHz,
29
+ # and has an i387 compatible floating point processor.
30
+ #Status of virtual processor 7 as of: 01/11/2009 23:31:55
31
+ # on-line since 05/29/2008 15:05:30.
32
+ # The i386 processor operates at 2660 MHz,
33
+ # and has an i387 compatible floating point processor.
@@ -0,0 +1,25 @@
1
+ #
2
+ # Author:: Benjamin Black (<nostromo@gmail.com>)
3
+ # Author:: Daniel DeLeo <dan@kallistec.com>
4
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
+ # Copyright:: Copyright (c) 2009 Daniel DeLeo
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
+ provides "hostname", "fqdn"
22
+
23
+ hostname from("hostname")
24
+
25
+ fqdn(from("hostname") + "." + from("domainname"))
@@ -0,0 +1,40 @@
1
+ #
2
+ # Author:: Benjamin Black (<nostromo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2009 Opscode, 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
+ provides "kernel/os"
20
+
21
+ kernel[:os] = from("uname -s")
22
+
23
+ modules = Mash.new
24
+
25
+ popen4("modinfo") do |pid, stdin, stdout, stderr|
26
+ stdin.close
27
+
28
+ # EXAMPLE:
29
+ # Id Loadaddr Size Info Rev Module Name
30
+ # 6 1180000 4623 1 1 specfs (filesystem for specfs)
31
+ module_description = /[\s]*([\d]+)[\s]+([a-f\d]+)[\s]+([a-f\d]+)[\s]+(?:[\-\d]+)[\s]+(?:[\d]+)[\s]+([\S]+)[\s]+\((.+)\)$/
32
+ stdout.each do |line|
33
+ if mod = module_description.match(line)
34
+ modules[mod[4]] = { :id => mod[1].to_i, :loadaddr => mod[2], :size => mod[3].to_i(16), :description => mod[5]}
35
+ end
36
+ end
37
+ end
38
+
39
+ kernel[:modules] = modules
40
+