summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-06-26 12:07:29 -0700
committerDaniel DeLeo <dan@opscode.com>2010-06-26 12:07:29 -0700
commitca3582d292fff9a6ab4d1828a0adea2b8828ca9d (patch)
tree86f0b2febd5884e2286476e8f00ac80b5003ba5d
parent9965f1d143bf27a573af88b535bd2e4bfea4b2a0 (diff)
parent6816ff0af993b554a3f0b9f44c3ec32ec751159d (diff)
downloadchef-ca3582d292fff9a6ab4d1828a0adea2b8828ca9d.tar.gz
Merge branch 'CHEF-1388'
-rw-r--r--chef/lib/chef/monkey_patches/dir.rb18
-rw-r--r--chef/lib/chef/monkey_patches/string.rb18
-rw-r--r--chef/lib/chef/monkey_patches/tempfile.rb18
-rw-r--r--chef/lib/chef/rest.rb1
-rw-r--r--chef/lib/chef/rest/rest_request.rb3
-rw-r--r--features/data/config/client.rb3
-rw-r--r--features/search/search_data.feature2
-rw-r--r--features/steps/node_steps.rb4
-rw-r--r--features/support/env.rb24
9 files changed, 84 insertions, 7 deletions
diff --git a/chef/lib/chef/monkey_patches/dir.rb b/chef/lib/chef/monkey_patches/dir.rb
index 5dbffb7eab..100c099202 100644
--- a/chef/lib/chef/monkey_patches/dir.rb
+++ b/chef/lib/chef/monkey_patches/dir.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.
+#
+
# Adds a Dir.glob to Ruby 1.8.5, for compat
if RUBY_VERSION < "1.8.6" || RUBY_PLATFORM =~ /mswin|mingw32|windows/
class Dir
diff --git a/chef/lib/chef/monkey_patches/string.rb b/chef/lib/chef/monkey_patches/string.rb
index c5fc954b2c..6518c196d9 100644
--- a/chef/lib/chef/monkey_patches/string.rb
+++ b/chef/lib/chef/monkey_patches/string.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.
+#
+
# On ruby 1.9, Strings are aware of multibyte characters, so #size and length
# give the actual number of characters. In Chef::REST, we need the bytesize
# so we can correctly set the Content-Length headers, but ruby 1.8.6 and lower
diff --git a/chef/lib/chef/monkey_patches/tempfile.rb b/chef/lib/chef/monkey_patches/tempfile.rb
index 52a61ec507..869cba051b 100644
--- a/chef/lib/chef/monkey_patches/tempfile.rb
+++ b/chef/lib/chef/monkey_patches/tempfile.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.
+#
+
# Tempfile has a horrible bug where it causes an IOError: closed stream in its
# finalizer, leading to intermittent application crashes with confusing stack
# traces. Here we monkey patch the fix into place. You can track the bug on
diff --git a/chef/lib/chef/rest.rb b/chef/lib/chef/rest.rb
index 8d6c10fe3d..d4813d12cf 100644
--- a/chef/lib/chef/rest.rb
+++ b/chef/lib/chef/rest.rb
@@ -24,7 +24,6 @@ require 'net/https'
require 'uri'
require 'json'
require 'tempfile'
-require 'chef/version'
require 'chef/api_client'
require 'chef/rest/auth_credentials'
require 'chef/rest/rest_request'
diff --git a/chef/lib/chef/rest/rest_request.rb b/chef/lib/chef/rest/rest_request.rb
index 4ef743dce1..fb5aaedd72 100644
--- a/chef/lib/chef/rest/rest_request.rb
+++ b/chef/lib/chef/rest/rest_request.rb
@@ -23,6 +23,7 @@
require 'uri'
require 'net/http'
require 'chef/rest/cookie_jar'
+require 'chef/version'
class Chef
class REST
@@ -165,4 +166,4 @@ class Chef
end
end
-end \ No newline at end of file
+end
diff --git a/features/data/config/client.rb b/features/data/config/client.rb
index 51f7e10290..c194351c54 100644
--- a/features/data/config/client.rb
+++ b/features/data/config/client.rb
@@ -19,3 +19,6 @@ validation_key File.join(systmpdir, "validation.pem")
client_key File.join(systmpdir, "client.pem")
cache_type "Memory"
cache_options({})
+
+Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners'
+Ohai::Config[:disabled_plugins ]<< 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java'
diff --git a/features/search/search_data.feature b/features/search/search_data.feature
index 3d49e18810..1378c96b6c 100644
--- a/features/search/search_data.feature
+++ b/features/search/search_data.feature
@@ -10,7 +10,7 @@ Feature: Search Data
And a 'data_bag' named 'users' exists
And a 'data_bag_item' named 'francis' exists
And a 'data_bag_item' named 'axl_rose' exists
- When I run the chef-client
+ When I run the chef-client with '-l debug'
Then the run should exit '0'
And a file named 'francis' should exist
And a file named 'axl_rose' should exist
diff --git a/features/steps/node_steps.rb b/features/steps/node_steps.rb
index 0c10475736..1bf1055a13 100644
--- a/features/steps/node_steps.rb
+++ b/features/steps/node_steps.rb
@@ -20,7 +20,7 @@
# Given
###
Given /^a validated node$/ do
- client.run_ohai
+ # client should have cached ohai assigned to it
client.determine_node_name
client.register
client.build_node
@@ -28,7 +28,7 @@ Given /^a validated node$/ do
end
Given /^a validated node with an empty runlist$/ do
- client.run_ohai
+ # client should have cached ohai assigned to it
client.determine_node_name
client.register
client.build_node
diff --git a/features/support/env.rb b/features/support/env.rb
index 8a985066aa..e8c54d4002 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -48,6 +48,9 @@ require 'restclient'
include Chef::Mixin::ShellOut
+Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners'
+Ohai::Config[:disabled_plugins ]<< 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java'
+
ENV['LOG_LEVEL'] ||= 'error'
def setup_logging
@@ -94,7 +97,7 @@ def create_databases
cmd = [KNIFE_CMD, "cookbook", "upload", "-a", "-o", INTEGRATION_COOKBOOKS, "-u", "validator", "-k", File.join(Dir.tmpdir, "validation.pem"), "-c", KNIFE_CONFIG]
Chef::Log.info("Uploading fixture cookbooks with #{cmd.join(' ')}")
- shell_out!(*cmd)
+ shell_out!(*cmd, :timeout => 120)
end
def prepare_replicas
@@ -133,8 +136,25 @@ module ChefWorld
:chef_args, :config_file, :stdout, :stderr, :status, :exception,
:gemserver_thread, :sandbox_url
+ def self.ohai
+ # ohai takes a while, so only ever run it once.
+ @ohai ||= begin
+ o = Ohai::System.new
+ o.all_plugins
+ o
+ end
+ end
+
+ def ohai
+ ChefWorld.ohai
+ end
+
def client
- @client ||= Chef::Client.new
+ @client ||= begin
+ c = Chef::Client.new
+ c.ohai = ohai
+ c
+ end
end
def rest