diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-12-02 13:02:14 -0800 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-12-02 13:02:14 -0800 |
commit | ef034eebedc3bd26ce4205681da5572d366d25c8 (patch) | |
tree | febd0caa5d86ff17b8e5e1d05a4188ab611bb46d /lib | |
parent | a05b9415793fcd2639760329377525757018270f (diff) | |
download | ohai-ef034eebedc3bd26ce4205681da5572d366d25c8.tar.gz |
Ohai <3 Sid - Apache 2 License
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ohai.rb | 23 | ||||
-rw-r--r-- | lib/ohai/config.rb | 23 | ||||
-rw-r--r-- | lib/ohai/exception.rb | 23 | ||||
-rw-r--r-- | lib/ohai/log.rb | 23 | ||||
-rw-r--r-- | lib/ohai/log/formatter.rb | 23 | ||||
-rw-r--r-- | lib/ohai/mixin/from_file.rb | 23 | ||||
-rw-r--r-- | lib/ohai/plugins/architecture.rb | 41 | ||||
-rw-r--r-- | lib/ohai/plugins/facter.rb | 22 | ||||
-rw-r--r-- | lib/ohai/plugins/kernel.rb | 23 | ||||
-rw-r--r-- | lib/ohai/plugins/lsb.rb | 41 | ||||
-rw-r--r-- | lib/ohai/plugins/os.rb | 65 | ||||
-rw-r--r-- | lib/ohai/system.rb | 23 |
12 files changed, 88 insertions, 265 deletions
diff --git a/lib/ohai.rb b/lib/ohai.rb index c3160472..6af95df5 100644 --- a/lib/ohai.rb +++ b/lib/ohai.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # $:.unshift(File.dirname(__FILE__)) unless diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb index 7f9f899e..bc9ac2f0 100644 --- a/lib/ohai/config.rb +++ b/lib/ohai/config.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # require 'ohai/mixin/from_file' diff --git a/lib/ohai/exception.rb b/lib/ohai/exception.rb index 2b26cfe5..161237dd 100644 --- a/lib/ohai/exception.rb +++ b/lib/ohai/exception.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # module Ohai diff --git a/lib/ohai/log.rb b/lib/ohai/log.rb index 58be3746..2f1432b4 100644 --- a/lib/ohai/log.rb +++ b/lib/ohai/log.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # require 'ohai/config' diff --git a/lib/ohai/log/formatter.rb b/lib/ohai/log/formatter.rb index 7481ef23..75842189 100644 --- a/lib/ohai/log/formatter.rb +++ b/lib/ohai/log/formatter.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # require 'logger' diff --git a/lib/ohai/mixin/from_file.rb b/lib/ohai/mixin/from_file.rb index c55f18aa..30cafb48 100644 --- a/lib/ohai/mixin/from_file.rb +++ b/lib/ohai/mixin/from_file.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # module Ohai diff --git a/lib/ohai/plugins/architecture.rb b/lib/ohai/plugins/architecture.rb deleted file mode 100644 index eabcb5b8..00000000 --- a/lib/ohai/plugins/architecture.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 -# -# Copyright (C) 2008, OpsCode Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -require_plugin "kernel" -require_plugin "os" - -hardware_model from('uname -m') - -case kernel -when "Linux" - case hardware_model - when 'x86_64' - if os == "Debian" - architecture "amd64" - else - architecture "x86_64" - end - when /(i[3456]86|pentium)/ - architecture "i386" - end -else - architecture hardware_model -end diff --git a/lib/ohai/plugins/facter.rb b/lib/ohai/plugins/facter.rb index e9618fb2..d43be0c5 100644 --- a/lib/ohai/plugins/facter.rb +++ b/lib/ohai/plugins/facter.rb @@ -1,3 +1,21 @@ +# +# Author:: Adam Jacob (<adam@opscode.com>) +# Copyright:: Copyright (c) 2008 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. +# + require 'rubygems' begin @@ -8,7 +26,3 @@ begin rescue Exception => e Ohai::Log.debug("Skipping facter facts, as facter is not installed") end - - - - diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb deleted file mode 100644 index 417d550f..00000000 --- a/lib/ohai/plugins/kernel.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 -# -# Copyright (C) 2008, OpsCode Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -kernel from('uname -s') -kernel_release from('uname -r')
\ No newline at end of file diff --git a/lib/ohai/plugins/lsb.rb b/lib/ohai/plugins/lsb.rb deleted file mode 100644 index a208e8dc..00000000 --- a/lib/ohai/plugins/lsb.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 -# -# Copyright (C) 2008, OpsCode Inc. -# -# Portions of this file benifited greatly from Facter -# (http://reductivelabs.com/projects/facter/) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -popen4("lsb_release -a") do |pid, stdin, stdout, stderr| - stdin.close - stdout.each do |line| - case line - when /^Distributor ID:\t(.*)$/ - lsb_dist_id $1 - when /^LSB Version:\t(.*)$/ - lsb_release $1 - when /^Release:\t(.*)$/ - lsb_dist_release $1 - when /^Description:\t(.*)$/ - lsb_dist_description $1 - when /^Codename:\t(.*)$/ - lsb_dist_codename $1 - end - end -end diff --git a/lib/ohai/plugins/os.rb b/lib/ohai/plugins/os.rb deleted file mode 100644 index ef7b1bc2..00000000 --- a/lib/ohai/plugins/os.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# Author:: Adam Jacob (<adam@opscode.com>) -# Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 -# -# Copyright (C) 2008, OpsCode Inc. -# -# Portions of this file benifited greatly from Facter -# (http://reductivelabs.com/projects/facter/) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -require_plugin 'kernel' -require_plugin 'lsb' - -if kernel == "SunOS" - os "Solaris" -elsif kernel == "Linux" - if lsb_dist_id == "Ubuntu" - os "Ubuntu" - os_release from_with_regex('cat /etc/issue', /Ubuntu (\d+.\d+)/) - elsif FileTest.exists?("/etc/debian_version") - os "Debian" - os_release from_with_regex('cat /proc/version', /\(Debian (\d+.\d+).\d+-\d+\)/) - elsif FileTest.exists?("/etc/gentoo-release") - os "Gentoo" - elsif FileTest.exists?("/etc/fedora-release") - os "Fedora" - os_release from_with_regex("cat /etc/fedora-release", /\((Rawhide)\)/, /release (\d+)/) - elsif FileTest.exists?("/etc/mandriva-release") - os "Mandriva" - elsif FileTest.exists?("/etc/mandrake-release") - os "Mandrake" - elsif FileTest.exists?("/etc/redhat-release") - txt = File.read("/etc/redhat-release") - if txt =~ /centos/i - os "CentOS" - os_release from_with_regex("rpm -q centos-release", /release-(\d+)/) - else - os "RedHat" - if txt =~ /\(Rawhide\)$/ - os_release "Rawhide" - elsif txt =~ /release (\d+)/ - os_release $1 - end - end - elsif FileTest.exists?("/etc/SuSE-release") - os "SuSE" - end -else - os kernel - os_release kernel_release -end diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index 17f6cd7f..94f28f96 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -1,22 +1,19 @@ # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 OpsCode, Inc. -# License:: GNU GPL, Version 3 +# License:: Apache License, Version 2.0 # -# Copyright (C) 2008, OpsCode Inc. +# 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 # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# http://www.apache.org/licenses/LICENSE-2.0 # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. # require 'rubygems' |