chef 11.8.4.ohai7.0-x86-mingw32 → 11.10.0.alpha.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/distro/common/html/chef-client.8.html +3 -3
- data/distro/common/html/chef-expander.8.html +3 -3
- data/distro/common/html/chef-expanderctl.8.html +3 -3
- data/distro/common/html/chef-server-webui.8.html +3 -3
- data/distro/common/html/chef-server.8.html +3 -3
- data/distro/common/html/chef-shell.1.html +3 -3
- data/distro/common/html/chef-solo.8.html +3 -3
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +3 -3
- data/distro/common/html/knife-client.1.html +3 -3
- data/distro/common/html/knife-configure.1.html +3 -3
- data/distro/common/html/knife-cookbook-site.1.html +3 -3
- data/distro/common/html/knife-cookbook.1.html +3 -3
- data/distro/common/html/knife-data-bag.1.html +3 -3
- data/distro/common/html/knife-environment.1.html +3 -3
- data/distro/common/html/knife-exec.1.html +3 -3
- data/distro/common/html/knife-index.1.html +3 -3
- data/distro/common/html/knife-node.1.html +3 -3
- data/distro/common/html/knife-role.1.html +3 -3
- data/distro/common/html/knife-search.1.html +3 -3
- data/distro/common/html/knife-ssh.1.html +3 -3
- data/distro/common/html/knife-status.1.html +3 -3
- data/distro/common/html/knife-tag.1.html +3 -3
- data/distro/common/html/knife.1.html +3 -3
- data/distro/common/man/man8/chef-client.8 +3 -3
- data/distro/common/man/man8/chef-solo.8 +5 -2
- data/lib/chef.rb +2 -0
- data/lib/chef/application.rb +7 -2
- data/lib/chef/application/apply.rb +6 -0
- data/lib/chef/application/client.rb +3 -1
- data/lib/chef/application/knife.rb +2 -0
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/client.rb +14 -11
- data/lib/chef/config.rb +4 -1
- data/lib/chef/cookbook_uploader.rb +14 -7
- data/lib/chef/encrypted_data_bag_item.rb +6 -303
- data/lib/chef/encrypted_data_bag_item/decryption_failure.rb +22 -0
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +201 -0
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +142 -0
- data/lib/chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format.rb +22 -0
- data/lib/chef/encrypted_data_bag_item/unsupported_cipher.rb +22 -0
- data/lib/chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format.rb +22 -0
- data/lib/chef/exceptions.rb +1 -0
- data/lib/chef/formatters/doc.rb +19 -3
- data/lib/chef/http/basic_client.rb +1 -1
- data/lib/chef/http/http_request.rb +7 -0
- data/lib/chef/knife.rb +8 -1
- data/lib/chef/knife/bootstrap.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +2 -2
- data/lib/chef/knife/cookbook_upload.rb +7 -1
- data/lib/chef/knife/core/subcommand_loader.rb +2 -2
- data/lib/chef/knife/data_bag_create.rb +7 -0
- data/lib/chef/knife/environment_compare.rb +127 -0
- data/lib/chef/mixin/command.rb +11 -12
- data/lib/chef/mixin/deep_merge.rb +4 -4
- data/lib/chef/monkey_patches/net_http.rb +34 -0
- data/lib/chef/monkey_patches/uri.rb +70 -0
- data/lib/chef/platform/provider_mapping.rb +1 -0
- data/lib/chef/provider/cookbook_file.rb +8 -0
- data/lib/chef/provider/cron.rb +1 -1
- data/lib/chef/provider/directory.rb +7 -0
- data/lib/chef/provider/file.rb +17 -4
- data/lib/chef/provider/git.rb +23 -5
- data/lib/chef/provider/group.rb +30 -11
- data/lib/chef/provider/group/dscl.rb +26 -4
- data/lib/chef/provider/group/gpasswd.rb +14 -19
- data/lib/chef/provider/group/groupadd.rb +41 -1
- data/lib/chef/provider/group/groupmod.rb +46 -36
- data/lib/chef/provider/group/pw.rb +59 -16
- data/lib/chef/provider/group/suse.rb +16 -13
- data/lib/chef/provider/group/usermod.rb +38 -15
- data/lib/chef/provider/group/windows.rb +13 -6
- data/lib/chef/provider/ohai.rb +5 -6
- data/lib/chef/provider/remote_file.rb +8 -0
- data/lib/chef/provider/template.rb +8 -0
- data/lib/chef/provider/user.rb +5 -1
- data/lib/chef/provider/user/useradd.rb +7 -0
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +30 -0
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource/deploy.rb +18 -0
- data/lib/chef/resource/group.rb +11 -0
- data/lib/chef/resource/scm.rb +18 -0
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +31 -0
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/run_context.rb +11 -0
- data/lib/chef/shell/ext.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +5 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/base.rb +3 -1
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/git_spec.rb +1 -1
- data/spec/functional/resource/group_spec.rb +257 -118
- data/spec/integration/client/client_spec.rb +82 -8
- data/spec/integration/client/ipv6_spec.rb +133 -0
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +111 -0
- data/spec/scripts/ssl-serve.rb +52 -0
- data/spec/spec_helper.rb +7 -6
- data/spec/support/platform_helpers.rb +21 -0
- data/spec/support/shared/functional/windows_script.rb +2 -1
- data/spec/support/shared/unit/provider/file.rb +181 -43
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +18 -0
- data/spec/unit/application/client_spec.rb +1 -0
- data/spec/unit/client_spec.rb +14 -1
- data/spec/unit/config_spec.rb +20 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +32 -18
- data/spec/unit/knife/cookbook_upload_spec.rb +14 -0
- data/spec/unit/knife/core/subcommand_loader_spec.rb +2 -2
- data/spec/unit/knife/data_bag_create_spec.rb +7 -0
- data/spec/unit/knife/environment_compare_spec.rb +112 -0
- data/spec/unit/knife_spec.rb +6 -1
- data/spec/unit/monkey_patches/uri_spec.rb +34 -0
- data/spec/unit/provider/cookbook_file_spec.rb +2 -1
- data/spec/unit/provider/cron_spec.rb +6 -0
- data/spec/unit/provider/file_spec.rb +3 -1
- data/spec/unit/provider/git_spec.rb +28 -4
- data/spec/unit/provider/group/dscl_spec.rb +1 -0
- data/spec/unit/provider/group/gpasswd_spec.rb +16 -9
- data/spec/unit/provider/group/groupadd_spec.rb +3 -4
- data/spec/unit/provider/group/groupmod_spec.rb +0 -1
- data/spec/unit/provider/group/pw_spec.rb +11 -14
- data/spec/unit/provider/group/usermod_spec.rb +19 -4
- data/spec/unit/provider/group/windows_spec.rb +0 -8
- data/spec/unit/provider/group_spec.rb +26 -4
- data/spec/unit/provider/ohai_spec.rb +1 -0
- data/spec/unit/provider/remote_file_spec.rb +4 -3
- data/spec/unit/provider/template_spec.rb +5 -3
- data/spec/unit/provider/user_spec.rb +6 -0
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +47 -0
- data/spec/unit/resource/scm_spec.rb +10 -0
- data/spec/unit/rest/auth_credentials_spec.rb +4 -1
- data/spec/unit/rest_spec.rb +12 -3
- metadata +69 -121
- data/spec/functional/resource/ohai_spec.rb +0 -65
@@ -58,6 +58,8 @@ class Chef
|
|
58
58
|
|
59
59
|
SLASH = "/".freeze
|
60
60
|
|
61
|
+
HOST_LOWER = "host".freeze
|
62
|
+
|
61
63
|
def self.user_agent=(ua)
|
62
64
|
@user_agent = ua
|
63
65
|
end
|
@@ -76,6 +78,10 @@ class Chef
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def host
|
81
|
+
@url.hostname
|
82
|
+
end
|
83
|
+
|
84
|
+
def uri_safe_host
|
79
85
|
@url.host
|
80
86
|
end
|
81
87
|
|
@@ -132,6 +138,7 @@ class Chef
|
|
132
138
|
# No response compression unless we asked for it explicitly:
|
133
139
|
@headers[HTTPRequest::ACCEPT_ENCODING] ||= "identity"
|
134
140
|
@headers['X-Chef-Version'] = ::Chef::VERSION
|
141
|
+
@headers['Host'] = "#{uri_safe_host}:#{port}" unless @headers.keys.any? {|k| k.downcase.to_s == HOST_LOWER }
|
135
142
|
@headers
|
136
143
|
end
|
137
144
|
|
data/lib/chef/knife.rb
CHANGED
@@ -239,7 +239,14 @@ class Chef
|
|
239
239
|
end
|
240
240
|
|
241
241
|
def self.working_directory
|
242
|
-
|
242
|
+
a = if Chef::Platform.windows?
|
243
|
+
ENV['CD']
|
244
|
+
else
|
245
|
+
ENV['PWD']
|
246
|
+
end || Dir.pwd
|
247
|
+
|
248
|
+
puts "Working directory: #{a}"
|
249
|
+
a
|
243
250
|
end
|
244
251
|
|
245
252
|
def self.reset_config_path!
|
data/lib/chef/knife/bootstrap.rb
CHANGED
@@ -91,7 +91,7 @@ class Chef
|
|
91
91
|
|
92
92
|
option :bootstrap_no_proxy,
|
93
93
|
:long => "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
|
94
|
-
:description => "Do not proxy locations for the node being bootstrapped",
|
94
|
+
:description => "Do not proxy locations for the node being bootstrapped; this option is used internally by Opscode",
|
95
95
|
:proc => Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }
|
96
96
|
|
97
97
|
option :distro,
|
@@ -58,7 +58,7 @@ class Chef
|
|
58
58
|
ui.info("Making tarball #{cookbook_name}.tgz")
|
59
59
|
Chef::Mixin::Command.run_command(:command => "tar -czf #{cookbook_name}.tgz #{cookbook_name}", :cwd => tmp_cookbook_dir)
|
60
60
|
rescue => e
|
61
|
-
ui.error("Error making tarball #{cookbook_name}.tgz: #{e.message}.
|
61
|
+
ui.error("Error making tarball #{cookbook_name}.tgz: #{e.message}. Increase log verbosity (-VV) for more information.")
|
62
62
|
Chef::Log.debug("\n#{e.backtrace.join("\n")}")
|
63
63
|
exit(1)
|
64
64
|
end
|
@@ -69,7 +69,7 @@ class Chef
|
|
69
69
|
Chef::Log.debug("Removing local staging directory at #{tmp_cookbook_dir}")
|
70
70
|
FileUtils.rm_rf tmp_cookbook_dir
|
71
71
|
rescue => e
|
72
|
-
ui.error("Error uploading cookbook #{cookbook_name} to the Opscode Cookbook Site: #{e.message}.
|
72
|
+
ui.error("Error uploading cookbook #{cookbook_name} to the Opscode Cookbook Site: #{e.message}. Increase log verbosity (-VV) for more information.")
|
73
73
|
Chef::Log.debug("\n#{e.backtrace.join("\n")}")
|
74
74
|
exit(1)
|
75
75
|
end
|
@@ -57,6 +57,12 @@ class Chef
|
|
57
57
|
:boolean => true,
|
58
58
|
:description => "Update cookbook versions even if they have been frozen"
|
59
59
|
|
60
|
+
option :concurrency,
|
61
|
+
:long => '--concurrency NUMBER_OF_THREADS',
|
62
|
+
:description => "How many concurrent threads will be used",
|
63
|
+
:default => 10,
|
64
|
+
:proc => lambda { |o| o.to_i }
|
65
|
+
|
60
66
|
option :environment,
|
61
67
|
:short => '-E',
|
62
68
|
:long => '--environment ENVIRONMENT',
|
@@ -228,7 +234,7 @@ WARNING
|
|
228
234
|
check_for_broken_links!(cb)
|
229
235
|
check_for_dependencies!(cb)
|
230
236
|
end
|
231
|
-
Chef::CookbookUploader.new(cookbooks, config[:cookbook_path], :force => config[:force]).upload_cookbooks
|
237
|
+
Chef::CookbookUploader.new(cookbooks, config[:cookbook_path], :force => config[:force], :concurrency => config[:concurrency]).upload_cookbooks
|
232
238
|
rescue Chef::Exceptions::CookbookFrozen => e
|
233
239
|
ui.error e
|
234
240
|
raise
|
@@ -121,9 +121,9 @@ class Chef
|
|
121
121
|
|
122
122
|
def latest_gem_specs
|
123
123
|
@latest_gem_specs ||= if Gem::Specification.respond_to? :latest_specs
|
124
|
-
Gem::Specification.latest_specs
|
124
|
+
Gem::Specification.latest_specs(true) # find prerelease gems
|
125
125
|
else
|
126
|
-
Gem.source_index.latest_specs
|
126
|
+
Gem.source_index.latest_specs(true)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -67,6 +67,13 @@ class Chef
|
|
67
67
|
exit 1
|
68
68
|
end
|
69
69
|
|
70
|
+
begin
|
71
|
+
Chef::DataBag.validate_name!(@data_bag_name)
|
72
|
+
rescue Chef::Exceptions::InvalidDataBagName => e
|
73
|
+
ui.fatal(e.message)
|
74
|
+
exit(1)
|
75
|
+
end
|
76
|
+
|
70
77
|
# create the data bag
|
71
78
|
begin
|
72
79
|
rest.post_rest("data", { "name" => @data_bag_name })
|
@@ -0,0 +1,127 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Sander Botman (<sbotman@schubergphilis.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Sander Botman.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/knife'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class EnvironmentCompare < Knife
|
24
|
+
|
25
|
+
deps do
|
26
|
+
require 'chef/environment'
|
27
|
+
end
|
28
|
+
|
29
|
+
banner "knife environment compare [ENVIRONMENT..] (options)"
|
30
|
+
|
31
|
+
option :all,
|
32
|
+
:short => "-a",
|
33
|
+
:long => "--all",
|
34
|
+
:description => "Show all cookbooks",
|
35
|
+
:boolean => true
|
36
|
+
|
37
|
+
option :mismatch,
|
38
|
+
:short => "-m",
|
39
|
+
:long => "--mismatch",
|
40
|
+
:description => "Only show mismatching versions",
|
41
|
+
:boolean => true
|
42
|
+
|
43
|
+
def run
|
44
|
+
# Get the commandline environments or all if none are provided.
|
45
|
+
environments = environment_list
|
46
|
+
|
47
|
+
# Get a list of all cookbooks that have constraints and their environment.
|
48
|
+
constraints = constraint_list(environments)
|
49
|
+
|
50
|
+
# Get the total list of cookbooks that have constraints
|
51
|
+
cookbooks = cookbook_list(constraints)
|
52
|
+
|
53
|
+
# If we cannot find any cookbooks, we can stop here.
|
54
|
+
if cookbooks.nil? || cookbooks.empty?
|
55
|
+
ui.error "Cannot find any environment cookbook constraints"
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get all cookbooks so we can compare them all
|
60
|
+
cookbooks = rest.get_rest("/cookbooks?num_versions=1") if config[:all]
|
61
|
+
|
62
|
+
# display matrix view of in the requested format.
|
63
|
+
if config[:format] == 'summary'
|
64
|
+
matrix = matrix_output(cookbooks, constraints)
|
65
|
+
ui.output(matrix)
|
66
|
+
else
|
67
|
+
ui.output(constraints)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def environment_list
|
74
|
+
environments = []
|
75
|
+
unless @name_args.nil? || @name_args.empty?
|
76
|
+
@name_args.each { |name| environments << name }
|
77
|
+
else
|
78
|
+
environments = Chef::Environment.list
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def constraint_list(environments)
|
83
|
+
constraints = {}
|
84
|
+
environments.each do |env,url|
|
85
|
+
# Because you cannot modify the default environment I filter it out here.
|
86
|
+
unless env == "_default"
|
87
|
+
envdata = Chef::Environment.load(env)
|
88
|
+
ver = envdata.cookbook_versions
|
89
|
+
constraints[env] = ver
|
90
|
+
end
|
91
|
+
end
|
92
|
+
constraints
|
93
|
+
end
|
94
|
+
|
95
|
+
def cookbook_list(constraints)
|
96
|
+
result = {}
|
97
|
+
constraints.each { |env, cb| result.merge!(cb) }
|
98
|
+
result
|
99
|
+
end
|
100
|
+
|
101
|
+
def matrix_output(cookbooks, constraints)
|
102
|
+
rows = [ '' ]
|
103
|
+
environments = []
|
104
|
+
constraints.each { |e,v| environments << e.to_s }
|
105
|
+
columns = environments.count + 1
|
106
|
+
environments.each { |env| rows << ui.color(env, :bold) }
|
107
|
+
cookbooks.each do |c,v|
|
108
|
+
total = []
|
109
|
+
environments.each { |n| total << constraints[n][c]}
|
110
|
+
if total.uniq.count == 1
|
111
|
+
next if config[:mismatch]
|
112
|
+
color = :white
|
113
|
+
else
|
114
|
+
color = :yellow
|
115
|
+
end
|
116
|
+
rows << ui.color(c, :bold)
|
117
|
+
environments.each do |e|
|
118
|
+
tag = constraints[e][c] || "latest"
|
119
|
+
rows << ui.color(tag, color)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
ui.list(rows, :uneven_columns_across, columns)
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/chef/mixin/command.rb
CHANGED
@@ -144,19 +144,18 @@ class Chef
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def handle_command_failures(status, command_output, opts={})
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
raise Chef::Exceptions::Exec, "#{opts[:command]} returned #{status.exitstatus}, expected #{opts[:returns]}#{output}"
|
158
|
-
end
|
147
|
+
return if opts[:ignore_failure]
|
148
|
+
opts[:returns] ||= 0
|
149
|
+
return if Array(opts[:returns]).include?(status.exitstatus)
|
150
|
+
|
151
|
+
# if the log level is not debug, through output of command when we fail
|
152
|
+
output = ""
|
153
|
+
if Chef::Log.level == :debug || opts[:output_on_failure]
|
154
|
+
output << "\n---- Begin output of #{opts[:command]} ----\n"
|
155
|
+
output << command_output.to_s
|
156
|
+
output << "\n---- End output of #{opts[:command]} ----\n"
|
159
157
|
end
|
158
|
+
raise Chef::Exceptions::Exec, "#{opts[:command]} returned #{status.exitstatus}, expected #{opts[:returns]}#{output}"
|
160
159
|
end
|
161
160
|
|
162
161
|
# Call #run_command but set LC_ALL to the system's current environment so it doesn't get changed to C.
|
@@ -84,17 +84,17 @@ class Chef
|
|
84
84
|
when nil
|
85
85
|
dest
|
86
86
|
when Hash
|
87
|
-
|
88
|
-
|
87
|
+
if dest.kind_of?(Hash)
|
88
|
+
source.each do |src_key, src_value|
|
89
89
|
if dest[src_key]
|
90
90
|
dest[src_key] = deep_merge!(src_value, dest[src_key])
|
91
91
|
else # dest[src_key] doesn't exist so we take whatever source has
|
92
92
|
raise_if_knockout_used!(src_value)
|
93
93
|
dest[src_key] = src_value
|
94
94
|
end
|
95
|
-
else # dest isn't a hash, so we overwrite it completely
|
96
|
-
dest = source
|
97
95
|
end
|
96
|
+
else # dest isn't a hash, so we overwrite it completely
|
97
|
+
dest = source
|
98
98
|
end
|
99
99
|
when Array
|
100
100
|
if dest.kind_of?(Array)
|
@@ -20,3 +20,37 @@ module Net
|
|
20
20
|
include ChefNetHTTPExceptionExtensions
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
if Net::HTTP.instance_methods.map {|m| m.to_s}.include?("proxy_uri")
|
25
|
+
begin
|
26
|
+
# Ruby 2.0 changes the way proxy support is implemented in Net::HTTP.
|
27
|
+
# The implementation does not work correctly with IPv6 literals because it
|
28
|
+
# concatenates the address into a URI without adding square brackets for
|
29
|
+
# IPv6 addresses.
|
30
|
+
#
|
31
|
+
# If the bug is present, a call to Net::HTTP#proxy_uri when the host is an
|
32
|
+
# IPv6 address will fail by creating an invalid URI, like so:
|
33
|
+
#
|
34
|
+
# ruby -r'net/http' -e 'Net::HTTP.new("::1", 80).proxy_uri'
|
35
|
+
# /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/generic.rb:214:in `initialize': the scheme http does not accept registry part: ::1:80 (or bad hostname?) (URI::InvalidURIError)
|
36
|
+
# from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/http.rb:84:in `initialize'
|
37
|
+
# from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:214:in `new'
|
38
|
+
# from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:214:in `parse'
|
39
|
+
# from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
|
40
|
+
# from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:994:in `URI'
|
41
|
+
# from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1027:in `proxy_uri'
|
42
|
+
# from -e:1:in `<main>'
|
43
|
+
#
|
44
|
+
# https://bugs.ruby-lang.org/issues/9129
|
45
|
+
Net::HTTP.new("::1", 80).proxy_uri
|
46
|
+
rescue URI::InvalidURIError
|
47
|
+
class Net::HTTP
|
48
|
+
|
49
|
+
def proxy_uri # :nodoc:
|
50
|
+
ipv6_safe_addr = address.to_s.include?(":") ? "[#{address}]" : address
|
51
|
+
@proxy_uri ||= URI("http://#{ipv6_safe_addr}:#{port}").find_proxy
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
# You can redistribute it and/or modify it under either the terms of the
|
3
|
+
# 2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
#
|
5
|
+
# 1. You may make and give away verbatim copies of the source form of the
|
6
|
+
# software without restriction, provided that you duplicate all of the
|
7
|
+
# original copyright notices and associated disclaimers.
|
8
|
+
#
|
9
|
+
# 2. You may modify your copy of the software in any way, provided that
|
10
|
+
# you do at least ONE of the following:
|
11
|
+
#
|
12
|
+
# a) place your modifications in the Public Domain or otherwise
|
13
|
+
# make them Freely Available, such as by posting said
|
14
|
+
# modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
# the author to include your modifications in the software.
|
16
|
+
#
|
17
|
+
# b) use the modified software only within your corporation or
|
18
|
+
# organization.
|
19
|
+
#
|
20
|
+
# c) give non-standard binaries non-standard names, with
|
21
|
+
# instructions on where to get the original software distribution.
|
22
|
+
#
|
23
|
+
# d) make other distribution arrangements with the author.
|
24
|
+
#
|
25
|
+
# 3. You may distribute the software in object code or binary form,
|
26
|
+
# provided that you do at least ONE of the following:
|
27
|
+
#
|
28
|
+
# a) distribute the binaries and library files of the software,
|
29
|
+
# together with instructions (in the manual page or equivalent)
|
30
|
+
# on where to get the original distribution.
|
31
|
+
#
|
32
|
+
# b) accompany the distribution with the machine-readable source of
|
33
|
+
# the software.
|
34
|
+
#
|
35
|
+
# c) give non-standard binaries non-standard names, with
|
36
|
+
# instructions on where to get the original software distribution.
|
37
|
+
#
|
38
|
+
# d) make other distribution arrangements with the author.
|
39
|
+
#
|
40
|
+
# 4. You may modify and include the part of the software into any other
|
41
|
+
# software (possibly commercial). But some files in the distribution
|
42
|
+
# are not written by the author, so that they are not under these terms.
|
43
|
+
#
|
44
|
+
# For the list of those files and their copying conditions, see the
|
45
|
+
# file LEGAL.
|
46
|
+
#
|
47
|
+
# 5. The scripts and library files supplied as input to or produced as
|
48
|
+
# output from the software do not automatically fall under the
|
49
|
+
# copyright of the software, but belong to whomever generated them,
|
50
|
+
# and may be sold commercially, and may be aggregated with this
|
51
|
+
# software.
|
52
|
+
#
|
53
|
+
# 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
# PURPOSE.
|
57
|
+
|
58
|
+
require 'uri'
|
59
|
+
|
60
|
+
unless URI::Generic.instance_methods.map {|m| m.to_s}.include?("hostname")
|
61
|
+
|
62
|
+
class URI::Generic
|
63
|
+
# Copied from the MRI source for Ruby 1.9.3
|
64
|
+
# File lib/uri/generic.rb, line 659
|
65
|
+
def hostname
|
66
|
+
v = self.host
|
67
|
+
/\A\[(.*)\]\z/ =~ v ? $1 : v
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -369,6 +369,7 @@ class Chef
|
|
369
369
|
:route => Chef::Provider::Route,
|
370
370
|
:ifconfig => Chef::Provider::Ifconfig,
|
371
371
|
:ruby_block => Chef::Provider::RubyBlock,
|
372
|
+
:whyrun_safe_ruby_block => Chef::Provider::WhyrunSafeRubyBlock,
|
372
373
|
:erl_call => Chef::Provider::ErlCall,
|
373
374
|
:log => Chef::Provider::Log::ChefLog
|
374
375
|
}
|