summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-11-13 13:06:39 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-11-13 13:06:39 -0800
commit4be0cce9900dbfb37487b05171b7137331664e1b (patch)
tree864fd45dc77306f00d9e0cdc28c3fa1d34170904
parentd80796160625016889ded0ce42fec3ea9945e39e (diff)
parent62bba23153e7ce5ac04ff1d2a626c9a9d33749ea (diff)
downloadchef-4be0cce9900dbfb37487b05171b7137331664e1b.tar.gz
Merge pull request #2418 from opscode/lcg/goalie-merging
Lcg/goalie merging
-rw-r--r--CHANGELOG.md7
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--lib/chef/application/solo.rb2
-rw-r--r--lib/chef/monkey_patches/securerandom.rb44
-rw-r--r--lib/chef/provider/package/rubygems.rb2
-rw-r--r--lib/chef/request_id.rb2
-rw-r--r--lib/chef/resource_reporter.rb2
-rw-r--r--spec/unit/application/solo_spec.rb2
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb12
9 files changed, 21 insertions, 54 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96e33bccda..a83252f9c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
## Unreleased
+* [**Vasiliy Tolstov**](https://github.com/vtolstov):
+ cleanup cookbook path from stale files (when using chef-solo with a tarball url)
+* [**Nathan Cerny**](https://github.com/ncerny):
+ Fix rubygems provider to use https instead of http.
+* [**Anshul Sharma**](https://github.com/justanshulsharma)
+ removed securerandom patch
+
### Chef Contributions
* Update Chef to use RSpec 3.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f8618ad381..8c19e1011a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -173,7 +173,7 @@ Contributions go through a review process to improve code quality and avoid regr
Our primary shipping vehicle is operating system specific packages that includes
all the requirements of Chef. We call these [Omnibus packages](https://github.com/opscode/omnibus-ruby)
-We also release our software as gems to [Rubygems](http://rubygems.org/) but we strongly
+We also release our software as gems to [Rubygems](https://rubygems.org/) but we strongly
recommend using Chef packages since they are the only combination of native libraries &
gems required by Chef that we test throughly.
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 474bbf3f6c..c99170f437 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -191,6 +191,8 @@ class Chef::Application::Solo < Chef::Application
cookbooks_path = Array(Chef::Config[:cookbook_path]).detect{|e| e =~ /\/cookbooks\/*$/ }
recipes_path = File.expand_path(File.join(cookbooks_path, '..'))
+ Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it"
+ FileUtils.rm_rf(recipes_path, :secure => true)
Chef::Log.debug "Creating path #{recipes_path} to extract recipes into"
FileUtils.mkdir_p(recipes_path)
tarball_path = File.join(recipes_path, 'recipes.tgz')
diff --git a/lib/chef/monkey_patches/securerandom.rb b/lib/chef/monkey_patches/securerandom.rb
deleted file mode 100644
index 7a41a1dbb0..0000000000
--- a/lib/chef/monkey_patches/securerandom.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Author:: James Casey <james@opscode.com>
-# Copyright:: Copyright (c) 2013 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.
-#
-
-# == SecureRandom (Patch)
-# On ruby 1.9, SecureRandom has a uuid method which generates a v4 UUID. The
-# backport of SecureRandom to 1.8.7 is missing this method
-
-require 'securerandom'
-
-module SecureRandom
- unless respond_to?(:uuid)
- # SecureRandom.uuid generates a v4 random UUID (Universally Unique IDentifier).
- #
- # p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
- # p SecureRandom.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
- # p SecureRandom.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
- #
- # The version 4 UUID is purely random (except the version).
- # It doesn't contain meaningful information such as MAC address, time, etc.
- #
- # See RFC 4122 for details of UUID.
- def self.uuid
- ary = self.random_bytes(16).unpack("NnnnnN")
- ary[2] = (ary[2] & 0x0fff) | 0x4000
- ary[3] = (ary[3] & 0x3fff) | 0x8000
- "%08x-%04x-%04x-%04x-%04x%08x" % ary
- end
- end
-end
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 3c0ca40693..6304a7ef63 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -534,7 +534,7 @@ class Chef
if @new_resource.source =~ /\.gem$/i
name = @new_resource.source
else
- src = @new_resource.source && " --source=#{@new_resource.source} --source=http://rubygems.org"
+ src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org"
end
if version
shell_out!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src}#{opts}", :env=>nil)
diff --git a/lib/chef/request_id.rb b/lib/chef/request_id.rb
index 7fc177c633..2c7af01879 100644
--- a/lib/chef/request_id.rb
+++ b/lib/chef/request_id.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'chef/monkey_patches/securerandom'
+require 'securerandom'
require 'singleton'
class Chef
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index a19f26125e..1816fc857d 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -20,7 +20,7 @@
#
require 'uri'
-require 'chef/monkey_patches/securerandom'
+require 'securerandom'
require 'chef/event_dispatch/base'
class Chef
diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb
index 26d7d34caa..80f0bead8b 100644
--- a/spec/unit/application/solo_spec.rb
+++ b/spec/unit/application/solo_spec.rb
@@ -94,6 +94,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
before do
Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks"
Chef::Config[:recipe_url] = "http://junglist.gen.nz/recipes.tgz"
+ allow(FileUtils).to receive(:rm_rf).and_return(true)
allow(FileUtils).to receive(:mkdir_p).and_return(true)
@tarfile = StringIO.new("remote_tarball_content")
allow(@app).to receive(:open).with("http://junglist.gen.nz/recipes.tgz").and_yield(@tarfile)
@@ -135,6 +136,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
Chef::Config[:json_attribs] = json_source
Chef::Config[:recipe_url] = "http://icanhas.cheezburger.com/lolcats"
Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks"
+ allow(FileUtils).to receive(:rm_rf).and_return(true)
allow(FileUtils).to receive(:mkdir_p).and_return(true)
allow(Chef::Mixin::Command).to receive(:run_command).and_return(true)
end
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index db1c21090d..a3a4772229 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -90,7 +90,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
dep = Gem::Dependency.new('rspec', '>= 0')
dep_installer = Gem::DependencyInstaller.new
allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
- latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "http://rubygems.org/"]]
+ latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]]
expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to eq(Gem::Version.new('1.3.0'))
end
@@ -156,7 +156,7 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
it "finds a matching gem from a specific gemserver when explicit sources are given" do
dep = Gem::Dependency.new('rspec', '>= 0')
- latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "http://rubygems.org/"]]
+ latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]]
expect(@gem_env).to receive(:with_gem_sources).with('http://gems.example.com').and_yield
dep_installer = Gem::DependencyInstaller.new
@@ -291,9 +291,9 @@ RubyGems Environment:
- "install" => "--env-shebang"
- "update" => "--env-shebang"
- "gem" => "--no-rdoc --no-ri"
- - :sources => ["http://rubygems.org/", "http://gems.github.com/"]
+ - :sources => ["https://rubygems.org/", "http://gems.github.com/"]
- REMOTE SOURCES:
- - http://rubygems.org/
+ - https://rubygems.org/
- http://gems.github.com/
JRUBY_GEM_ENV
expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('jruby_gem_env', :stdout => gem_env_out))
@@ -332,10 +332,10 @@ RubyGems Environment:
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- - :sources => ["http://rubygems.org/", "http://gems.github.com/"]
+ - :sources => ["https://rubygems.org/", "http://gems.github.com/"]
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- - http://rubygems.org/
+ - https://rubygems.org/
- http://gems.github.com/
RBX_GEM_ENV
expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('rbx_gem_env', :stdout => gem_env_out))