summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-12-03 10:38:05 -0800
committerTim Smith <tsmith@chef.io>2017-12-03 10:38:05 -0800
commitac55074cd2877e7144f348d8fa1e0cb1d3249f4d (patch)
treec7b6c5584a8c13b09f6166420642d4581f904377
parent33f711936b9b8dfe0c5a6c5decef3d43c207ddee (diff)
downloadohai-simulation.tar.gz
Remove unused platform simulation specssimulation
We never actually completed this work and started using these. It's just dead code in the repo. We do need integration testing on Ohai, but I'm not sure if this gets us much since we're doing the same sort of hack on shell out in our existing "unit" (yes in quotes) tests. What we could really use is a true integration test where we run ohai on various platforms and expect back certain output. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--platform_simulation_specs/README.md5
-rwxr-xr-xplatform_simulation_specs/common/lib/libc.so.66
-rw-r--r--platform_simulation_specs/common/lib/libc.so.6.bat1
-rwxr-xr-xplatform_simulation_specs/common/lib64/libc.so.66
-rw-r--r--platform_simulation_specs/common/lib64/libc.so.6.bat1
-rw-r--r--platform_simulation_specs/common/ohai_plugin_common.rb283
-rw-r--r--platform_simulation_specs/common/ohai_plugin_common_spec.rb52
-rw-r--r--platform_simulation_specs/plugins/c_spec.rb55
-rw-r--r--platform_simulation_specs/plugins/erlang_spec.rb38
-rw-r--r--platform_simulation_specs/plugins/go_spec.rb30
-rw-r--r--platform_simulation_specs/plugins/groovy_spec.rb39
-rw-r--r--platform_simulation_specs/plugins/java_spec.rb66
-rw-r--r--platform_simulation_specs/plugins/kernel_spec.rb30
-rw-r--r--platform_simulation_specs/plugins/lua_spec.rb37
-rw-r--r--platform_simulation_specs/plugins/nodejs_spec.rb35
-rw-r--r--platform_simulation_specs/plugins/perl_spec.rb42
-rw-r--r--platform_simulation_specs/plugins/php_spec.rb39
-rw-r--r--platform_simulation_specs/plugins/python_spec.rb36
-rw-r--r--platform_simulation_specs/tools/grab_data.rb105
19 files changed, 0 insertions, 906 deletions
diff --git a/platform_simulation_specs/README.md b/platform_simulation_specs/README.md
deleted file mode 100644
index 3a5a1c15..00000000
--- a/platform_simulation_specs/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Ohai Platform Simulation Tests
-
-These tests are experimental tests that test Ohai simulating platforms.
-
-Currently these tests are disabled. \ No newline at end of file
diff --git a/platform_simulation_specs/common/lib/libc.so.6 b/platform_simulation_specs/common/lib/libc.so.6
deleted file mode 100755
index e20d9e88..00000000
--- a/platform_simulation_specs/common/lib/libc.so.6
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby
-
-require 'yaml'
-require '/Users/serdar/oc/ohai/spec/platform_simulation/common/ohai_plugin_common.rb'
-
-OhaiPluginCommon.fake_command OhaiPluginCommon.read_output( '___lib___libc.so.6' ), 'centos-5.5', 'x64', []
diff --git a/platform_simulation_specs/common/lib/libc.so.6.bat b/platform_simulation_specs/common/lib/libc.so.6.bat
deleted file mode 100644
index 44bc5cd9..00000000
--- a/platform_simulation_specs/common/lib/libc.so.6.bat
+++ /dev/null
@@ -1 +0,0 @@
-@/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby /Users/serdar/oc/ohai/spec/platform_simulation/common/lib/libc.so.6 %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/platform_simulation_specs/common/lib64/libc.so.6 b/platform_simulation_specs/common/lib64/libc.so.6
deleted file mode 100755
index d84e8fdd..00000000
--- a/platform_simulation_specs/common/lib64/libc.so.6
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby
-
-require 'yaml'
-require '/Users/serdar/oc/ohai/spec/platform_simulation/common/ohai_plugin_common.rb'
-
-OhaiPluginCommon.fake_command OhaiPluginCommon.read_output( '___lib64___libc.so.6' ), 'centos-5.5', 'x64', []
diff --git a/platform_simulation_specs/common/lib64/libc.so.6.bat b/platform_simulation_specs/common/lib64/libc.so.6.bat
deleted file mode 100644
index abbadd24..00000000
--- a/platform_simulation_specs/common/lib64/libc.so.6.bat
+++ /dev/null
@@ -1 +0,0 @@
-@/Users/serdar/.rbenv/versions/1.9.3-p385/bin/ruby /Users/serdar/oc/ohai/spec/platform_simulation/common/lib64/libc.so.6 %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/platform_simulation_specs/common/ohai_plugin_common.rb b/platform_simulation_specs/common/ohai_plugin_common.rb
deleted file mode 100644
index 7421d92f..00000000
--- a/platform_simulation_specs/common/ohai_plugin_common.rb
+++ /dev/null
@@ -1,283 +0,0 @@
-
-# Author:: Theodore Nordsieck <theo@chef.io>
-# Copyright:: Copyright (c) 2013-2016 Chef Software, 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"
-require "ffi_yajl"
-require "ohai"
-require "yaml"
-
-module OhaiPluginCommon
- FAKE_SEP = "___"
-
- def fake_command(data, platform, arch, env)
- # If the platform or architecture aren't set, take the first one
- # platform = ENV['OHAI_TEST_PLATFORM']
- # arch = ENV['OHAI_TEST_ARCH']
- # env = ENV['OHAI_TEST_ENVIRONMENT']
-
- # env = JSON.load(env)
-
- argv = ARGV.map { |arg| ( /\ / =~ arg ) ? "\"" + arg + "\"" : arg }.join " "
- match = data[platform][arch].select { |v| v[:params] == argv && v[:env] == env }
-
- raise "No canned output for these settings." if match.empty?
- raise "More than one set of data matches these parameters." if match.size > 1
- match = match[0]
-
- $stdout.puts match[:stdout] if match[:stdout] != ""
- $stderr.puts match[:stderr] if match[:stderr] != ""
- exit match[:exit_status]
- end
-
- def data_path
- File.expand_path(File.dirname(__FILE__) + "../../../data/plugins")
- end
-
- def get_path(path = "")
- File.expand_path(File.dirname(__FILE__) + path)
- end
-
- def plugin_path
- get_path "/../../../lib/ohai/plugins"
- end
-
- # read in the data file for fake executables
- def read_output( cmd, path = "#{data_path}" )
- #using an anonymous class to minimize scoping issues.
- @data = Class.new do
- #DSL - make a list of hashes with
- def push(param, value)
- @instances ||= []
- @instances[0] ||= {}
- current = {}
- current = @instances.pop if @instances.last[param].nil?
- current[param] = value
- @instances << current
- end
- @methods = [:platform, :arch, :env, :params, :stdout, :stderr, :exit_status]
- @methods.each { |m| send(:define_method, m.to_s) { |text| push m.to_sym, text } }
-
- #Format data into a form the rest of the app expects
- def process
- data = {}
-
- @instances ||= []
-
- @instances.each do |i|
- data[i[:platform]] ||= {}
- data[i[:platform]][i[:arch]] ||= []
- data[i[:platform]][i[:arch]] << i.reject { |k, v| k == :platform || k == :arch }
- end
- data
- end
- end
-
- @data = @data.new
- @data.instance_eval( File.read( "#{path}/#{cmd}.output" ))
- @data.process
- end
-
- # output a fake executable case in the DSL
- def to_fake_exe_format(platform, arch, env, params, stdout, stderr, exit_status)
- e = FFI_Yajl::Encoder.new
- <<-eos
-platform "#{platform}"
-arch "#{arch}"
-env #{env}
-params #{e.encode( params )}
-stdout #{e.encode( stdout )}
-stderr #{e.encode( stderr )}
-exit_status #{exit_status}
-eos
- end
-
- # prep fake executable data for writing to a file
- def data_to_string(data)
- a = data.map do |platform, v|
- v.map do |arch, v|
- v.map do |e|
- to_fake_exe_format platform, arch, e[:env], e[:params], e[:stdout], e[:stderr], e[:exit_status]
- end
- end
- end
- a.flatten.join( "\n" )
- end
-
- def create_exe(cmd, path, platform, arch, env)
- # Create a list of directories needed to be created before the file is created.
- # Assume that the #{path} directory exists, but that any directories included in #{cmd} may or may not.
- dir_list = cmd.split(/\//).inject( [] ) do |acc, ele|
- if acc == []
- acc << ele
- else
- acc << File.join( acc.last, ele )
- end
- end.reject { |e| e == "" }
- dir_list = dir_list.map { |e| File.join( path, e ) }
- cmd_path = dir_list.pop
- bat_path = cmd_path + ".bat"
-
- # Ensure the directories in #{cmd} get created - this is for absolute path support
- # This is a workaround: Dir.exists? doesn't exist in 1.8.7
- dir_list.each do |e|
- exists = false
- begin
- Dir.new e
- exists = true
- rescue Errno::ENOENT
- end
- Dir.mkdir( e ) unless exists
- end
-
- #fake exe
- file = <<-eof
-#!#{File.join( RbConfig::CONFIG['bindir'], 'ruby' )}
-
-require 'yaml'
-require '#{path}/ohai_plugin_common.rb'
-
-OhaiPluginCommon.fake_command OhaiPluginCommon.read_output( '#{cmd.gsub( /\//, OhaiPluginCommon::FAKE_SEP )}' ), '#{platform}', '#{arch}', #{FFI_Yajl::Encoder.encode( env )}
-eof
- File.open(cmd_path, "w") { |f| f.puts file }
-
- #.bat shim for windows
- bat = <<-eof
-@#{File.join( RbConfig::CONFIG['bindir'], 'ruby' )} #{cmd_path} %1 %2 %3 %4 %5 %6 %7 %8 %9
-eof
- File.open(bat_path, "w") { |f| f.puts bat }
-
- # sleep 0.01 until File.exists? cmd_path
- Mixlib::ShellOut.new("chmod 755 #{cmd_path}").run_command
- end
-
- # delete all files and folders in path except those that match
- # the specified regex
- def clean_path( path, regex )
- Dir.glob( File.join( path, "*" )).
- reject { |e| e =~ regex }.
- each { |e| Mixlib::ShellOut.new( "rm -rf #{e}" ).run_command }
- end
-
- module_function( :fake_command, :data_path, :get_path, :read_output, :clean_path,
- :to_fake_exe_format, :data_to_string, :create_exe, :plugin_path )
-end
-
-# checks to see if the elements in test are also in source. Recursively decends into Hashes.
-# nil values in test match against both nil and non-existance in source.
-def subsumes?(source, test, path = [], &block)
- if source.is_a?( Hash ) && test.is_a?( Hash )
- test.all? { |k, v| subsumes?( source[k], v, path.clone << k, &block ) }
- else
- yield(path, source, test) if block
- source == test
- end
-end
-
-# test that a plugin conforms populates ohai with the correct data
-def test_plugin(plugin_names, cmd_list)
- #
- # Current platform simulation tests are disabled. Remove the line below
- # in order to enable the platform simulation tests.
- #
- return
-
- # clean the path directory, in case a previous test was interrupted
- OhaiPluginCommon.clean_path OhaiPluginCommon.get_path, /^.*\.rb$/ # rubocop:disable Lint/UnreachableCode
-
- l = lambda do |*args|
- platforms = args[0]
- archs = args[1]
- envs = args[2]
- ohai = args[3]
- pending_status = args[4] || nil
- platforms.each do |platform|
- describe "when the platform is #{platform}" do
- archs.each do |arch|
- describe "and the architecture is #{arch}" do
- envs.each do |env|
- describe "and the environment is #{env}" do
- path = OhaiPluginCommon.get_path
- cmd_not_found = Set.new
-
- begin
- # preserve the path
- old_path = ENV[ "PATH" ]
-
- # create fake executables
- cmd_list.each do |c|
- data = OhaiPluginCommon.read_output( c.gsub( /\//, OhaiPluginCommon::FAKE_SEP ))
-
- data = data[platform][arch].select { |f| f[:env] == env }
- if data.all? { |f| ( /not found/ =~ f[:stderr] ) && f[:exit_status] == 127 }
- cmd_not_found.add c
- else
- OhaiPluginCommon.create_exe c, path, platform, arch, env
- end
- end
-
- # capture all executions in path dir
- ENV["PATH"] = path
- Ohai.instance_eval do
- def self.abs_path( abs_path )
- File.join( OhaiPluginCommon.get_path, abs_path )
- end
- end
-
- @ohai = Ohai::System.new
- plugin_names.each do |plugin_name|
- @plugin = get_plugin(plugin_name, @ohai, OhaiPluginCommon.plugin_path)
- raise "Can not find plugin #{plugin_name}" if @plugin.nil?
- @plugin.safe_run
- end
- ensure
- Ohai.instance_eval do
- def self.abs_path( abs_path )
- abs_path
- end
- end
- ENV["PATH"] = old_path
- OhaiPluginCommon.clean_path OhaiPluginCommon.get_path, /^.*\.rb$/
- end
-
- enc = FFI_Yajl::Encoder
- subsumes?( @ohai.data, ohai ) do |path, source, test|
- path_txt = path.map { |p| "[#{enc.encode( p )}]" }.join
- if test.nil?
- txt = "should not set #{path_txt}"
- else
- txt = "should set #{path_txt} to #{enc.encode( test )}"
- end
- it txt do
- pending(pending_status) if !pending_status.nil?
- source.should eq( test )
- end
- end
- end
- end
- end
- end
- end
- end
- end
-
- # human friendlier syntax
- l.instance_exec do
- alias :test :call
- end
- yield l
-end
diff --git a/platform_simulation_specs/common/ohai_plugin_common_spec.rb b/platform_simulation_specs/common/ohai_plugin_common_spec.rb
deleted file mode 100644
index bb407bd4..00000000
--- a/platform_simulation_specs/common/ohai_plugin_common_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-
-# Author:: Theodore Nordsieck <theo@chef.io>
-# Copyright:: Copyright (c) 2013-2016 Chef Software, 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_relative "ohai_plugin_common.rb"
-
-describe OhaiPluginCommon, "subsumes?" do
- before(:each) do
- @hash = { "languages" => { "python" => { "version" => "1.6.2", "type" => "interpreted" } } }
- end
-
- it "returns true if given an exact duplicate" do
- subsumes?( @hash, @hash ).should be_true
- end
-
- it "returns false if given an exact duplicate with extra info" do
- subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => "darwin", "type" => "interpreted" } } } ).should be_false
- subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => {}, "type" => "interpreted" } } } ).should be_false
- subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2", "os" => { "name" => "darwin" }, "type" => "interpreted" } } } ).should be_false
- end
-
- it "returns true if all elements in the second hash are in the first hash" do
- subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2" } } } ).should be_true
- subsumes?( @hash, { "languages" => { "python" => {} } } ).should be_true
- subsumes?( @hash, { "languages" => {} } ).should be_true
- end
-
- it "returns true if the second hash contains a key pointing to a nil where the first hash has nothing" do
- subsumes?( @hash, { "languages" => { "lua" => nil } } ).should be_true
- subsumes?( @hash, { "languages" => { "python" => { "version" => "1.6.2" }, "lua" => nil } } ).should be_true
- end
-
- it "returns false if the second hash has nil in the place of a real value" do
- subsumes?( @hash, { "languages" => { "python" => { "version" => nil } } } ).should be_false
- subsumes?( @hash, { "languages" => { "python" => nil } } ).should be_false
- subsumes?( { "languages" => {} }, { "languages" => nil } ).should be_false
- end
-end
diff --git a/platform_simulation_specs/plugins/c_spec.rb b/platform_simulation_specs/plugins/c_spec.rb
deleted file mode 100644
index a40db825..00000000
--- a/platform_simulation_specs/plugins/c_spec.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Copyright:: Copyright (c) 2010 VMware, 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 "rbconfig"
-require_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin c" do
- test_plugin(%w{languages c}, [ "/lib/libc.so.6", "/lib64/libc.so.6", "gcc", "cl", "devenv.com", "xlc", "cc", "what" ]) do |p|
- p.test([ "centos-5.5" ], [ "x64" ], [[]], { "languages" => { "c" => {
- "gcc" => { "version" => "4.1.2", "description" => "gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)" },
- "glibc" => { "version" => "2.5" , "description" => "GNU C Library stable release version 2.5, by Roland McGrath et al." },
- "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } })
- p.test([ "centos-6.2" ], %w{x86 x64}, [[]], { "languages" => { "c" => {
- "gcc" => { "version" => "4.4.6", "description" => "gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) " },
- "glibc" => { "version" => "2.12", "description" => "GNU C Library stable release version 2.12, by Roland McGrath et al." },
- "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } })
- p.test([ "ubuntu-10.04" ], %w{x86 x64}, [[]],
- { "languages" => { "c" => {
- "glibc" => { "version" => "2.11.1", "description" => "GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) stable release version 2.11.1, by Roland McGrath et al." },
- "gcc" => nil, "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } })
- p.test([ "ubuntu-12.04", "ubuntu-13.04" ], %w{x86 x64}, [[]], { "languages" => { "c" => nil } }, "OC-9993")
- p.test([ "ubuntu-12.10" ], [ "x64" ], [[]], { "languages" => { "c" => nil } }, "OC-9993")
- p.test([ "centos-5.5" ], [ "x64" ], [[ "gcc" ]], { "languages" => { "c" => {
- "gcc" => { "version" => "4.1.2", "description" => "gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)" },
- "glibc" => { "version" => "2.5", "description" => "GNU C Library stable release version 2.5, by Roland McGrath et al." },
- "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } })
- p.test([ "centos-6.2" ], %w{x86 x64}, [[ "gcc" ]], { "languages" => { "c" => {
- "gcc" => { "version" => "4.4.7", "description" => "gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) " },
- "glibc" => { "version" => "2.12", "description" => "GNU C Library stable release version 2.12, by Roland McGrath et al." },
- "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } })
- p.test([ "ubuntu-10.04" ], %w{x86 x64}, [[ "gcc" ]], { "languages" => { "c" => {
- "gcc" => { "version" => "4.4.3", "description" => "gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) " },
- "glibc" => { "version" => "2.11.1", "description" => "GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.12) stable release version 2.11.1, by Roland McGrath et al." },
- "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } })
- p.test([ "ubuntu-12.04" ], %w{x86 x64}, [[ "gcc" ]], { "languages" => { "c" => {
- "gcc" => { "version" => "4.6.3", "description" => "gcc verison 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) " },
- "glibc" => nil, "cl" => nil, "vs" => nil, "xlc" => nil, "sunpro" => nil, "hpcc" => nil } } }, "OC-9993" )
- end
-end
diff --git a/platform_simulation_specs/plugins/erlang_spec.rb b/platform_simulation_specs/plugins/erlang_spec.rb
deleted file mode 100644
index dab10321..00000000
--- a/platform_simulation_specs/plugins/erlang_spec.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Author:: Adam Jacob (<adam@chef.io>)
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2008-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin erlang" do
- test_plugin(%w{languages erlang}, [ "erl" ]) do |p|
- p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "languages" => { "erlang" => nil } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "languages" => { "erlang" => nil } })
- p.test([ "centos-5.9", "centos-6.4" ], %w{x86 x64}, [[ "erlang" ]],
- { "languages" => { "erlang" => { "version" => "5.8.5", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" } } })
- p.test([ "ubuntu-10.04" ], %w{x86 x64}, [[ "erlang" ]],
- { "languages" => { "erlang" => { "version" => "5.7.4", "options" => %w{ASYNC_THREADS HIPE}, "emulator" => "BEAM" } } })
- p.test([ "ubuntu-12.04" ], %w{x86 x64}, [[ "erlang" ]],
- { "languages" => { "erlang" => { "version" => "5.8.5", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" } } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "erlang" ]],
- { "languages" => { "erlang" => { "version" => "5.9.1", "options" => [ "ASYNC_THREADS" ], "emulator" => "BEAM" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/go_spec.rb b/platform_simulation_specs/plugins/go_spec.rb
deleted file mode 100644
index d70372f9..00000000
--- a/platform_simulation_specs/plugins/go_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# Author:: Christian Vozar (<christian@rogueethic.com>)
-# 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin go" do
- test_plugin(%w{languages go}, [ "go" ]) do |p|
- p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "languages" => { "go" => nil } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "languages" => { "go" => nil } })
- p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[ "go" ]],
- { "languages" => { "go" => { "version" => "0.10.2" } } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "go" ]],
- { "languages" => { "go" => { "version" => "0.10.2" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/groovy_spec.rb b/platform_simulation_specs/plugins/groovy_spec.rb
deleted file mode 100644
index ee5ac9a8..00000000
--- a/platform_simulation_specs/plugins/groovy_spec.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Copyright:: Copyright (c) 2009 VMware, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin groovy" do
- test_plugin(%w{languages groovy}, [ "groovy" ]) do |p|
- p.test([ "centos-5.5", "ubuntu-12.10" ], [ "x64" ], [[]],
- { "languages" => { "groovy" => nil } })
- p.test([ "centos-6.2", "ubuntu-12.04", "ubuntu-13.04" ], %w{x86 x64}, [[]],
- { "languages" => { "groovy" => nil } })
- p.test([ "centos-5.5" ], [ "x64" ], [%w{java groovy}],
- { "languages" => { "groovy" => { "version" => "2.1.7" } } })
- p.test([ "centos-6.2" ], %w{x86 x64}, [%w{java groovy}],
- { "languages" => { "groovy" => { "version" => "2.1.7" } } })
- p.test([ "ubuntu-10.04" ], %w{x86 x64}, [%w{java groovy}],
- { "languages" => { "groovy" => { "version" => "1.6.4" } } })
- p.test([ "ubuntu-12.04", "ubuntu-13.04" ], %w{x86 x64}, [%w{java groovy}],
- { "languages" => { "groovy" => { "version" => "1.8.6" } } })
- p.test([ "ubuntu-12.10" ], [ "x64" ], [%w{java groovy}],
- { "languages" => { "groovy" => { "version" => "1.8.6" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/java_spec.rb b/platform_simulation_specs/plugins/java_spec.rb
deleted file mode 100644
index 1d86f24d..00000000
--- a/platform_simulation_specs/plugins/java_spec.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Author:: Benjamin Black (<bb@chef.io>)
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2009-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin java (Java5 Client VM)" do
- test_plugin(%w{languages java}, [ "java" ]) do |p|
- p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "languages" => { "java" => nil } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "languages" => { "java" => nil } })
- p.test([ "centos-5.9" ], [ "x86" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_24",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.41.1.11.11.90.el5_9-i386" },
- "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode" } } } })
- p.test([ "centos-5.9" ], [ "x64" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_24",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.41.1.11.11.90.el5_9-x86_64" },
- "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" } } } })
- p.test([ "centos-6.4" ], [ "x86" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_24",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.62.1.11.11.90.el6_4-i386" },
- "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode" } } } })
- p.test([ "centos-6.4" ], [ "x64" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_24",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.11.11.90)", "build" => "rhel-1.62.1.11.11.90.el6_4-x86_64" },
- "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" } } } })
- p.test([ "ubuntu-10.04" ], [ "x86" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_27",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.10.04.1" },
- "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode, sharing" } } } })
- p.test([ "ubuntu-10.04" ], [ "x64" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_27",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.10.04.1" },
- "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" } } } })
- p.test([ "ubuntu-12.04" ], [ "x86" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_27",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.12.04.1" },
- "hotspot" => { "name" => "OpenJDK Client VM", "build" => "20.0-b12, mixed mode, sharing" } } } })
- p.test([ "ubuntu-12.04" ], [ "x64" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_27",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-0ubuntu0.12.04.1" },
- "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" } } } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [["java"]],
- { "languages" => { "java" => { "version" => "1.6.0_27",
- "runtime" => { "name" => "OpenJDK Runtime Environment (IcedTea6 1.12.5)", "build" => "6b27-1.12.5-1ubuntu1" },
- "hotspot" => { "name" => "OpenJDK 64-Bit Server VM", "build" => "20.0-b12, mixed mode" } } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/kernel_spec.rb b/platform_simulation_specs/plugins/kernel_spec.rb
deleted file mode 100644
index e1bc2aff..00000000
--- a/platform_simulation_specs/plugins/kernel_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Author:: Adam Jacob (<adam@chef.io>)
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2008-2016 Chef Software, 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_relative "../../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "Linux kernel plugin" do
- test_plugin([ "kernel" ], %w{uname env}) do |p|
- p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "kernel" => { "os" => "GNU/Linux" } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "kernel" => { "os" => "GNU/Linux" } })
- end
-end
diff --git a/platform_simulation_specs/plugins/lua_spec.rb b/platform_simulation_specs/plugins/lua_spec.rb
deleted file mode 100644
index cf5e573d..00000000
--- a/platform_simulation_specs/plugins/lua_spec.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2009 VMware, Inc.
-# Copyright:: Copyright (c) 2013-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin lua" do
- test_plugin(%w{languages lua}, [ "lua" ]) do |p|
- p.test([ "centos-6.4" ], %w{x86 x64}, [[], ["lua"]],
- { "languages" => { "lua" => { "version" => "5.1.4" } } })
- p.test([ "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "languages" => { "lua" => nil } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "languages" => { "lua" => nil } })
- p.test([ "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[ "lua" ]],
- { "languages" => { "lua" => { "version" => "5.1.4" } } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [["lua"]],
- { "languages" => { "lua" => { "version" => "5.1.5" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/nodejs_spec.rb b/platform_simulation_specs/plugins/nodejs_spec.rb
deleted file mode 100644
index 3de60fa7..00000000
--- a/platform_simulation_specs/plugins/nodejs_spec.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Author:: Jacques Marneweck (<jacques@powertrip.co.za>)
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) Jacques Marneweck
-# Copyright:: Copyright (c) 2013-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin nodejs" do
- test_plugin(%w{languages nodejs}, [ "node" ]) do |p|
- p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "languages" => { "nodejs" => nil } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "languages" => { "nodejs" => nil } })
- p.test([ "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[ "nodejs" ]],
- { "languages" => { "nodejs" => { "version" => "0.10.2" } } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "nodejs" ]],
- { "languages" => { "nodejs" => { "version" => "0.10.2" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/perl_spec.rb b/platform_simulation_specs/plugins/perl_spec.rb
deleted file mode 100644
index bf4a9330..00000000
--- a/platform_simulation_specs/plugins/perl_spec.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Author:: Joshua Timberman(<joshua@chef.io>)
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2009-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin perl" do
- test_plugin(%w{languages perl}, [ "perl" ]) do |p|
- p.test([ "centos-5.9" ], [ "x86" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.8.8", "archname" => "i386-linux-thread-multi" } } })
- p.test([ "centos-5.9" ], [ "x64" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.8.8", "archname" => "x86_64-linux-thread-multi" } } })
- p.test([ "centos-6.4" ], [ "x86" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "i386-linux-thread-multi" } } })
- p.test([ "centos-6.4" ], [ "x64" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "x86_64-linux-thread-multi" } } })
- p.test([ "ubuntu-10.04" ], [ "x86" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "i486-linux-gnu-thread-multi" } } })
- p.test([ "ubuntu-10.04" ], [ "x64" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.10.1", "archname" => "x86_64-linux-gnu-thread-multi" } } })
- p.test([ "ubuntu-12.04" ], [ "x86" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.14.2", "archname" => "i686-linux-gnu-thread-multi-64int" } } })
- p.test([ "ubuntu-12.04", "ubuntu-13.04" ], [ "x64" ], [[], [ "perl" ]],
- { "languages" => { "perl" => { "version" => "5.14.2", "archname" => "x86_64-linux-gnu-thread-multi" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/php_spec.rb b/platform_simulation_specs/plugins/php_spec.rb
deleted file mode 100644
index 6fe00caf..00000000
--- a/platform_simulation_specs/plugins/php_spec.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2009 VMware, Inc.
-# Copyright:: Copyright (c) 2013-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin php" do
- test_plugin(%w{languages php}, [ "php" ]) do |p|
- p.test([ "centos-5.9", "centos-6.4", "ubuntu-10.04", "ubuntu-12.04" ], %w{x86 x64}, [[]],
- { "languages" => { "php" => nil } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[]],
- { "languages" => { "php" => nil } })
- p.test([ "centos-5.9", "centos-6.4" ], %w{x86 x64}, [[ "php" ]],
- { "languages" => { "php" => { "version" => "5.3.3" } } })
- p.test([ "ubuntu-10.04" ], %w{x86 x64}, [[ "php" ]],
- { "languages" => { "php" => { "version" => "5.3.2-1ubuntu4.20" } } })
- p.test([ "ubuntu-12.04" ], %w{x86 x64}, [[ "php" ]],
- { "languages" => { "php" => { "version" => "5.3.10-1ubuntu3.7" } } })
- p.test([ "ubuntu-13.04" ], [ "x64" ], [[ "php" ]],
- { "languages" => { "php" => { "version" => "5.4.9-4ubuntu2.2" } } })
- end
-end
diff --git a/platform_simulation_specs/plugins/python_spec.rb b/platform_simulation_specs/plugins/python_spec.rb
deleted file mode 100644
index 93cf5728..00000000
--- a/platform_simulation_specs/plugins/python_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Author:: Adam Jacob (<adam@chef.io>)
-# Author:: Theodore Nordsieck (<theo@chef.io>)
-# Copyright:: Copyright (c) 2008-2016 Chef Software, 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_relative "../../spec_helper.rb"
-require_relative "../common/ohai_plugin_common.rb"
-
-describe Ohai::System, "plugin python" do
- test_plugin(%w{languages python}, [ "python" ]) do |p|
- p.test([ "centos-5.9" ], %w{x86 x64}, [[], [ "python" ]],
- { "languages" => { "python" => { "version" => "2.4.3" } } })
- p.test([ "centos-6.4" ], %w{x86 x64}, [[], [ "python" ]],
- { "languages" => { "python" => { "version" => "2.6.6" } } })
- p.test([ "ubuntu-10.04" ], %w{x86 x64}, [[], [ "python" ]],
- { "languages" => { "python" => { "version" => "2.6.5" } } })
- p.test([ "ubuntu-12.04" ], %w{x86 x64}, [[], [ "python" ]],
- { "languages" => { "python" => { "version" => "2.7.3" } } })
- p.test([ "ubuntu-13.04" ], ["x64"], [[], ["python"]],
- { "languages" => { "python" => { "version" => "2.7.4" } } })
- end
-end
diff --git a/platform_simulation_specs/tools/grab_data.rb b/platform_simulation_specs/tools/grab_data.rb
deleted file mode 100644
index 6c419a5f..00000000
--- a/platform_simulation_specs/tools/grab_data.rb
+++ /dev/null
@@ -1,105 +0,0 @@
-
-# Author:: Theodore Nordsieck <theo@chef.io>
-# Copyright:: Copyright (c) 2013-2016 Chef Software, 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.
-#
-
-##
-## This is a simple tool to grab shell command output from the local machine.
-##
-## To use, edit the parameters before running the command. This tool is meant
-## integrate the built in fake command data in spec/data/plugins. If the
-## appropriate yaml file is in this directory, this tool will append/overwrite
-## the data in that file as appropriate.
-##
-
-require "yaml"
-require "set"
-require "mixlib/shellout"
-require "mixlib/cli"
-require "optparse"
-require_relative "../spec/unit/path/ohai_plugin_common.rb"
-
-#get options
-class MyCLI
- include Mixlib::CLI
-
- option :command,
- :short => "-c CMD",
- :long => "--command CMD",
- :description => "The command to run",
- :required => true
-
- option :params,
- :short => "-p [P1,P2,...]",
- :long => "--params [P1,P2,...]",
- :description => "List of parameters, applied one at a time",
- #not sure how to use optparse's array syntax, so this is a hack to reproduce that behavior
- :proc => Proc.new { |s| if s then s.split( "," ) end }
-
- option :platform,
- :short => "-f PLATFORM",
- :long => "--platform PLATFORM",
- :description => "Description of the platform",
- :required => true
-
- option :arch,
- :short => "-a ARCH",
- :long => "--architecture ARCH",
- :description => "Description of the architecture",
- :required => true
-
- option :env,
- :short => "-e [E1,E2,...]",
- :long => "--environment [E1,E2,...]",
- :description => "List of labels that describe the environment",
- :proc => Proc.new { |s| if s then s.split( "," ) end } #same here
-
-end
-cli = MyCLI.new
-cli.parse_options
-cmd, params, platform, arch, env = cli.config[:command], cli.config[:params], cli.config[:platform], cli.config[:arch], cli.config[:env]
-
-# read in data
-# filename = cmd + ".output"
-
-# Mixlib::ShellOut.new("touch #{filename}").run_command
-# data = OhaiPluginCommon.read_output cmd, File.expand_path( File.dirname(__FILE__))
-data ||= {}
-data[platform] ||= {}
-data[platform][arch] ||= []
-params ||= [""]
-env ||= []
-
-# collect output
-
-results = params.map do |p|
- m = Mixlib::ShellOut.new(cmd + " " + p)
- begin
- m.run_command
- { :env => env, :params => p, :stdout => m.stdout, :stderr => m.stderr, :exit_status => m.exitstatus }
- rescue Errno::ENOENT
- { :env => env, :params => p, :stdout => "", :stderr => "command not found", :exit_status => 127 }
- end
-end
-
-# write out data
-
-results.each do |r|
- data[platform][arch] = data[platform][arch].reject { |e| e[:params] == r[:params] && e[:env] == r[:env] }
- data[platform][arch] << r
-end
-
-puts OhaiPluginCommon.data_to_string data