Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' into jgartrel/master

Conflicts:

	lib/ohai/plugins/python.rb
  • Loading branch information...
commit b6f3827d52444c4730d515ee6e8ca1755c16b5f2 2 parents d39e61a + 00b4c5f
Adam Jacob authored March 06, 2009
29  CHANGELOG
... ...
@@ -1,3 +1,32 @@
  1
+Thu Mar  5 23:15:03 PST 2009
  2
+Release Notes - Ohai - Version 0.2.0
  3
+http://tickets.opscode.com
  4
+
  5
+** Bug
  6
+    * [OHAI-40] - virt and lsb spec's lack use of should/should_not
  7
+    * [OHAI-44] - darwin network.rb should always use -n on relevant commands
  8
+    * [OHAI-45] - vmnet interfaces confuse counter collection on darwin
  9
+    * [OHAI-46] - lo0 counters not collected on darwin
  10
+    * [OHAI-47] - virtualization plugin doesn't correctly detect VMware or VirtualPC platforms
  11
+    * [OHAI-51] - If hostname -f exits with 1, ohai linux hostname plugin vomits
  12
+    * [OHAI-54] - Use IO.read rather than cat
  13
+    * [OHAI-61] - several items in lib/ohai/plugins/freebsd/network.rb have not been converted to Mash
  14
+    * [OHAI-62] - ohai throws stack when python is not in path
  15
+    * [OHAI-63] - ohai does not properly detect 64-bit on darwin
  16
+    * [OHAI-64] - ohai/plugins/freebsd/kernel.rb does not set kernel[:os]
  17
+
  18
+** Improvement
  19
+    * [OHAI-49] - network interface addresses should be stored in a hash not an array
  20
+    * [OHAI-50] - python language plugin
  21
+    * [OHAI-58] - Plugin specifications for FreeBSD
  22
+
  23
+** New Feature
  24
+    * [OHAI-36] - Add libvirt-sourced data to ohai
  25
+    * [OHAI-57] - ohai needs a --debug option to show errors during collection
  26
+
  27
+** Task
  28
+    * [OHAI-55] - Need to grab 'user-data' as well as 'meta-data' for EC2
  29
+
1 30
 Sat Jan 31 19:05:49 PST 2009
2 31
 Release Notes - Ohai - Version 0.1.4
3 32
 http://tickets.opscode.com
2  Rakefile
@@ -5,7 +5,7 @@ require 'date'
5 5
 require 'spec/rake/spectask'
6 6
 
7 7
 GEM = "ohai"
8  
-GEM_VERSION = "0.1.5"
  8
+GEM_VERSION = "0.2.1"
9 9
 AUTHOR = "Adam Jacob"
10 10
 EMAIL = "adam@opscode.com"
11 11
 HOMEPAGE = "http://wiki.opscode.com/display/ohai"
2  lib/ohai.rb
@@ -23,5 +23,5 @@
23 23
 require 'ohai/system'
24 24
 
25 25
 module Ohai
26  
-  VERSION = '0.1.5'
  26
+  VERSION = '0.2.1'
27 27
 end
55  lib/ohai/plugins/darwin/filesystem.rb
... ...
@@ -0,0 +1,55 @@
  1
+#
  2
+# Author:: Benjamin Black (<bb@opscode.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
+fs = Mash.new
  20
+
  21
+block_size = 0
  22
+popen4("df") do |pid, stdin, stdout, stderr|
  23
+  stdin.close
  24
+  stdout.each do |line|
  25
+    case line
  26
+    when /^Filesystem\s+(\d+)-/
  27
+      block_size = $1.to_i
  28
+      next
  29
+    when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
  30
+      filesystem = $1
  31
+      fs[filesystem] = Mash.new
  32
+      fs[filesystem][:block_size] = block_size
  33
+      fs[filesystem][:kb_size] = $2.to_i / (1024 / block_size)
  34
+      fs[filesystem][:kb_used] = $3.to_i / (1024 / block_size)
  35
+      fs[filesystem][:kb_available] = $4.to_i / (1024 / block_size)
  36
+      fs[filesystem][:percent_used] = $5
  37
+      fs[filesystem][:mount] = $6
  38
+    end
  39
+  end
  40
+end
  41
+
  42
+popen4("mount") do |pid, stdin, stdout, stderr|
  43
+  stdin.close
  44
+  stdout.each do |line|
  45
+    if line =~ /^(.+?) on (.+?) \((.+?), (.+?)\)$/
  46
+      filesystem = $1
  47
+      fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
  48
+      fs[filesystem][:mount] = $2
  49
+      fs[filesystem][:fs_type] = $3
  50
+      fs[filesystem][:mount_options] = $4.split(/,\s*/)
  51
+    end
  52
+  end
  53
+end
  54
+
  55
+filesystem fs
16  lib/ohai/plugins/freebsd/filesystem.rb
@@ -28,11 +28,11 @@
28 28
     when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
29 29
       filesystem = $1
30 30
       fs[filesystem] = Mash.new
31  
-      fs[filesystem]['kb_size'] = $2
32  
-      fs[filesystem]['kb_used'] = $3
33  
-      fs[filesystem]['kb_available'] = $4
34  
-      fs[filesystem]['percent_used'] = $5
35  
-      fs[filesystem]['mount'] = $6
  31
+      fs[filesystem][:kb_size] = $2
  32
+      fs[filesystem][:kb_used] = $3
  33
+      fs[filesystem][:kb_available] = $4
  34
+      fs[filesystem][:percent_used] = $5
  35
+      fs[filesystem][:mount] = $6
36 36
     end
37 37
   end
38 38
 end
@@ -44,9 +44,9 @@
44 44
     if line =~ /^(.+?) on (.+?) \((.+?), (.+?)\)$/
45 45
       filesystem = $1
46 46
       fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
47  
-      fs[filesystem]['mount'] = $2
48  
-      fs[filesystem]['fs_type'] = $3
49  
-      fs[filesystem]['mount-options'] = $4.split(/,\s*/)
  47
+      fs[filesystem][:mount] = $2
  48
+      fs[filesystem][:fs_type] = $3
  49
+      fs[filesystem][:mount_options] = $4.split(/,\s*/)
50 50
     end
51 51
   end
52 52
 end
20  lib/ohai/plugins/linux/filesystem.rb
@@ -19,7 +19,7 @@
19 19
 fs = Mash.new
20 20
 
21 21
 # Grab filesystem data from df
22  
-popen4("/bin/df -P") do |pid, stdin, stdout, stderr|
  22
+popen4("df -P") do |pid, stdin, stdout, stderr|
23 23
   stdin.close
24 24
   stdout.each do |line|
25 25
     case line
@@ -28,25 +28,25 @@
28 28
     when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
29 29
       filesystem = $1
30 30
       fs[filesystem] = Mash.new
31  
-      fs[filesystem]['kb_size'] = $2
32  
-      fs[filesystem]['kb_used'] = $3
33  
-      fs[filesystem]['kb_available'] = $4
34  
-      fs[filesystem]['percent_used'] = $5
35  
-      fs[filesystem]['mount'] = $6
  31
+      fs[filesystem][:kb_size] = $2
  32
+      fs[filesystem][:kb_used] = $3
  33
+      fs[filesystem][:kb_available] = $4
  34
+      fs[filesystem][:percent_used] = $5
  35
+      fs[filesystem][:mount] = $6
36 36
     end
37 37
   end
38 38
 end
39 39
 
40 40
 # Grab mount information from /bin/mount
41  
-popen4("/bin/mount -l") do |pid, stdin, stdout, stderr|
  41
+popen4("mount -l") do |pid, stdin, stdout, stderr|
42 42
   stdin.close
43 43
   stdout.each do |line|
44 44
     if line =~ /^(.+?) on (.+?) type (.+?) \((.+?)\)$/
45 45
       filesystem = $1
46 46
       fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
47  
-      fs[filesystem]['mount'] = $2
48  
-      fs[filesystem]['fs_type'] = $3
49  
-      fs[filesystem]['mount-options'] = $4.split(",")
  47
+      fs[filesystem][:mount] = $2
  48
+      fs[filesystem][:fs_type] = $3
  49
+      fs[filesystem][:mount_options] = $4.split(",")
50 50
     end
51 51
   end
52 52
 end
34  spec/ohai/plugins/freebsd/hostname_spec.rb
... ...
@@ -0,0 +1,34 @@
  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
+
  20
+require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
  21
+
  22
+describe Ohai::System, "FreeBSD hostname plugin" do
  23
+  before(:each) do
  24
+    @ohai = Ohai::System.new    
  25
+    @ohai.stub!(:require_plugin).and_return(true)
  26
+    @ohai[:os] = "freebsd"
  27
+    @ohai.stub!(:from).with("hostname -s").and_return("katie")
  28
+    @ohai.stub!(:from).with("hostname -f").and_return("katie.bethell")
  29
+  end
  30
+  
  31
+  it_should_check_from("freebsd::hostname", "hostname", "hostname -s", "katie")
  32
+  
  33
+  it_should_check_from("freebsd::hostname", "fqdn", "hostname -f", "katie.bethell")
  34
+end
37  spec/ohai/plugins/freebsd/kernel_spec.rb
... ...
@@ -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
+
  20
+require File.join(File.dirname(__FILE__), '..', '..', '..', '/spec_helper.rb')
  21
+
  22
+describe Ohai::System, "FreeBSD kernel plugin" do
  23
+  before(:each) do
  24
+    @ohai = Ohai::System.new    
  25
+    @ohai.stub!(:require_plugin).and_return(true)
  26
+    @ohai.stub!(:from).with("uname -i").and_return("foo")
  27
+    @ohai.stub!(:from_with_regex).with("sysctl kern.securlevel").and_return("kern.securelevel: 1")
  28
+    @ohai[:kernel] = Mash.new
  29
+    @ohai[:kernel][:name] = "freebsd"
  30
+  end
  31
+
  32
+  it "should set the kernel_os to the kernel_name value" do
  33
+    @ohai._require_plugin("freebsd::kernel")
  34
+    @ohai[:kernel][:os].should == @ohai[:kernel][:name]
  35
+  end
  36
+
  37
+end
40  spec/ohai/plugins/freebsd/platform_spec.rb
... ...
@@ -0,0 +1,40 @@
  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
+
  20
+require File.join(File.dirname(__FILE__),  '..', '..', '..', '/spec_helper.rb')
  21
+
  22
+describe Ohai::System, "FreeBSD plugin platform" do
  23
+  before(:each) do
  24
+    @ohai = Ohai::System.new    
  25
+    @ohai.stub!(:require_plugin).and_return(true)
  26
+    @ohai.stub!(:from).with("uname -s").and_return("FreeBSD")
  27
+    @ohai.stub!(:from).with("uname -r").and_return("7.1")
  28
+    @ohai[:os] = "freebsd"
  29
+  end
  30
+  
  31
+  it "should set platform to lowercased lsb[:id]" do
  32
+    @ohai._require_plugin("freebsd::platform")        
  33
+    @ohai[:platform].should == "freebsd"
  34
+  end
  35
+  
  36
+  it "should set platform_version to lsb[:release]" do
  37
+    @ohai._require_plugin("freebsd::platform")
  38
+    @ohai[:platform_version].should == "7.1"
  39
+  end
  40
+end  

0 notes on commit b6f3827

Please sign in to comment.
Something went wrong with that request. Please try again.