Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 6 stable #271

Merged
merged 95 commits into from Jan 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
3197677
Disable root_group on Windows
danielsdeleo Jul 17, 2013
add9f1b
Merge branch 'OHAI-490-6-stable' into 6-stable
danielsdeleo Jul 17, 2013
e144815
Bump version for RC4
danielsdeleo Jul 17, 2013
dfe0051
Version update to 6.18.0 GA
danielsdeleo Jul 19, 2013
2740722
Revert "Merge branch 'OHAI-489'"
danielsdeleo Jul 15, 2013
5d968eb
[OHAI-412] Split Ohai::System responsibilites into 2 classes
danielsdeleo Oct 24, 2012
6c6b00f
[OHAI-412] fix uptime plugins for seconds_to_human change
danielsdeleo Oct 24, 2012
898e275
[OHAI-412] fix missing stubs in darwin kernel spec
danielsdeleo Oct 24, 2012
536160f
[OHAI-412] fix missing stub in linux kernel plugin
danielsdeleo Oct 24, 2012
3e8ba6d
Update new specs for plugin class split
danielsdeleo Jul 12, 2013
e14a26c
Fix ruby warnings Config => RbConfig
danielsdeleo Jul 12, 2013
50c12dc
OHAI-412: fix provides collection w/ plugin objects
danielsdeleo Jul 12, 2013
d0ddff9
OHAI-412 allow attribute access via System objects
danielsdeleo Jul 12, 2013
76de215
Configure bundler for HTTPS
danielsdeleo Jul 15, 2013
dd73d9f
Replace all calls to `stub!` with `stub`
danielsdeleo Jul 15, 2013
990ed7c
replace all calls to `mock` with `double`
danielsdeleo Jul 15, 2013
e8bb0f6
Replace deprecated should_receive(:m).any_number_of_times
danielsdeleo Jul 15, 2013
fa99426
include chef as a dev dependency
danielsdeleo Jul 15, 2013
4921379
update chef plugin tests for system/plugin split
danielsdeleo Jul 15, 2013
4c3f98f
Disable root_group on Windows
danielsdeleo Jul 17, 2013
9649a1b
[WIP] - converting sigar -> AIX commands
May 9, 2013
25ebdd1
implement network plugin for aix.
Jul 29, 2013
6a0d1f1
minor code style fix.
Jul 31, 2013
b06225b
aix uptime lookup is similar to solaris one.
Jul 31, 2013
4701461
fix regex for interface info.
Jul 31, 2013
57b509a
AIX plugin for filesystem
deepalijagtap Jul 31, 2013
f608c9c
fix aix uptime.
Aug 7, 2013
117e002
Unit test for Aix plugin uptime.
prabhu-das Aug 7, 2013
8891085
Refactored Aix uptime unit tests.
prabhu-das Aug 7, 2013
cc910c3
Fixed few bugs while unit testing.
prabhu-das Aug 9, 2013
4f3eb6b
Added unit tests for AIX filesystem and network plugins along with a …
prabhu-das Aug 9, 2013
ba5d01c
Added missing tests for netstat -nrf inet6.
prabhu-das Aug 9, 2013
52415bb
ohai plugins hostname and platform specs.
prabhu-das Aug 13, 2013
176c36e
Unit tests for cpu, kernel and platform plugins of AIX.
prabhu-das Aug 16, 2013
7cde661
Fixed the uptime test-case that was failing in jenkins due to missing…
prabhu-das Aug 19, 2013
f1dd92a
Merge pull request #175 from opscode/adamed-oc-9106
Aug 20, 2013
91edd2b
Revert "Merge pull request #175 from opscode/adamed-oc-9106"
Sep 23, 2013
87042c0
Merge pull request #204 from opscode/adamed-6-stable-revert
Sep 23, 2013
1706263
[WIP] - converting sigar -> AIX commands
May 9, 2013
a336ca3
implement network plugin for aix.
Jul 29, 2013
225c6a6
minor code style fix.
Jul 31, 2013
24516f4
aix uptime lookup is similar to solaris one.
Jul 31, 2013
93de51a
fix regex for interface info.
Jul 31, 2013
01b2fd5
AIX plugin for filesystem
deepalijagtap Jul 31, 2013
c146ce6
fix aix uptime.
Aug 7, 2013
85b1453
Unit test for Aix plugin uptime.
prabhu-das Aug 7, 2013
0a5e63b
Refactored Aix uptime unit tests.
prabhu-das Aug 7, 2013
0fa3878
Fixed few bugs while unit testing.
prabhu-das Aug 9, 2013
4ed3712
Added unit tests for AIX filesystem and network plugins along with a …
prabhu-das Aug 9, 2013
c67e12d
Added missing tests for netstat -nrf inet6.
prabhu-das Aug 9, 2013
22944e9
ohai plugins hostname and platform specs.
prabhu-das Aug 13, 2013
85ee00d
Unit tests for cpu, kernel and platform plugins of AIX.
prabhu-das Aug 16, 2013
99b023c
Fixed the uptime test-case that was failing in jenkins due to missing…
prabhu-das Aug 19, 2013
f6e9e57
Port AIX plugins to 6-stable
Sep 24, 2013
ce9a3a4
Merge pull request #207 from opscode/adamed-OC-9106-re-merge
Sep 30, 2013
fee01e2
Add scripts that can run specs on jenkins.
Oct 10, 2013
ede1215
Merge pull request #210 from opscode/enable-manhattan
Oct 10, 2013
7101ea3
new metadata server url
Aug 19, 2013
f58229d
typo
Aug 20, 2013
a400687
small change for hostname
Aug 20, 2013
4a6df5e
updated metadata hostname
Aug 20, 2013
498ada5
GCEL is deprecated
Aug 21, 2013
b0a0fc5
verify gce only by metadata.google.internal, remove dmi check
Sep 17, 2013
59060c1
fix spec errors
Sep 18, 2013
89e2834
fixed spec errors
Sep 18, 2013
76a97db
clarify spec description
Sep 18, 2013
66ea7fc
Restore Ohai 6 compatibility in spec test
Oct 7, 2013
31be96b
Merge branch '6-stable-gce-metadata-update' into 6-stable
Oct 8, 2013
f3dd943
Merge pull request #209 from opscode/adamed-ohai-507-dmi
Oct 10, 2013
ad97317
swap order of redirects
lamont-granquist Oct 11, 2013
923f9fe
fix jenkins script for windows
lamont-granquist Oct 17, 2013
11aed66
Test for LANG=C and input contains UTF-8
lamont-granquist Oct 16, 2013
f1f1317
force encode all strings to UTF-8
lamont-granquist Oct 17, 2013
9b43885
Merge pull request #213 from opscode/lcg/force-encode
lamont-granquist Oct 17, 2013
7ae6c97
Bump version for 6.20.0 RC.
Oct 18, 2013
fc30f4d
OHAI-412 was reverted on the 6-stable branch
btm Oct 18, 2013
8a38584
Pin version of systemu to the same version included in chef.
Oct 18, 2013
2f29a6b
Merge pull request #216 from opscode/systemu-version-pin
Oct 18, 2013
07bd8b7
Bump the version to 6.20.0.rc.1
Oct 21, 2013
4d4a95b
update Ohai man page
Oct 22, 2013
ddc62ba
update man page per OHAI-515
Oct 28, 2013
e5d6920
Bump the version number to 6.20.0 for release.
Oct 31, 2013
0ea49fc
fix to say "The version of Ohai."
Oct 31, 2013
9ff75eb
CHEF-4714
Nov 4, 2013
e5434f5
OHAI-537: Require the os plugin in the hostname plugin
btm Dec 4, 2013
a8237fb
Merge pull request #235 from opscode/OHAI-537
btm Dec 4, 2013
f6ee8d5
Clean up `jenkins_run_tests.bat`
schisamo Dec 5, 2013
798daef
Merge pull request #212 from opscode/lcg/java-stdout-bug
lamont-granquist Jan 9, 2014
c396684
merged most of 6-stable into master. remaining files: lib/ohai/plugin…
Jan 10, 2014
ced089e
convert aix unit tests to version 7 test format
Jan 13, 2014
aa0f287
merge cloud plugin
Jan 13, 2014
4d72ab2
merge gce plugin
Jan 13, 2014
edfedd7
Fix gce plugin and gce plugin specs. The changes are:
Jan 13, 2014
d5f2ee3
Convert AIX plugins to use shell_out.
Jan 13, 2014
594f2e0
Remove the unneeded line from aix filesystem plugin.
Jan 13, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ Gemfile.lock
pkg/
tmp/
coverage/
.DS_Store
104 changes: 86 additions & 18 deletions docs/man/man1/ohai.1
@@ -1,23 +1,91 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
.TH OHAI "1" "April 2009" "ohai" "User Commands"
.TH "OHAI" "1" "Ohai 6.20.0" "" "ohai"
.SH NAME
ohai \- collect system information
.SH SYNOPSIS
.B ohai
[\fIOPTION\fR]...
.SH DESCRIPTION
Information about your system is collected and returned as multidimensional
attributes in a JSON format.
ohai \- The man page for the ohai command line tool.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.sp
Ohai is a tool that is used to detect attributes on a node, and then provide these attributes to the chef\-client at the start of every chef\-client run. Ohai is required by the chef\-client and must be present on a node. The types of attributes Ohai collects include:
.INDENT 0.0
.IP \(bu 2
Platform details
.IP \(bu 2
Networking usage
.IP \(bu 2
Memory usage
.IP \(bu 2
Processor usage
.IP \(bu 2
Kernel data
.IP \(bu 2
Host names
.IP \(bu 2
Fully qualified domain names
.IP \(bu 2
Other configuration details
.UNINDENT
.sp
Attributes that are collected by Ohai are automatic attributes, in that these attributes are used by the chef\-client to ensure that these attributes remain unchanged after the chef\-client is done configuring the node.
.sp
ohai is the command\-line interface for Ohai, a tool that is used to detect attributes on a node, and then provide these attributes to the chef\-client at the start of every chef\-client run.
.SH OPTIONS
.sp
This command has the following syntax:
.sp
.nf
.ft C
ohai OPTION
.ft P
.fi
.sp
This tool has the following options:
.INDENT 0.0
.TP
\fB\-d\fR, \fB\-\-directory\fR NAME
A directory to add to the Ohai search path
.B \fB\-d PATH\fP, \fB\-\-directory PATH\fP
The directory in which Ohai plugins are located. For example: \fB/etc/ohai/plugins\fP.
.TP
\fB\-f\fR, \fB\-\-file\fR NAME
A file to run Ohai against
.B \fB\-f FILE_NAME\fP, \fB\-\-file FILE_NAME\fP
The file against which Ohai will run.
.TP
\fB\-l\fR, \fB\-\-loglevel\fR NAME
Set log level for Ohai
.B \fB\-h\fP, \fB\-\-help\fP
Shows help for the command.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show this message
.IP
.B \fB\-l LEVEL\fP, \fB\-\-log_level LEVEL\fP
The level of logging that will be stored in a log file: \fBdebug\fP, \fBinfo\fP, \fBwarn\fP, \fBerror\fP, or \fBfatal\fP.
.TP
.B \fB\-L LOGLOCATION\fP, \fB\-\-logfile c\fP
The location in which log file output files will be saved. If this location is set to something other than \fBSTDOUT\fP, standard output logging will still be performed (otherwise there would be no output other than to a file).
.TP
.B \fB\-v\fP, \fB\-\-version\fP
The version of Ohai.
.UNINDENT
.SH AUTHOR
Opscode
.\" Generated by docutils manpage writer.
.
7 changes: 4 additions & 3 deletions lib/ohai/mixin/command.rb
Expand Up @@ -124,12 +124,12 @@ def run_command_windows(command, timeout)
#
# Thanks Ara!
def popen4(cmd, args={}, &b)

## Disable garbage collection to work around possible bug in MRI
# Ruby 1.8 suffers from intermittent segfaults believed to be due to GC while IO.select
# See OHAI-330 / CHEF-2916 / CHEF-1305
GC.disable

# Waitlast - this is magic.
#
# Do we wait for the child process to die before we yield
Expand Down Expand Up @@ -325,9 +325,10 @@ def popen4(cmd, args={}, &b)
# have encoding methods.
if "".respond_to?(:force_encoding) && defined?(Encoding)
o.string.force_encoding(Encoding.default_external)
o.string.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '?')
e.string.force_encoding(Encoding.default_external)
e.string.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '?')
end

b[cid, pi[0], o, e]
results.last
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/mixin/gce_metadata.rb
Expand Up @@ -22,7 +22,7 @@ module Mixin
module GCEMetadata

GCE_METADATA_ADDR = "metadata.google.internal" unless defined?(GCE_METADATA_ADDR)
GCE_METADATA_URL = "/0.1/meta-data" unless defined?(GCE_METADATA_URL)
GCE_METADATA_URL = "/computeMetadata/v1beta1/?recursive=true" unless defined?(GCE_METADATA_URL)

def can_metadata_connect?(addr, port, timeout=2)
t = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
Expand Down
53 changes: 53 additions & 0 deletions lib/ohai/plugins/aix/cpu.rb
@@ -0,0 +1,53 @@
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
# Copyright:: Copyright (c) 2013, Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

Ohai.plugin(:CPU) do
provides "cpu"

collect_data(:aix) do
cpu Mash.new

# IBM is the only maker of CPUs for AIX systems.
cpu[:vendor_id] = "IBM"
# At least one CPU will be available, but we'll wait to increment this later.
cpu[:available] = 0
cpu[:total] = 0

cpudevs = shell_out("lsdev -Cc processor").stdout.lines
cpudevs.each do |c|
cpu[:total] += 1
name, status, location = c.split
cpu[name] = Mash.new
cpu[name][:status] = status
cpu[name][:location] = location
if status =~ /Available/
cpu[:available] += 1
lsattr = shell_out("lsattr -El #{name}").stdout.lines
lsattr.each do |attribute|
attrib, value = attribute.split
cpu[name][attrib] = value
end
end
end

# Every AIX system has proc0.
cpu[:model] = cpu[:proc0][:type]
cpu[:mhz] = cpu[:proc0][:frequency].to_i / 1024
end
end
72 changes: 72 additions & 0 deletions lib/ohai/plugins/aix/filesystem.rb
@@ -0,0 +1,72 @@
#
# Author:: Deepali Jagtap (<deepali.jagtap@clogeny.com>)
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
# Copyright:: Copyright (c) 2013 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

Ohai.plugin(:Filesystem) do
provides "filesystem"

collect_data(:aix) do
fs = Mash.new

# Grab filesystem data from df
so = shell_out("df -P")
so.stdout.lines.each do |line|
case line
when /^Filesystem\s+1024-blocks/
next
when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
filesystem = $1
fs[filesystem] = Mash.new
fs[filesystem][:kb_size] = $2
fs[filesystem][:kb_used] = $3
fs[filesystem][:kb_available] = $4
fs[filesystem][:percent_used] = $5
fs[filesystem][:mount] = $6
end
end

# Grab mount information from /bin/mount
so = shell_out("mount")
so.stdout.lines.each do |line|
case line
when /^\s*node/
next
when /^\s*---/
next
when /^\s*\/\w/
fields = line.split
filesystem = fields[0]
fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
fs[filesystem][:mount] = fields[1]
fs[filesystem][:fs_type] = fields[2]
fs[filesystem][:mount_options] = fields[6]
else
fields = line.split
filesystem = fields[0] + ":" + fields[1]
fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
fs[filesystem][:mount] = fields[2]
fs[filesystem][:fs_type] = fields[3]
fs[filesystem][:mount_options] = fields[7]
end
end

# Set the filesystem data
filesystem fs
end
end
31 changes: 31 additions & 0 deletions lib/ohai/plugins/aix/kernel.rb
@@ -0,0 +1,31 @@
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Copyright:: Copyright (c) 2013 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

Ohai.plugin(:Kernel) do
provides "kernel", "kernel/modules"

collect_data(:aix) do
kernel Mash.new

kernel[:name] = shell_out("uname -s").stdout.downcase
kernel[:release] = shell_out("uname -r").stdout
kernel[:version] = shell_out("uname -v").stdout
kernel[:machine] = shell_out("uname -p").stdout
kernel[:modules] = Mash.new
end
end
28 changes: 28 additions & 0 deletions lib/ohai/plugins/aix/memory.rb
@@ -0,0 +1,28 @@
#
# Author:: Joshua Timberman <joshua@opscode.com>
# Copyright:: Copyright (c) 2013, Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

Ohai.plugin(:Memory) do
provides "memory"

collect_data(:aix) do
memory = Mash.new

meminfo = shell_out("svmon -G -O unit=MB,summary=longreal | grep '[0-9]'").stdout
memory[:total], u, memory[:free] = meminfo.split
end
end