chef 14.0.190 → 14.0.202
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/acceptance/.DS_Store +0 -0
- data/acceptance/.bundle/config +1 -0
- data/bin/chef-resource-inspector +26 -0
- data/chef.gemspec +2 -2
- data/lib/.DS_Store +0 -0
- data/lib/chef/.DS_Store +0 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +27 -19
- data/lib/chef/dsl/declare_resource.rb +23 -1
- data/lib/chef/knife.rb +5 -3
- data/lib/chef/knife/.DS_Store +0 -0
- data/lib/chef/knife/core/bootstrap_context.rb +5 -1
- data/lib/chef/knife/ssh.rb +1 -1
- data/lib/chef/mixin/.DS_Store +0 -0
- data/lib/chef/provider.rb +5 -0
- data/lib/chef/provider/.DS_Store +0 -0
- data/lib/chef/provider/package/.DS_Store +0 -0
- data/lib/chef/provider/package/yum/python_helper.rb +4 -4
- data/lib/chef/provider/package/yum/yum_helper.py +21 -14
- data/lib/chef/provider/route.rb +3 -1
- data/lib/chef/recipe.rb +1 -7
- data/lib/chef/resource.rb +2 -20
- data/lib/chef/resource/.DS_Store +0 -0
- data/lib/chef/resource/apt_preference.rb +1 -1
- data/lib/chef/resource/apt_repository.rb +1 -1
- data/lib/chef/resource/apt_update.rb +1 -1
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/chef_handler.rb +1 -1
- data/lib/chef/resource/dmg_package.rb +1 -0
- data/lib/chef/resource/file/.DS_Store +0 -0
- data/lib/chef/resource/homebrew_cask.rb +1 -0
- data/lib/chef/resource/homebrew_tap.rb +1 -0
- data/lib/chef/resource/macos_userdefaults.rb +4 -4
- data/lib/chef/resource/ohai_hint.rb +1 -1
- data/lib/chef/resource/openssl_dhparam.rb +1 -0
- data/lib/chef/resource/openssl_rsa_private_key.rb +2 -2
- data/lib/chef/resource/openssl_rsa_public_key.rb +1 -0
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/rhsm_errata.rb +1 -0
- data/lib/chef/resource/rhsm_errata_level.rb +1 -0
- data/lib/chef/resource/rhsm_register.rb +9 -6
- data/lib/chef/resource/rhsm_repo.rb +1 -0
- data/lib/chef/resource/rhsm_subscription.rb +1 -0
- data/lib/chef/resource/route.rb +1 -1
- data/lib/chef/resource/sudo.rb +2 -2
- data/lib/chef/resource/swap_file.rb +1 -1
- data/lib/chef/resource/sysctl.rb +2 -2
- data/lib/chef/resource/systemd_unit.rb +1 -1
- data/lib/chef/resource/windows_auto_run.rb +1 -1
- data/lib/chef/resource/windows_feature.rb +1 -1
- data/lib/chef/resource/windows_feature_dism.rb +1 -1
- data/lib/chef/resource/windows_feature_powershell.rb +1 -1
- data/lib/chef/resource/windows_font.rb +1 -1
- data/lib/chef/resource/windows_package.rb +1 -1
- data/lib/chef/resource/windows_pagefile.rb +1 -1
- data/lib/chef/resource/windows_path.rb +1 -1
- data/lib/chef/resource/windows_printer.rb +1 -1
- data/lib/chef/resource/windows_printer_port.rb +1 -1
- data/lib/chef/resource/windows_service.rb +1 -1
- data/lib/chef/resource/windows_shortcut.rb +1 -1
- data/lib/chef/resource/windows_task.rb +1 -1
- data/lib/chef/resource/yum_repository.rb +1 -1
- data/lib/chef/resource/zypper_repository.rb +2 -1
- data/lib/chef/version.rb +1 -1
- data/spec/.DS_Store +0 -0
- data/spec/data/.DS_Store +0 -0
- data/spec/data/cookbooks/.DS_Store +0 -0
- data/spec/data/cookbooks/java/.DS_Store +0 -0
- data/spec/data/cookbooks/java/files/.DS_Store +0 -0
- data/spec/data/run_context/.DS_Store +0 -0
- data/spec/data/run_context/cookbooks/.DS_Store +0 -0
- data/spec/functional/.DS_Store +0 -0
- data/spec/functional/resource/.DS_Store +0 -0
- data/spec/functional/resource/yum_package_spec.rb +8 -0
- data/spec/functional/util/.DS_Store +0 -0
- data/spec/integration/.DS_Store +0 -0
- data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -1
- data/spec/support/.DS_Store +0 -0
- data/spec/unit/.DS_Store +0 -0
- data/spec/unit/dsl/declare_resource_spec.rb +10 -1
- data/spec/unit/provider/.DS_Store +0 -0
- data/spec/unit/resource/.DS_Store +0 -0
- data/spec/unit/resource/macos_user_defaults_spec.rb +0 -14
- data/tasks/.DS_Store +0 -0
- metadata +35 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f96a2522ddbe56499bea09ea7cdf72cd70c79680e8571338c43a525a7876cc21
|
4
|
+
data.tar.gz: '04293c6cff5d6482d9a0cf5273da9cc7139b550a94f6e2043a38797e2c68c54a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b78b8cfff242ca896ad7c3ae96d81c7ed9d4221c345a589e53564565ddef77a916e719be557c984afe99e6f0c1fd194e53b5d2468a782b35ee45411221a2261c
|
7
|
+
data.tar.gz: e1857d836b14d29bb7a3b2972a21b4fc4636f4cdb9d944c2ee67e1d78c14fee692657fc295e7c23342aef8e38f70eff19f92399911f34444352ac59a763ee152
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
14.0.
|
1
|
+
14.0.202
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
---
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# ./chef-resource-inspector - Find information about a resource
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright (c) 2018, Chef Software, Inc
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
|
20
|
+
Encoding.default_external = Encoding::UTF_8
|
21
|
+
|
22
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
23
|
+
|
24
|
+
require "chef/resource_inspector"
|
25
|
+
|
26
|
+
ResourceInspector.start
|
data/chef.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_dependency "mixlib-cli", "~> 1.7"
|
21
21
|
s.add_dependency "mixlib-log", "~> 2.0", ">= 2.0.3"
|
22
|
-
s.add_dependency "mixlib-authentication", "~>
|
22
|
+
s.add_dependency "mixlib-authentication", "~> 2.0"
|
23
23
|
s.add_dependency "mixlib-shellout", "~> 2.0"
|
24
24
|
s.add_dependency "mixlib-archive", "~> 0.4"
|
25
25
|
s.add_dependency "ohai", "~> 14.0"
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.add_dependency "bundler", ">= 1.10"
|
56
56
|
|
57
57
|
s.bindir = "bin"
|
58
|
-
s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply }
|
58
|
+
s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply chef-resource-inspector }
|
59
59
|
|
60
60
|
s.require_paths = %w{ lib }
|
61
61
|
s.files = %w{Gemfile Rakefile LICENSE README.md CONTRIBUTING.md VERSION} + Dir.glob("{distro,lib,lib-backcompat,tasks,acceptance,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + Dir.glob("*.gemspec")
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/chef/.DS_Store
ADDED
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: John Keiser (<jkeiser@chef.io>)
|
3
|
-
# Copyright:: Copyright 2012-
|
3
|
+
# Copyright:: Copyright 2012-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -307,25 +307,14 @@ class Chef
|
|
307
307
|
|
308
308
|
# GET /cookbooks/NAME/VERSION or /cookbook_artifacts/NAME/IDENTIFIER
|
309
309
|
elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 3
|
310
|
-
|
310
|
+
with_cookbook_manifest(path) do |manifest, entry|
|
311
311
|
cookbook_type = path[0]
|
312
|
-
cookbook_entry = entry.children.select do |child|
|
313
|
-
child.chef_object.full_name == "#{path[1]}-#{path[2]}" ||
|
314
|
-
(child.chef_object.name.to_s == path[1] && child.chef_object.identifier == path[2])
|
315
|
-
end[0]
|
316
|
-
raise ChefZero::DataStore::DataNotFoundError.new(path) if cookbook_entry.nil?
|
317
|
-
result = nil
|
318
|
-
begin
|
319
|
-
result = Chef::CookbookManifest.new(cookbook_entry.chef_object, policy_mode: cookbook_type == "cookbook_artifacts").to_hash
|
320
|
-
rescue Chef::ChefFS::FileSystem::NotFoundError => e
|
321
|
-
raise ChefZero::DataStore::DataNotFoundError.new(to_zero_path(e.entry), e)
|
322
|
-
end
|
323
312
|
|
324
|
-
|
313
|
+
manifest.each_pair do |key, value|
|
325
314
|
if value.is_a?(Array)
|
326
315
|
value.each do |file|
|
327
316
|
if file.is_a?(Hash) && file.has_key?("checksum")
|
328
|
-
relative = ["file_store", "repo", cookbook_type,
|
317
|
+
relative = ["file_store", "repo", cookbook_type, entry.name ]
|
329
318
|
relative += file[:path].split("/")
|
330
319
|
file["url"] = ChefZero::RestBase.build_uri(request.base_uri, relative)
|
331
320
|
end
|
@@ -334,8 +323,8 @@ class Chef
|
|
334
323
|
end
|
335
324
|
|
336
325
|
if cookbook_type == "cookbook_artifacts"
|
337
|
-
|
338
|
-
|
326
|
+
manifest["metadata"] = manifest["metadata"].to_hash
|
327
|
+
manifest["metadata"].delete_if do |key, value|
|
339
328
|
value == [] ||
|
340
329
|
(value == {} && !%w{dependencies attributes recipes}.include?(key)) ||
|
341
330
|
(value == "" && %w{source_url issues_url}.include?(key)) ||
|
@@ -343,9 +332,8 @@ class Chef
|
|
343
332
|
end
|
344
333
|
end
|
345
334
|
|
346
|
-
Chef::JSONCompat.to_json_pretty(
|
335
|
+
Chef::JSONCompat.to_json_pretty(manifest)
|
347
336
|
end
|
348
|
-
|
349
337
|
else
|
350
338
|
with_entry(path) do |entry|
|
351
339
|
begin
|
@@ -768,6 +756,26 @@ class Chef
|
|
768
756
|
path.length == 1 && BASE_DIRNAMES.include?(path[0])
|
769
757
|
end
|
770
758
|
|
759
|
+
def with_cookbook_manifest(path)
|
760
|
+
cookbook_type = path[0]
|
761
|
+
begin
|
762
|
+
# this is fast and equivalent to with_entry() that also returns the cb manifest
|
763
|
+
entry = Chef::ChefFS::FileSystem.resolve_path(chef_fs, to_chef_fs_path(path))
|
764
|
+
yield Chef::CookbookManifest.new(entry.chef_object, policy_mode: cookbook_type == "cookbook_artifacts").to_hash, entry
|
765
|
+
rescue Chef::ChefFS::FileSystem::NotFoundError, ChefZero::DataStore::DataNotFoundError => e
|
766
|
+
# this is very slow and we walk through all the cookbook versions to find ones that have the correct name in the metadata
|
767
|
+
dir = Chef::ChefFS::FileSystem.resolve_path(chef_fs, to_chef_fs_path([path[0]]))
|
768
|
+
entry = dir.children.select do |child|
|
769
|
+
child.chef_object.full_name == "#{path[1]}-#{path[2]}" ||
|
770
|
+
(child.chef_object.name.to_s == path[1] && child.chef_object.identifier == path[2])
|
771
|
+
end[0]
|
772
|
+
raise ChefZero::DataStore::DataNotFoundError.new(path) if entry.nil?
|
773
|
+
yield Chef::CookbookManifest.new(entry.chef_object, policy_mode: cookbook_type == "cookbook_artifacts").to_hash, entry
|
774
|
+
end
|
775
|
+
rescue Chef::ChefFS::FileSystem::NotFoundError => e
|
776
|
+
raise ChefZero::DataStore::DataNotFoundError.new(to_zero_path(e.entry), e)
|
777
|
+
end
|
778
|
+
|
771
779
|
def with_entry(path)
|
772
780
|
yield Chef::ChefFS::FileSystem.resolve_path(chef_fs, to_chef_fs_path(path))
|
773
781
|
rescue Chef::ChefFS::FileSystem::NotFoundError => e
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#--
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Christopher Walters
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -166,6 +166,27 @@ class Chef
|
|
166
166
|
resource
|
167
167
|
end
|
168
168
|
|
169
|
+
# Find existing resources by searching the list of existing resources. Possible
|
170
|
+
# forms are:
|
171
|
+
#
|
172
|
+
# find(:file => "foobar")
|
173
|
+
# find(:file => [ "foobar", "baz" ])
|
174
|
+
# find("file[foobar]", "file[baz]")
|
175
|
+
# find("file[foobar,baz]")
|
176
|
+
#
|
177
|
+
# Calls `run_context.resource_collection.find(*args)`
|
178
|
+
#
|
179
|
+
# The is backcompat API, the use of find_resource, below, is encouraged.
|
180
|
+
#
|
181
|
+
# @return the matching resource, or an Array of matching resources.
|
182
|
+
#
|
183
|
+
# @raise ArgumentError if you feed it bad lookup information
|
184
|
+
# @raise RuntimeError if it can't find the resources you are looking for.
|
185
|
+
#
|
186
|
+
def resources(*args)
|
187
|
+
run_context.resource_collection.find(*args)
|
188
|
+
end
|
189
|
+
|
169
190
|
# Lookup a resource in the resource collection by name. If the resource is not
|
170
191
|
# found this will raise Chef::Exceptions::ResourceNotFound. This API is identical to the
|
171
192
|
# resources() call and while it is a synonym it is not intended to deprecate that call.
|
@@ -292,6 +313,7 @@ class Chef
|
|
292
313
|
enclosing_provider: is_a?(Chef::Provider) ? self : nil
|
293
314
|
).build(&resource_attrs_block)
|
294
315
|
end
|
316
|
+
|
295
317
|
end
|
296
318
|
end
|
297
319
|
end
|
data/lib/chef/knife.rb
CHANGED
@@ -370,11 +370,13 @@ class Chef
|
|
370
370
|
Chef::Config[:log_level] = :warn
|
371
371
|
when 1
|
372
372
|
Chef::Config[:log_level] = :info
|
373
|
-
|
373
|
+
when 2
|
374
374
|
Chef::Config[:log_level] = :debug
|
375
|
+
else
|
376
|
+
Chef::Config[:log_level] = :trace
|
375
377
|
end
|
376
378
|
|
377
|
-
Chef::Config[:log_level] = :
|
379
|
+
Chef::Config[:log_level] = :trace if ENV["KNIFE_DEBUG"]
|
378
380
|
|
379
381
|
Chef::Config[:node_name] = config[:node_name] if config[:node_name]
|
380
382
|
Chef::Config[:client_key] = config[:client_key] if config[:client_key]
|
@@ -467,7 +469,7 @@ class Chef
|
|
467
469
|
when NameError, NoMethodError
|
468
470
|
ui.error "knife encountered an unexpected error"
|
469
471
|
ui.info "This may be a bug in the '#{self.class.common_name}' knife command or plugin"
|
470
|
-
ui.info "Please collect the output of this command with the `-
|
472
|
+
ui.info "Please collect the output of this command with the `-VVV` option before filing a bug report."
|
471
473
|
ui.info "Exception: #{e.class.name}: #{e.message}"
|
472
474
|
when Chef::Exceptions::PrivateKeyMissing
|
473
475
|
ui.error "Your private key could not be loaded from #{api_key}"
|
Binary file
|
@@ -178,7 +178,11 @@ validation_client_name "#{@chef_config[:validation_client_name]}"
|
|
178
178
|
# If the user doesn't have a client path configure, let bash use the PATH for what it was designed for
|
179
179
|
client_path = @chef_config[:chef_client_path] || "chef-client"
|
180
180
|
s = "#{client_path} -j /etc/chef/first-boot.json"
|
181
|
-
|
181
|
+
if @config[:verbosity] && @config[:verbosity] >= 3
|
182
|
+
s << " -l trace"
|
183
|
+
elsif @config[:verbosity] && @config[:verbosity] >= 2
|
184
|
+
s << " -l debug"
|
185
|
+
end
|
182
186
|
s << " -E #{bootstrap_environment}" unless bootstrap_environment.nil?
|
183
187
|
s << " --no-color" unless @config[:color]
|
184
188
|
s
|
data/lib/chef/knife/ssh.rb
CHANGED
@@ -288,7 +288,7 @@ class Chef
|
|
288
288
|
opts[:forward_agent] = forward_agent unless forward_agent.nil?
|
289
289
|
port ||= ssh_config[:port]
|
290
290
|
opts[:port] = port unless port.nil?
|
291
|
-
opts[:logger] = Chef::Log.
|
291
|
+
opts[:logger] = Chef::Log.with_child(subsystem: "net/ssh") if Chef::Log.level == :trace
|
292
292
|
if !config[:host_key_verify]
|
293
293
|
opts[:verify_host_key] = false
|
294
294
|
opts[:user_known_hosts_file] = "/dev/null"
|
Binary file
|
data/lib/chef/provider.rb
CHANGED
@@ -42,6 +42,7 @@ class Chef
|
|
42
42
|
|
43
43
|
include Chef::Mixin::WhyRun
|
44
44
|
extend Chef::Mixin::Provides
|
45
|
+
extend Forwardable
|
45
46
|
|
46
47
|
# includes the "core" DSL and not the "recipe" DSL by design
|
47
48
|
include Chef::DSL::Core
|
@@ -77,6 +78,10 @@ class Chef
|
|
77
78
|
# Chef.deprecated(:use_inline_resources, "The use_inline_resources mode is no longer optional and the line enabling it can be removed")
|
78
79
|
end
|
79
80
|
|
81
|
+
# delegate to the resource
|
82
|
+
#
|
83
|
+
def_delegators :@new_resource, :property_is_set?
|
84
|
+
|
80
85
|
#--
|
81
86
|
# TODO: this should be a reader, and the action should be passed in the
|
82
87
|
# constructor; however, many/most subclasses override the constructor so
|
Binary file
|
Binary file
|
@@ -93,14 +93,14 @@ class Chef
|
|
93
93
|
options.each_with_object({}) do |opt, h|
|
94
94
|
if opt =~ /--enablerepo=(.+)/
|
95
95
|
$1.split(",").each do |repo|
|
96
|
-
h["
|
97
|
-
h["
|
96
|
+
h["repos"] ||= []
|
97
|
+
h["repos"].push( { "enable" => repo } )
|
98
98
|
end
|
99
99
|
end
|
100
100
|
if opt =~ /--disablerepo=(.+)/
|
101
101
|
$1.split(",").each do |repo|
|
102
|
-
h["
|
103
|
-
h["
|
102
|
+
h["repos"] ||= []
|
103
|
+
h["repos"].push( { "disable" => repo } )
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
@@ -83,11 +83,13 @@ def query(command):
|
|
83
83
|
enabled_repos = base.repos.listEnabled()
|
84
84
|
|
85
85
|
# Handle any repocontrols passed in with our options
|
86
|
-
if 'enablerepos' in command:
|
87
|
-
base.repos.enableRepo(*command['enablerepos'])
|
88
86
|
|
89
|
-
if '
|
90
|
-
|
87
|
+
if 'repos' in command:
|
88
|
+
for repo in command['repos']:
|
89
|
+
if 'enable' in repo:
|
90
|
+
base.repos.enableRepo(repo['enable'])
|
91
|
+
if 'disable' in repo:
|
92
|
+
base.repos.disableRepo(repo['disable'])
|
91
93
|
|
92
94
|
args = { 'name': command['provides'] }
|
93
95
|
do_nevra = False
|
@@ -148,15 +150,14 @@ def query(command):
|
|
148
150
|
outpipe.flush()
|
149
151
|
|
150
152
|
# Reset any repos we were passed in enablerepo/disablerepo to the original state in enabled_repos
|
151
|
-
if '
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
base.repos.enableRepo(repo)
|
153
|
+
if 'repos' in command:
|
154
|
+
for repo in command['repos']:
|
155
|
+
if 'enable' in repo:
|
156
|
+
if base.repos.getRepo(repo['enable']) not in enabled_repos:
|
157
|
+
base.repos.disableRepo(repo['enable'])
|
158
|
+
if 'disable' in repo:
|
159
|
+
if base.repos.getRepo(repo['disable']) in enabled_repos:
|
160
|
+
base.repos.enableRepo(repo['disable'])
|
160
161
|
|
161
162
|
# the design of this helper is that it should try to be 'brittle' and fail hard and exit in order
|
162
163
|
# to keep process tables clean. additional error handling should probably be added to the retry loop
|
@@ -185,7 +186,13 @@ while 1:
|
|
185
186
|
sys.exit(0)
|
186
187
|
setup_exit_handler()
|
187
188
|
line = inpipe.readline()
|
188
|
-
|
189
|
+
|
190
|
+
try:
|
191
|
+
command = json.loads(line)
|
192
|
+
except ValueError, e:
|
193
|
+
base.closeRpmDB()
|
194
|
+
sys.exit(0)
|
195
|
+
|
189
196
|
if command['action'] == "whatinstalled":
|
190
197
|
query(command)
|
191
198
|
elif command['action'] == "whatavailable":
|
data/lib/chef/provider/route.rb
CHANGED
@@ -174,7 +174,7 @@ class Chef
|
|
174
174
|
conf[dev] = "" if conf[dev].nil?
|
175
175
|
case @action
|
176
176
|
when :add
|
177
|
-
conf[dev] << config_file_contents(:add, comment: resource.comment, target: resource.target, netmask: resource.netmask, gateway: resource.gateway) if resource.action == [:add]
|
177
|
+
conf[dev] << config_file_contents(:add, comment: resource.comment, target: resource.target, metric: resource.metric, netmask: resource.netmask, gateway: resource.gateway) if resource.action == [:add]
|
178
178
|
when :delete
|
179
179
|
# need to do this for the case when the last route on an int
|
180
180
|
# is removed
|
@@ -219,6 +219,7 @@ class Chef
|
|
219
219
|
command = [ "ip", "route", "replace", target ]
|
220
220
|
command += [ "via", new_resource.gateway ] if new_resource.gateway
|
221
221
|
command += [ "dev", new_resource.device ] if new_resource.device
|
222
|
+
command += [ "metric", new_resource.metric ] if new_resource.metric
|
222
223
|
when :delete
|
223
224
|
command = [ "ip", "route", "delete", target ]
|
224
225
|
command += [ "via", new_resource.gateway ] if new_resource.gateway
|
@@ -235,6 +236,7 @@ class Chef
|
|
235
236
|
content << (options[:target]).to_s
|
236
237
|
content << "/#{MASK[options[:netmask].to_s]}" if options[:netmask]
|
237
238
|
content << " via #{options[:gateway]}" if options[:gateway]
|
239
|
+
content << " metric #{options[:metric]}" if options[:metric]
|
238
240
|
content << "\n"
|
239
241
|
end
|
240
242
|
|
data/lib/chef/recipe.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#--
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Christopher Walters (<cw@chef.io>)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -66,12 +66,6 @@ class Chef
|
|
66
66
|
run_context.node
|
67
67
|
end
|
68
68
|
|
69
|
-
# Used by the DSL to look up resources when executing in the context of a
|
70
|
-
# recipe.
|
71
|
-
def resources(*args)
|
72
|
-
run_context.resource_collection.find(*args)
|
73
|
-
end
|
74
|
-
|
75
69
|
# This was moved to Chef::Node#tag, redirecting here for compatibility
|
76
70
|
def tag(*tags)
|
77
71
|
run_context.node.tag(*tags)
|
data/lib/chef/resource.rb
CHANGED
@@ -23,6 +23,7 @@ require "chef/dsl/data_query"
|
|
23
23
|
require "chef/dsl/registry_helper"
|
24
24
|
require "chef/dsl/reboot_pending"
|
25
25
|
require "chef/dsl/resources"
|
26
|
+
require "chef/dsl/declare_resource"
|
26
27
|
require "chef/json_compat"
|
27
28
|
require "chef/mixin/convert_to_class_name"
|
28
29
|
require "chef/guard_interpreter/resource_guard_interpreter"
|
@@ -51,6 +52,7 @@ class Chef
|
|
51
52
|
# Generic User DSL (not resource-specific)
|
52
53
|
#
|
53
54
|
|
55
|
+
include Chef::DSL::DeclareResource
|
54
56
|
include Chef::DSL::DataQuery
|
55
57
|
include Chef::DSL::RegistryHelper
|
56
58
|
include Chef::DSL::RebootPending
|
@@ -97,26 +99,6 @@ class Chef
|
|
97
99
|
run_context && run_context.node
|
98
100
|
end
|
99
101
|
|
100
|
-
#
|
101
|
-
# Find existing resources by searching the list of existing resources. Possible
|
102
|
-
# forms are:
|
103
|
-
#
|
104
|
-
# find(:file => "foobar")
|
105
|
-
# find(:file => [ "foobar", "baz" ])
|
106
|
-
# find("file[foobar]", "file[baz]")
|
107
|
-
# find("file[foobar,baz]")
|
108
|
-
#
|
109
|
-
# Calls `run_context.resource_collection.find(*args)`
|
110
|
-
#
|
111
|
-
# @return the matching resource, or an Array of matching resources.
|
112
|
-
#
|
113
|
-
# @raise ArgumentError if you feed it bad lookup information
|
114
|
-
# @raise RuntimeError if it can't find the resources you are looking for.
|
115
|
-
#
|
116
|
-
def resources(*args)
|
117
|
-
run_context.resource_collection.find(*args)
|
118
|
-
end
|
119
|
-
|
120
102
|
#
|
121
103
|
# Resource User Interface (for users)
|
122
104
|
#
|
Binary file
|
@@ -23,7 +23,7 @@ class Chef
|
|
23
23
|
# @since 13.3
|
24
24
|
class AptPreference < Chef::Resource
|
25
25
|
resource_name :apt_preference
|
26
|
-
provides
|
26
|
+
provides(:apt_preference) { true }
|
27
27
|
|
28
28
|
description "The apt_preference resource allows for the creation of APT preference"\
|
29
29
|
" files. Preference files are used to control which package versions and"\
|