diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-08-26 13:34:08 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-08-26 13:35:07 -0700 |
commit | 3586e21a329a62d167e30147391ae92fe4a5f8df (patch) | |
tree | b0a5676fd53e5b5f04334bf17b32397742fa318a | |
parent | 6358ee91286d71a0b3babfd85f659b9f7cf7215b (diff) | |
download | ohai-3586e21a329a62d167e30147391ae92fe4a5f8df.tar.gz |
remove ffi_yajl monkeypatching
also remove last few straggling JSON gem uses. requires a minor version
bump of ohai to pick up DateTime serialization to JSON.
-rw-r--r-- | lib/ohai/hints.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/openstack.rb | 3 | ||||
-rw-r--r-- | lib/ohai/system.rb | 2 | ||||
-rw-r--r-- | ohai.gemspec | 2 | ||||
-rw-r--r-- | platform_simulation_specs/plugins/erlang_spec.rb | 1 | ||||
-rw-r--r-- | spec/unit/plugins/erlang_spec.rb | 13 | ||||
-rw-r--r-- | spec/unit/plugins/php_spec.rb | 1 |
7 files changed, 9 insertions, 15 deletions
diff --git a/lib/ohai/hints.rb b/lib/ohai/hints.rb index fc2af32d..c8b0bc1b 100644 --- a/lib/ohai/hints.rb +++ b/lib/ohai/hints.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'ffi_yajl/json_gem' +require 'ffi_yajl' module Ohai module Hints diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb index 1c6a2c17..28ba3970 100644 --- a/lib/ohai/plugins/openstack.rb +++ b/lib/ohai/plugins/openstack.rb @@ -23,14 +23,13 @@ Ohai.plugin(:Openstack) do include Ohai::Mixin::Ec2Metadata def collect_openstack_metadata(addr = Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, api_version = '2013-04-04') - require 'json' path = "/openstack/#{api_version}/meta_data.json" uri = "http://#{addr}#{path}" begin response = http_client.get_response(URI.parse(uri),nil,nil) case response.code when '200' - JSON.parse(response.body) + FFI_Yajl::Parser.parse(response.body) when '404' Ohai::Log.debug("Encountered 404 response retreiving OpenStack specific metadata path: #{path} ; continuing.") nil diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index 69919da9..511fb9ea 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -29,8 +29,6 @@ require 'ohai/provides_map' require 'ohai/hints' require 'mixlib/shellout' -require 'ffi_yajl/json_gem' - module Ohai class System include Ohai::Mixin::ConstantHelper diff --git a/ohai.gemspec b/ohai.gemspec index 97d61abd..04fc0c63 100644 --- a/ohai.gemspec +++ b/ohai.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.add_dependency "mime-types", "~> 1.16" s.add_dependency "systemu", "~> 2.6.4" - s.add_dependency "ffi-yajl", "~> 1.0" + s.add_dependency "ffi-yajl", "~> 1.1" s.add_dependency "mixlib-cli" s.add_dependency "mixlib-config", "~> 2.0" s.add_dependency "mixlib-log" diff --git a/platform_simulation_specs/plugins/erlang_spec.rb b/platform_simulation_specs/plugins/erlang_spec.rb index fcee1e64..36b709f4 100644 --- a/platform_simulation_specs/plugins/erlang_spec.rb +++ b/platform_simulation_specs/plugins/erlang_spec.rb @@ -17,7 +17,6 @@ # limitations under the License. # -require 'json' require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'common', 'ohai_plugin_common.rb' )) diff --git a/spec/unit/plugins/erlang_spec.rb b/spec/unit/plugins/erlang_spec.rb index 97c5cb14..c017e1ce 100644 --- a/spec/unit/plugins/erlang_spec.rb +++ b/spec/unit/plugins/erlang_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -17,7 +17,6 @@ # limitations under the License. # -require 'json' require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') describe Ohai::System, "plugin erlang" do @@ -28,7 +27,7 @@ describe Ohai::System, "plugin erlang" do @stderr = "Erlang (ASYNC_THREADS,SMP,HIPE) (BEAM) emulator version 5.6.2\n" @plugin.stub(:shell_out).with("erl +V").and_return(mock_shell_out(0, "", @stderr)) end - + it "should get the erlang version from erl +V" do @plugin.should_receive(:shell_out).with("erl +V").and_return(mock_shell_out(0, "", @stderr)) @plugin.run @@ -38,17 +37,17 @@ describe Ohai::System, "plugin erlang" do @plugin.run @plugin.languages[:erlang][:version].should eql("5.6.2") end - + it "should set languages[:erlang][:options]" do @plugin.run @plugin.languages[:erlang][:options].should eql(["ASYNC_THREADS", "SMP", "HIPE"]) end - + it "should set languages[:erlang][:emulator]" do @plugin.run @plugin.languages[:erlang][:emulator].should eql("BEAM") end - + it "should not set the languages[:erlang] tree up if erlang command fails" do @status = 1 @stdin = "" diff --git a/spec/unit/plugins/php_spec.rb b/spec/unit/plugins/php_spec.rb index 0046a665..cced3234 100644 --- a/spec/unit/plugins/php_spec.rb +++ b/spec/unit/plugins/php_spec.rb @@ -18,7 +18,6 @@ # limitations under the License. # -require 'json' require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb')) describe Ohai::System, "plugin php" do |