summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore2
-rw-r--r--acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb1
-rw-r--r--acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb1
-rw-r--r--acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb1
-rw-r--r--acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb61
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--lib/chef/knife/ssh.rb9
-rw-r--r--lib/chef/provider/package/homebrew.rb2
-rw-r--r--lib/chef/version.rb2
-rw-r--r--spec/unit/knife/ssh_spec.rb17
11 files changed, 96 insertions, 4 deletions
diff --git a/VERSION b/VERSION
index 2d313dadea..16b5ee1549 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-12.9.10 \ No newline at end of file
+12.9.13 \ No newline at end of file
diff --git a/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore b/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore
new file mode 100644
index 0000000000..041413b040
--- /dev/null
+++ b/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore
@@ -0,0 +1,2 @@
+nodes/
+tmp/
diff --git a/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb b/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb
new file mode 100644
index 0000000000..4c7c42d9bd
--- /dev/null
+++ b/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb
@@ -0,0 +1 @@
+name 'acceptance-cookbook'
diff --git a/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb b/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb
new file mode 100644
index 0000000000..f890b597fe
--- /dev/null
+++ b/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb
@@ -0,0 +1 @@
+log "NOOP 'destroy' recipe from the acceptance-cookbook in directory '#{node['chef-acceptance']['suite-dir']}'"
diff --git a/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb b/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb
new file mode 100644
index 0000000000..64ef7581ac
--- /dev/null
+++ b/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb
@@ -0,0 +1 @@
+log "NOOP 'provision' recipe from the acceptance-cookbook in directory '#{node['chef-acceptance']['suite-dir']}'"
diff --git a/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb b/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb
new file mode 100644
index 0000000000..7db51450e1
--- /dev/null
+++ b/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb
@@ -0,0 +1,61 @@
+control_group "omnitruck" do
+ require 'chef/http'
+ require 'chef/json_compat'
+
+ # We do this to be able to reference 'rest' both inside and outside example
+ # blocks
+ rest = Chef::HTTP.new("https://omnitruck.chef.io/chef/metadata", headers: {"Accept" => "application/json"})
+ let(:rest) { rest }
+
+ def request(url)
+ Chef::JSONCompat.parse(rest.get(url))["sha256"]
+ end
+
+ shared_examples "32 matches 64" do |version|
+ it "only returns 32-bit packages" do
+ sha32 = request("?p=windows&pv=2012r2&v=#{version}&m=i386")
+ sha64 = request("?p=windows&pv=2012r2&v=#{version}&m=x86_64")
+ expect(sha32).to eq(sha64)
+ end
+ end
+
+ context "from the current channel" do
+ it "returns both 32-bit and 64-bit packages" do
+ # We cannot verify from the returned URL if the package is 64 or 32 bit because
+ # it is often lying, so we just make sure they are different.
+ # The current channel is often cleaned so only the latest builds are in
+ # it, so we just request the latest version instead of trying to check
+ # old versions
+ sha32 = request("?p=windows&pv=2012r2&m=i386&prerelease=true")
+ sha64 = request("?p=windows&pv=2012r2&m=x86_64&prerelease=true")
+ expect(sha32).to_not eq(sha64)
+ end
+ end
+
+ context "from the stable channel" do
+ %w{11 12.3 12.4.2 12.6.0 12.8.1}.each do |version|
+ describe "with version #{version}" do
+ include_examples "32 matches 64", version
+ end
+ end
+
+ begin
+ rest.get("?p=windows&pv=2012r2&v=12.9")
+ describe "with version 12.9" do
+ it "returns both 32-bit and 64-bit packages" do
+ sha32 = request("?p=windows&pv=2012r2&v=12.9&m=i386")
+ sha64 = request("?p=windows&pv=2012r2&v=12.9&m=x86_64")
+ expect(sha32).to_not eq(sha64)
+ end
+ end
+ rescue Net::HTTPServerException => e
+ # Once 12.9 is released this will stop 404ing and the example
+ # will be executed
+ unless e.response.code == "404"
+ raise
+ end
+ end
+
+ end
+
+end
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 39b191b21d..b4b72923ad 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -21,7 +21,7 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "12.9.10"
+ VERSION = "12.9.13"
end
#
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 4ccc300036..a3ed8eb3d0 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -80,6 +80,12 @@ class Chef
:description => "The ssh port",
:proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key.strip }
+ option :ssh_timeout,
+ :short => "-t SECONDS",
+ :long => "--ssh-timeout SECONDS",
+ :description => "The ssh connection timeout",
+ :proc => Proc.new { |key| Chef::Config[:knife][:ssh_timeout] = key.strip }
+
option :ssh_gateway,
:short => "-G GATEWAY",
:long => "--ssh-gateway GATEWAY",
@@ -258,6 +264,9 @@ class Chef
# Handle port overrides for the main connection.
session_opts[:port] = Chef::Config[:knife][:ssh_port] if Chef::Config[:knife][:ssh_port]
session_opts[:port] = config[:ssh_port] if config[:ssh_port]
+ # Handle connection timeout
+ session_opts[:timeout] = Chef::Config[:knife][:ssh_timeout] if Chef::Config[:knife][:ssh_timeout]
+ session_opts[:timeout] = config[:ssh_timeout] if config[:ssh_timeout]
# Create the hostspec.
hostspec = session_opts[:user] ? "#{session_opts.delete(:user)}@#{host}" : host
# Connect a new session on the multi.
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index 853a354b28..a105f6d7d0 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -127,7 +127,7 @@ class Chef
Chef::Log.debug "Executing '#{command}' as user '#{homebrew_user.name}'"
# FIXME: this 1800 second default timeout should be deprecated
- output = shell_out_with_timeout!(command, :timeout => 1800, :user => homebrew_uid, :environment => { "HOME" => homebrew_user.dir, "RUBYOPT" => nil })
+ output = shell_out_with_timeout!(command, :timeout => 1800, :user => homebrew_uid, :environment => { "HOME" => homebrew_user.dir, "RUBYOPT" => nil, "TMPDIR" => nil })
output.stdout.chomp
end
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 5dc3f6c1e1..ca0e9ccda7 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -21,7 +21,7 @@
class Chef
CHEF_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "12.9.10"
+ VERSION = "12.9.13"
end
#
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 3a8728515d..65cc5a97b4 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -203,6 +203,23 @@ describe Chef::Knife::Ssh do
expect(@knife.session.servers[0].port).to eq(123)
end
+ it "uses the timeout from Chef Config" do
+ Chef::Config[:knife][:ssh_timeout] = 5
+ @knife.session_from_list([["the.b.org", nil]])
+ expect(@knife.session.servers[0].options[:timeout]).to eq(5)
+ end
+
+ it "uses the timeout from knife config" do
+ @knife.config[:ssh_timeout] = 6
+ @knife.session_from_list([["the.b.org", nil]])
+ expect(@knife.session.servers[0].options[:timeout]).to eq(6)
+ end
+
+ it "defaults to no timeout" do
+ @knife.session_from_list([["the.b.org", nil]])
+ expect(@knife.session.servers[0].options[:timeout]).to eq(nil)
+ end
+
it "uses the user from an ssh config file" do
@knife.session_from_list([["the.b.org", 123]])
expect(@knife.session.servers[0].user).to eq("locutus")