rightscale-ohai 0.3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +201 -0
- data/README.rdoc +98 -0
- data/Rakefile +59 -0
- data/bin/ohai +78 -0
- data/lib/ohai/config.rb +118 -0
- data/lib/ohai/exception.rb +23 -0
- data/lib/ohai/log/formatter.rb +57 -0
- data/lib/ohai/log.rb +89 -0
- data/lib/ohai/mixin/command.rb +203 -0
- data/lib/ohai/mixin/from_file.rb +36 -0
- data/lib/ohai/mixin/string.rb +29 -0
- data/lib/ohai/plugins/cloud.rb +35 -0
- data/lib/ohai/plugins/command.rb +21 -0
- data/lib/ohai/plugins/darwin/filesystem.rb +57 -0
- data/lib/ohai/plugins/darwin/hostname.rb +22 -0
- data/lib/ohai/plugins/darwin/kernel.rb +37 -0
- data/lib/ohai/plugins/darwin/network.rb +187 -0
- data/lib/ohai/plugins/darwin/platform.rb +36 -0
- data/lib/ohai/plugins/darwin/ps.rb +23 -0
- data/lib/ohai/plugins/darwin/ssh_host_key.rb +25 -0
- data/lib/ohai/plugins/darwin/system_profiler.rb +33 -0
- data/lib/ohai/plugins/darwin/uptime.rb +32 -0
- data/lib/ohai/plugins/dmi.rb +59 -0
- data/lib/ohai/plugins/ec2.rb +100 -0
- data/lib/ohai/plugins/erlang.rb +40 -0
- data/lib/ohai/plugins/freebsd/cpu.rb +52 -0
- data/lib/ohai/plugins/freebsd/filesystem.rb +57 -0
- data/lib/ohai/plugins/freebsd/hostname.rb +22 -0
- data/lib/ohai/plugins/freebsd/kernel.rb +37 -0
- data/lib/ohai/plugins/freebsd/memory.rb +50 -0
- data/lib/ohai/plugins/freebsd/network.rb +112 -0
- data/lib/ohai/plugins/freebsd/platform.rb +23 -0
- data/lib/ohai/plugins/freebsd/ps.rb +24 -0
- data/lib/ohai/plugins/freebsd/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/freebsd/uptime.rb +32 -0
- data/lib/ohai/plugins/freebsd/virtualization.rb +66 -0
- data/lib/ohai/plugins/hostname.rb +27 -0
- data/lib/ohai/plugins/java.rb +36 -0
- data/lib/ohai/plugins/kernel.rb +33 -0
- data/lib/ohai/plugins/keys.rb +22 -0
- data/lib/ohai/plugins/languages.rb +21 -0
- data/lib/ohai/plugins/linux/block_device.rb +38 -0
- data/lib/ohai/plugins/linux/cpu.rb +60 -0
- data/lib/ohai/plugins/linux/filesystem.rb +57 -0
- data/lib/ohai/plugins/linux/hostname.rb +26 -0
- data/lib/ohai/plugins/linux/kernel.rb +33 -0
- data/lib/ohai/plugins/linux/lsb.rb +38 -0
- data/lib/ohai/plugins/linux/memory.rb +83 -0
- data/lib/ohai/plugins/linux/network.rb +112 -0
- data/lib/ohai/plugins/linux/platform.rb +43 -0
- data/lib/ohai/plugins/linux/ps.rb +23 -0
- data/lib/ohai/plugins/linux/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/linux/uptime.rb +28 -0
- data/lib/ohai/plugins/linux/virtualization.rb +77 -0
- data/lib/ohai/plugins/network.rb +52 -0
- data/lib/ohai/plugins/ohai_time.rb +21 -0
- data/lib/ohai/plugins/os.rb +43 -0
- data/lib/ohai/plugins/perl.rb +37 -0
- data/lib/ohai/plugins/platform.rb +25 -0
- data/lib/ohai/plugins/python.rb +37 -0
- data/lib/ohai/plugins/rightscale.rb +53 -0
- data/lib/ohai/plugins/ruby.rb +37 -0
- data/lib/ohai/plugins/solaris2/cpu.rb +33 -0
- data/lib/ohai/plugins/solaris2/hostname.rb +22 -0
- data/lib/ohai/plugins/solaris2/kernel.rb +21 -0
- data/lib/ohai/plugins/solaris2/network.rb +141 -0
- data/lib/ohai/plugins/solaris2/platform.rb +33 -0
- data/lib/ohai/plugins/solaris2/ps.rb +23 -0
- data/lib/ohai/plugins/solaris2/ssh_host_key.rb +26 -0
- data/lib/ohai/plugins/uptime.rb +42 -0
- data/lib/ohai/plugins/virtualization.rb +86 -0
- data/lib/ohai/plugins/windows/filesystem.rb +44 -0
- data/lib/ohai/plugins/windows/hostname.rb +25 -0
- data/lib/ohai/plugins/windows/kernel.rb +75 -0
- data/lib/ohai/plugins/windows/network.rb +114 -0
- data/lib/ohai/plugins/windows/platform.rb +26 -0
- data/lib/ohai/system.rb +226 -0
- data/lib/ohai.rb +27 -0
- data/spec/ohai/log/log_formatter_spec.rb +50 -0
- data/spec/ohai/log_spec.rb +63 -0
- data/spec/ohai/mixin/from_file_spec.rb +53 -0
- data/spec/ohai/plugins/cloud_spec.rb +64 -0
- data/spec/ohai/plugins/darwin/hostname_spec.rb +34 -0
- data/spec/ohai/plugins/darwin/kernel_spec.rb +46 -0
- data/spec/ohai/plugins/darwin/platform_spec.rb +67 -0
- data/spec/ohai/plugins/dmi_spec.rb +73 -0
- data/spec/ohai/plugins/ec2_spec.rb +77 -0
- data/spec/ohai/plugins/erlang_spec.rb +63 -0
- data/spec/ohai/plugins/freebsd/hostname_spec.rb +34 -0
- data/spec/ohai/plugins/freebsd/kernel_spec.rb +37 -0
- data/spec/ohai/plugins/freebsd/platform_spec.rb +40 -0
- data/spec/ohai/plugins/hostname_spec.rb +39 -0
- data/spec/ohai/plugins/java_spec.rb +70 -0
- data/spec/ohai/plugins/kernel_spec.rb +43 -0
- data/spec/ohai/plugins/linux/cpu_spec.rb +128 -0
- data/spec/ohai/plugins/linux/hostname_spec.rb +52 -0
- data/spec/ohai/plugins/linux/kernel_spec.rb +31 -0
- data/spec/ohai/plugins/linux/lsb_spec.rb +60 -0
- data/spec/ohai/plugins/linux/platform_spec.rb +81 -0
- data/spec/ohai/plugins/linux/uptime_spec.rb +61 -0
- data/spec/ohai/plugins/linux/virtualization_spec.rb +131 -0
- data/spec/ohai/plugins/ohai_time_spec.rb +46 -0
- data/spec/ohai/plugins/os_spec.rb +58 -0
- data/spec/ohai/plugins/perl_spec.rb +89 -0
- data/spec/ohai/plugins/platform_spec.rb +56 -0
- data/spec/ohai/plugins/python_spec.rb +53 -0
- data/spec/ohai/plugins/rightscale_spec.rb +71 -0
- data/spec/ohai/plugins/ruby_spec.rb +51 -0
- data/spec/ohai/system_spec.rb +130 -0
- data/spec/ohai_spec.rb +27 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +66 -0
- metadata +209 -0
@@ -0,0 +1,23 @@
|
|
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 "command/ps"
|
20
|
+
|
21
|
+
require_plugin 'command'
|
22
|
+
|
23
|
+
command[:ps] = 'ps -ef'
|
@@ -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,28 @@
|
|
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 "uptime", "idletime", "uptime_seconds", "idletime_seconds"
|
20
|
+
|
21
|
+
uptime, idletime = File.open("/proc/uptime").gets.split(" ")
|
22
|
+
uptime_seconds uptime.to_i
|
23
|
+
uptime self._seconds_to_human(uptime.to_i)
|
24
|
+
idletime_seconds idletime.to_i
|
25
|
+
idletime self._seconds_to_human(idletime.to_i)
|
26
|
+
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Thom May (<thom@clearairturbulence.org>)
|
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 "virtualization"
|
20
|
+
|
21
|
+
virtualization Mash.new
|
22
|
+
|
23
|
+
# if it is possible to detect paravirt vs hardware virt, it should be put in
|
24
|
+
# virtualization[:mechanism]
|
25
|
+
if File.exists?("/proc/xen/capabilities") && File.read("/proc/xen/capabilities") =~ /control_d/i
|
26
|
+
virtualization[:emulator] = "xen"
|
27
|
+
virtualization[:role] = "host"
|
28
|
+
elsif File.exists?("/proc/sys/xen/independent_wallclock")
|
29
|
+
virtualization[:emulator] = "xen"
|
30
|
+
virtualization[:role] = "guest"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Detect KVM hosts by kernel module
|
34
|
+
if File.exists?("/proc/modules")
|
35
|
+
if File.read("/proc/modules") =~ /^kvm/
|
36
|
+
virtualization[:emulator] = "kvm"
|
37
|
+
virtualization[:role] = "host"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Detect KVM/QEMU from cpuinfo, report as KVM
|
42
|
+
# We could pick KVM from 'Booting paravirtualized kernel on KVM' in dmesg
|
43
|
+
# 2.6.27-9-server (intrepid) has this / 2.6.18-6-amd64 (etch) does not
|
44
|
+
# It would be great if we could read pv_info in the kernel
|
45
|
+
# Wait for reply to: http://article.gmane.org/gmane.comp.emulators.kvm.devel/27885
|
46
|
+
if File.exists?("/proc/cpuinfo")
|
47
|
+
if File.read("/proc/cpuinfo") =~ /QEMU Virtual CPU/
|
48
|
+
virtualization[:emulator] = "kvm"
|
49
|
+
virtualization[:role] = "guest"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# http://www.dmo.ca/blog/detecting-virtualization-on-linux
|
54
|
+
if File.exists?("/usr/sbin/dmidecode")
|
55
|
+
popen4("dmidecode") do |pid, stdin, stdout, stderr|
|
56
|
+
stdin.close
|
57
|
+
found_virt_manufacturer = nil
|
58
|
+
stdout.each do |line|
|
59
|
+
case line
|
60
|
+
when /Manufacturer: Microsoft/
|
61
|
+
found_virt_manufacturer = "virtualpc"
|
62
|
+
when / Product Name: Virtual Machine/
|
63
|
+
if found_virt_manufacturer == "virtualpc"
|
64
|
+
virtualization[:emulator] = "virtualpc"
|
65
|
+
virtualization[:role] = "guest"
|
66
|
+
end
|
67
|
+
when /Manufacturer: VMware/
|
68
|
+
found_virt_manufacturer = "vmware"
|
69
|
+
when /Product Name: VMware Virtual Platform/
|
70
|
+
if found_virt_manufacturer == "vmware"
|
71
|
+
virtualization[:emulator] = "vmware"
|
72
|
+
virtualization[:role] = "guest"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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 "network", "counters/network"
|
20
|
+
|
21
|
+
network Mash.new unless network
|
22
|
+
network[:interfaces] = Mash.new unless network[:interfaces]
|
23
|
+
counters Mash.new unless counters
|
24
|
+
counters[:network] = Mash.new unless counters[:network]
|
25
|
+
|
26
|
+
require_plugin "hostname"
|
27
|
+
require_plugin "#{os}::network"
|
28
|
+
|
29
|
+
def find_ip_and_mac(addresses)
|
30
|
+
ip = nil; mac = nil
|
31
|
+
addresses.keys.each do |addr|
|
32
|
+
ip = addr if addresses[addr]["family"].eql?("inet")
|
33
|
+
mac = addr if addresses[addr]["family"].eql?("lladdr")
|
34
|
+
break if (ip and mac)
|
35
|
+
end
|
36
|
+
[ip, mac]
|
37
|
+
end
|
38
|
+
|
39
|
+
unless network[:default_interface].nil?
|
40
|
+
im = find_ip_and_mac(network["interfaces"][network[:default_interface]]["addresses"])
|
41
|
+
ipaddress im.shift
|
42
|
+
macaddress im.shift
|
43
|
+
else
|
44
|
+
network["interfaces"].keys.sort.each do |iface|
|
45
|
+
if network["interfaces"][iface]["encapsulation"].eql?("Ethernet")
|
46
|
+
im = find_ip_and_mac(network["interfaces"][iface]["addresses"])
|
47
|
+
ipaddress im.shift
|
48
|
+
macaddress im.shift
|
49
|
+
return if (ipaddress and macaddress)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,21 @@
|
|
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 "ohai_time"
|
20
|
+
|
21
|
+
ohai_time Time.now.to_f
|
@@ -0,0 +1,43 @@
|
|
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 /mswin/
|
32
|
+
# After long discussion in IRC the "powers that be" have come to a concensus
|
33
|
+
# that there is no other Windows platforms exist that were not based on the
|
34
|
+
# Windows_NT kernel, so we herby decree that "windows" will refer to all
|
35
|
+
# platforms built upon the Windows_NT kernel and have access to win32 or win64
|
36
|
+
# subsystems.
|
37
|
+
os "windows"
|
38
|
+
else
|
39
|
+
os languages[:ruby][:host_os]
|
40
|
+
end
|
41
|
+
|
42
|
+
os_version kernel[:release]
|
43
|
+
|
@@ -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,53 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Cary Penniman (<cary@rightscale.com>)
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
provides "rightscale"
|
18
|
+
|
19
|
+
require_plugin "ec2"
|
20
|
+
|
21
|
+
|
22
|
+
def on_rightscale_platform?
|
23
|
+
return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
# this is a hack to convert the RS_<server> tokens into something more
|
28
|
+
# intuative. Hopefully this will be removed when we stop using EC2
|
29
|
+
# userdata.
|
30
|
+
def add_server(key, data)
|
31
|
+
server_names = {
|
32
|
+
"RS_sketchy" => "sketchy",
|
33
|
+
"RS_syslog" => "syslog",
|
34
|
+
"RS_lumberjack" => "lumberjack",
|
35
|
+
"RS_server" => "core"
|
36
|
+
}
|
37
|
+
rightscale[:server][server_names[key]] = data unless (server_names[key] == nil)
|
38
|
+
end
|
39
|
+
|
40
|
+
# add all 'RS_' tokens in userdata, but perform translation for server names
|
41
|
+
def get_data
|
42
|
+
rightscale[:server] = Mash.new
|
43
|
+
data_array = ec2[:userdata].split('&')
|
44
|
+
data_array.each do |d|
|
45
|
+
key, data = d.split('=')
|
46
|
+
rightscale[key.sub(/RS_/,'')] = data unless add_server(key,data)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
if on_rightscale_platform?
|
51
|
+
rightscale Mash.new
|
52
|
+
get_data
|
53
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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
|
+
languages[:ruby][:gems_dir] = %x{#{::Config::CONFIG['bindir']}/gem env gemdir}.chomp!
|
37
|
+
languages[:ruby][:ruby_bin] = File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])
|