chef 16.8.9-universal-mingw32 → 16.9.29-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -4
  3. data/README.md +1 -1
  4. data/chef.gemspec +11 -2
  5. data/lib/chef/compliance/default_attributes.rb +5 -1
  6. data/lib/chef/compliance/fetcher/automate.rb +2 -2
  7. data/lib/chef/compliance/fetcher/chef_server.rb +2 -2
  8. data/lib/chef/compliance/reporter/automate.rb +1 -2
  9. data/lib/chef/compliance/reporter/chef_server_automate.rb +4 -2
  10. data/lib/chef/compliance/runner.rb +53 -39
  11. data/lib/chef/http/ssl_policies.rb +27 -14
  12. data/lib/chef/knife/core/formatting_options.rb +49 -0
  13. data/lib/chef/knife/core/node_presenter.rb +0 -25
  14. data/lib/chef/knife/core/status_presenter.rb +1 -26
  15. data/lib/chef/knife/core/windows_bootstrap_context.rb +1 -1
  16. data/lib/chef/knife/node_show.rb +2 -1
  17. data/lib/chef/knife/search.rb +2 -1
  18. data/lib/chef/knife/ssh.rb +2 -0
  19. data/lib/chef/knife/status.rb +8 -11
  20. data/lib/chef/policy_builder/policyfile.rb +1 -1
  21. data/lib/chef/provider/package.rb +53 -19
  22. data/lib/chef/provider/package/dnf.rb +39 -12
  23. data/lib/chef/provider/package/dnf/dnf_helper.py +18 -5
  24. data/lib/chef/provider/package/dnf/python_helper.rb +6 -6
  25. data/lib/chef/provider/package/freebsd/pkgng.rb +3 -1
  26. data/lib/chef/provider/yum_repository.rb +2 -2
  27. data/lib/chef/resource/chef_gem.rb +2 -2
  28. data/lib/chef/resource/cron/cron_d.rb +1 -0
  29. data/lib/chef/resource/file.rb +1 -1
  30. data/lib/chef/resource/gem_package.rb +2 -2
  31. data/lib/chef/resource/homebrew_cask.rb +3 -3
  32. data/lib/chef/resource/http_request.rb +1 -1
  33. data/lib/chef/resource/locale.rb +1 -1
  34. data/lib/chef/resource/mdadm.rb +2 -2
  35. data/lib/chef/resource/osx_profile.rb +7 -7
  36. data/lib/chef/resource/remote_directory.rb +1 -1
  37. data/lib/chef/resource/ruby.rb +1 -5
  38. data/lib/chef/resource/ruby_block.rb +1 -1
  39. data/lib/chef/resource/user/windows_user.rb +5 -0
  40. data/lib/chef/resource/windows_certificate.rb +2 -12
  41. data/lib/chef/resource/yum_repository.rb +5 -0
  42. data/lib/chef/shell.rb +32 -1
  43. data/lib/chef/version.rb +1 -1
  44. data/spec/data/rubygems.org/latest_specs.4.8.gz +0 -0
  45. data/spec/data/rubygems.org/nonexistent_gem +0 -0
  46. data/spec/data/rubygems.org/sexp_processor +0 -0
  47. data/spec/data/rubygems.org/sexp_processor-4.15.1.gemspec.rz +0 -0
  48. data/spec/data/ssl/binary/chef-rspec-der.cert +0 -0
  49. data/spec/data/ssl/binary/chef-rspec-der.key +0 -0
  50. data/spec/functional/resource/dnf_package_spec.rb +319 -16
  51. data/spec/functional/resource/ohai_spec.rb +2 -10
  52. data/spec/functional/resource/windows_certificate_spec.rb +204 -384
  53. data/spec/spec_helper.rb +1 -1
  54. data/spec/unit/compliance/runner_spec.rb +60 -7
  55. data/spec/unit/http/ssl_policies_spec.rb +106 -78
  56. data/spec/unit/knife/bootstrap_spec.rb +5 -17
  57. data/spec/unit/knife/core/status_presenter_spec.rb +54 -0
  58. data/spec/unit/mixin/openssl_helper_spec.rb +0 -7
  59. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
  60. data/spec/unit/provider/package/rubygems_spec.rb +39 -7
  61. data/spec/unit/resource/user/windows_user_spec.rb +36 -0
  62. metadata +32 -14
  63. data/spec/data/trusted_certs_empty/.gitkeep +0 -0
  64. data/spec/data/trusted_certs_empty/README.md +0 -1
  65. data/spec/scripts/ssl-serve.rb +0 -47
@@ -23,31 +23,6 @@ class Chef
23
23
  class Knife
24
24
  module Core
25
25
 
26
- # This module may be included into a knife subcommand class to automatically
27
- # add configuration options used by the StatusPresenter
28
- module StatusFormattingOptions
29
- # @private
30
- # Would prefer to do this in a rational way, but can't be done b/c of
31
- # Mixlib::CLI's design :(
32
- def self.included(includer)
33
- includer.class_eval do
34
- option :medium_output,
35
- short: "-m",
36
- long: "--medium",
37
- boolean: true,
38
- default: false,
39
- description: "Include normal attributes in the output"
40
-
41
- option :long_output,
42
- short: "-l",
43
- long: "--long",
44
- boolean: true,
45
- default: false,
46
- description: "Include all attributes in the output"
47
- end
48
- end
49
- end
50
-
51
26
  # A customized presenter for Chef::Node objects. Supports variable-length
52
27
  # output formats for displaying node data
53
28
  class StatusPresenter < GenericPresenter
@@ -67,7 +42,7 @@ class Chef
67
42
 
68
43
  result["name"] = node["name"] || node.name
69
44
  result["chef_environment"] = node["chef_environment"]
70
- ip = (node["cloud"] && node["cloud"]["public_ipv4_addrs"].first) || node["ipaddress"]
45
+ ip = (node["cloud"] && node["cloud"]["public_ipv4_addrs"]&.first) || node["ipaddress"]
71
46
  fqdn = (node["cloud"] && node["cloud"]["public_hostname"]) || node["fqdn"]
72
47
  result["ip"] = ip if ip
73
48
  result["fqdn"] = fqdn if fqdn
@@ -140,7 +140,7 @@ class Chef
140
140
  end
141
141
 
142
142
  unless trusted_certs_script.empty?
143
- client_rb << %Q{trusted_certs_dir "#{ChefConfig::Config.etc_chef_dir(windows: true)}/trusted_certs"\n}
143
+ client_rb << %Q{trusted_certs_dir "#{ChefConfig::PathHelper.escapepath(ChefConfig::Config.etc_chef_dir(windows: true))}\\\\trusted_certs"\n}
144
144
  end
145
145
 
146
146
  if chef_config[:fips]
@@ -18,13 +18,14 @@
18
18
 
19
19
  require_relative "../knife"
20
20
  require_relative "core/node_presenter"
21
+ require_relative "core/formatting_options"
21
22
  require "chef-utils/dist" unless defined?(ChefUtils::Dist)
22
23
 
23
24
  class Chef
24
25
  class Knife
25
26
  class NodeShow < Knife
26
27
 
27
- include Knife::Core::NodeFormattingOptions
28
+ include Knife::Core::FormattingOptions
28
29
  include Knife::Core::MultiAttributeReturnOption
29
30
 
30
31
  deps do
@@ -18,6 +18,7 @@
18
18
 
19
19
  require_relative "../knife"
20
20
  require_relative "core/node_presenter"
21
+ require_relative "core/formatting_options"
21
22
 
22
23
  class Chef
23
24
  class Knife
@@ -32,7 +33,7 @@ class Chef
32
33
  require_relative "../search/query"
33
34
  end
34
35
 
35
- include Knife::Core::NodeFormattingOptions
36
+ include Knife::Core::FormattingOptions
36
37
 
37
38
  banner "knife search INDEX QUERY (options)"
38
39
 
@@ -385,6 +385,8 @@ class Chef
385
385
  end
386
386
 
387
387
  ch.on_extended_data do |_, _type, data|
388
+ raise ArgumentError if data.eql?("sudo: no tty present and no askpass program specified\n")
389
+
388
390
  stderr += data
389
391
  end
390
392
 
@@ -18,13 +18,13 @@
18
18
 
19
19
  require_relative "../knife"
20
20
  require_relative "core/status_presenter"
21
- require_relative "core/node_presenter"
21
+ require_relative "core/formatting_options"
22
22
  require "chef-utils/dist" unless defined?(ChefUtils::Dist)
23
23
 
24
24
  class Chef
25
25
  class Knife
26
26
  class Status < Knife
27
- include Knife::Core::NodeFormattingOptions
27
+ include Knife::Core::FormattingOptions
28
28
 
29
29
  deps do
30
30
  require_relative "../search/query"
@@ -68,11 +68,11 @@ class Chef
68
68
  append_to_query("chef_environment:#{config[:environment]}") if config[:environment]
69
69
 
70
70
  if config[:hide_by_mins]
71
- hidemins = config[:hide_by_mins].to_i
71
+ hide_by_mins = config[:hide_by_mins].to_i
72
72
  time = Time.now.to_i
73
73
  # AND NOT is not valid lucene syntax, so don't use append_to_query
74
74
  @query << " " unless @query.empty?
75
- @query << "NOT ohai_time:[#{(time - hidemins * 60)} TO #{time}]"
75
+ @query << "NOT ohai_time:[#{(time - hide_by_mins * 60)} TO #{time}]"
76
76
  end
77
77
 
78
78
  @query = @query.empty? ? "*:*" : @query
@@ -84,13 +84,10 @@ class Chef
84
84
  all_nodes << node
85
85
  end
86
86
 
87
- output(all_nodes.sort do |n1, n2|
88
- if config[:sort_reverse] || config[:sort_status_reverse]
89
- (n2["ohai_time"] || 0) <=> (n1["ohai_time"] || 0)
90
- else
91
- (n1["ohai_time"] || 0) <=> (n2["ohai_time"] || 0)
92
- end
93
- end)
87
+ all_nodes.sort_by! { |n| n["ohai_time"] || 0 }
88
+ all_nodes.reverse! if config[:sort_reverse] || config[:sort_status_reverse]
89
+
90
+ output(all_nodes)
94
91
  end
95
92
 
96
93
  end
@@ -475,7 +475,7 @@ class Chef
475
475
  end
476
476
 
477
477
  # @api private
478
- # Fetches the CookbookVersion object for the given name and identifer
478
+ # Fetches the CookbookVersion object for the given name and identifier
479
479
  # specified in the lock_data.
480
480
  # TODO: This only implements Chef 11 compatibility mode, which means that
481
481
  # cookbooks are fetched by the "dotted_decimal_identifier": a
@@ -28,14 +28,41 @@ class Chef
28
28
  class Package < Chef::Provider
29
29
  extend Chef::Mixin::SubclassDirective
30
30
 
31
- # subclasses declare this if they want all their arguments as arrays of packages and names
31
+ # subclasses declare this if they want all their arguments as arrays of packages and names.
32
+ # any new packages using this should also use allow_nils below.
33
+ #
32
34
  subclass_directive :use_multipackage_api
33
- # subclasses declare this if they want sources (filenames) pulled from their package names
35
+
36
+ # subclasses declare this if they want sources (filenames) pulled from their package names.
37
+ # this is for package providers that take a path into the filesystem (rpm, dpkg).
38
+ #
34
39
  subclass_directive :use_package_name_for_source
40
+
35
41
  # keeps package_names_for_targets and versions_for_targets indexed the same as package_name at
36
- # the cost of having the subclass needing to deal with nils
42
+ # the cost of having the subclass needing to deal with nils. all providers are encouraged to
43
+ # migrate to using this as it simplifies dealing with package aliases in subclasses.
44
+ #
37
45
  subclass_directive :allow_nils
38
46
 
47
+ # subclasses that implement complex pattern matching using constraints, particularly the yum and
48
+ # dnf classes, should filter the installed version against the desired version constraint and
49
+ # return nil if it does not match. this means that 'nil' does not mean that no version of the
50
+ # package is installed, but that the installed version does not satisfy the desired constraints.
51
+ # (the package plus the constraints are not installed)
52
+ #
53
+ # [ this may arguably be useful for all package providers and it greatly simplifies the logic
54
+ # in the superclass that gets executed, so maybe this should always be used now? ]
55
+ #
56
+ # note that when using this feature that the current_resource.version must be loaded with the
57
+ # correct currently installed version, without doing the filtering -- for reporting and for
58
+ # correctly displaying version upgrades. that means there are 3 different arrays which must be
59
+ # loaded by the subclass: candidate_version, magic_version and current_resource.version.
60
+ #
61
+ # NOTE: magic_version is a terrible name, but I couldn't think of anything better, at least this
62
+ # way it stands out clearly.
63
+ #
64
+ subclass_directive :use_magic_version
65
+
39
66
  #
40
67
  # Hook that subclasses use to populate the candidate_version(s)
41
68
  #
@@ -414,19 +441,21 @@ class Chef
414
441
  each_package do |package_name, new_version, current_version, candidate_version|
415
442
  case action
416
443
  when :upgrade
417
- if version_equals?(current_version, new_version)
418
- # this is an odd use case
419
- logger.trace("#{new_resource} #{package_name} #{new_version} is already installed -- you are equality pinning with an :upgrade action, this may be deprecated in the future")
420
- target_version_array.push(nil)
421
- elsif version_equals?(current_version, candidate_version)
422
- logger.trace("#{new_resource} #{package_name} #{candidate_version} is already installed")
444
+ if current_version.nil?
445
+ # with use_magic_version there may be a package installed, but it fails the user's
446
+ # requested new_resource.version constraints
447
+ logger.trace("#{new_resource} has no existing installed version. Installing install #{candidate_version}")
448
+ target_version_array.push(candidate_version)
449
+ elsif version_equals?(current_version, new_version)
450
+ # this is a short-circuit to avoid needing to (expensively) query the candidate_version which must come later
451
+ logger.trace("#{new_resource} #{package_name} #{new_version} is already installed")
423
452
  target_version_array.push(nil)
424
453
  elsif candidate_version.nil?
425
454
  logger.trace("#{new_resource} #{package_name} has no candidate_version to upgrade to")
426
455
  target_version_array.push(nil)
427
- elsif current_version.nil?
428
- logger.trace("#{new_resource} has no existing installed version. Installing install #{candidate_version}")
429
- target_version_array.push(candidate_version)
456
+ elsif version_equals?(current_version, candidate_version)
457
+ logger.trace("#{new_resource} #{package_name} #{candidate_version} is already installed")
458
+ target_version_array.push(nil)
430
459
  elsif !allow_downgrade && version_compare(current_version, candidate_version) == 1
431
460
  logger.trace("#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{candidate_version}. Skipping...)")
432
461
  target_version_array.push(nil)
@@ -436,21 +465,20 @@ class Chef
436
465
  end
437
466
 
438
467
  when :install
439
- if new_version
468
+ if new_version && !use_magic_version?
440
469
  if version_requirement_satisfied?(current_version, new_version)
441
470
  logger.trace("#{new_resource} #{package_name} #{current_version} satisfies #{new_version} requirement")
442
471
  target_version_array.push(nil)
443
472
  elsif current_version && !allow_downgrade && version_compare(current_version, new_version) == 1
444
473
  logger.warn("#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{new_version}. Skipping...)")
445
474
  target_version_array.push(nil)
446
- elsif version_equals?(current_version, candidate_version)
447
- logger.trace("#{new_resource} #{package_name} #{candidate_version} is already installed")
448
- target_version_array.push(nil)
449
475
  else
450
476
  logger.trace("#{new_resource} #{package_name} #{current_version} needs updating to #{new_version}")
451
477
  target_version_array.push(new_version)
452
478
  end
453
479
  elsif current_version.nil?
480
+ # with use_magic_version there may be a package installed, but it fails the user's
481
+ # requested new_resource.version constraints
454
482
  logger.trace("#{new_resource} #{package_name} not installed, installing #{candidate_version}")
455
483
  target_version_array.push(candidate_version)
456
484
  else
@@ -511,8 +539,14 @@ class Chef
511
539
  each_package do |package_name, new_version, current_version, candidate_version|
512
540
  next if new_version.nil? || current_version.nil?
513
541
 
514
- if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?
515
- missing.push(package_name)
542
+ if use_magic_version?
543
+ if !magic_version && candidate_version.nil?
544
+ missing.push(package_name)
545
+ end
546
+ else
547
+ if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?
548
+ missing.push(package_name)
549
+ end
516
550
  end
517
551
  end
518
552
  missing
@@ -525,7 +559,7 @@ class Chef
525
559
  def each_package
526
560
  package_name_array.each_with_index do |package_name, i|
527
561
  candidate_version = candidate_version_array[i]
528
- current_version = current_version_array[i]
562
+ current_version = use_magic_version? ? magic_version[i] : current_version_array[i]
529
563
  new_version = new_version_array[i]
530
564
  yield package_name, new_version, current_version, candidate_version
531
565
  end
@@ -34,6 +34,7 @@ class Chef
34
34
  allow_nils
35
35
  use_multipackage_api
36
36
  use_package_name_for_source
37
+ use_magic_version
37
38
 
38
39
  # all rhel variants >= 8 will use DNF
39
40
  provides :package, platform_family: "rhel", platform_version: ">= 8"
@@ -71,6 +72,16 @@ class Chef
71
72
  current_resource
72
73
  end
73
74
 
75
+ def load_after_resource
76
+ # force the installed version array to repopulate
77
+ @current_version = []
78
+ @after_resource = Chef::Resource::DnfPackage.new(new_resource.name)
79
+ after_resource.package_name(new_resource.package_name)
80
+ after_resource.version(get_current_versions)
81
+
82
+ after_resource
83
+ end
84
+
74
85
  def define_resource_requirements
75
86
  requirements.assert(:install, :upgrade, :remove, :purge) do |a|
76
87
  a.assertion { !new_resource.source || ::File.exist?(new_resource.source) }
@@ -87,9 +98,15 @@ class Chef
87
98
  end
88
99
  end
89
100
 
101
+ def magic_version
102
+ package_name_array.each_with_index.map do |pkg, i|
103
+ magical_version(i).version_with_arch
104
+ end
105
+ end
106
+
90
107
  def get_current_versions
91
108
  package_name_array.each_with_index.map do |pkg, i|
92
- installed_version(i).version_with_arch
109
+ current_version(i).version_with_arch
93
110
  end
94
111
  end
95
112
 
@@ -107,7 +124,7 @@ class Chef
107
124
  alias upgrade_package install_package
108
125
 
109
126
  def remove_package(names, versions)
110
- resolved_names = names.each_with_index.map { |name, i| installed_version(i).to_s unless name.nil? }
127
+ resolved_names = names.each_with_index.map { |name, i| magical_version(i).to_s unless name.nil? }
111
128
  dnf(options, "-y", "remove", resolved_names)
112
129
  flushcache
113
130
  end
@@ -137,10 +154,10 @@ class Chef
137
154
  def resolved_package_lock_names(names)
138
155
  names.each_with_index.map do |name, i|
139
156
  unless name.nil?
140
- if installed_version(i).version.nil?
157
+ if magical_version(i).version.nil?
141
158
  available_version(i).name
142
159
  else
143
- installed_version(i).name
160
+ magical_version(i).name
144
161
  end
145
162
  end
146
163
  end
@@ -205,14 +222,24 @@ class Chef
205
222
  end
206
223
 
207
224
  # @return [Array<Version>]
208
- def installed_version(index)
209
- @installed_version ||= []
210
- @installed_version[index] ||= if new_resource.source
211
- python_helper.package_query(:whatinstalled, available_version(index).name, arch: safe_arch_array[index], options: options)
212
- else
213
- python_helper.package_query(:whatinstalled, package_name_array[index], arch: safe_arch_array[index], options: options)
214
- end
215
- @installed_version[index]
225
+ def magical_version(index)
226
+ @magical_version ||= []
227
+ @magical_version[index] ||= if new_resource.source
228
+ python_helper.package_query(:whatinstalled, available_version(index).name, version: safe_version_array[index], arch: safe_arch_array[index], options: options)
229
+ else
230
+ python_helper.package_query(:whatinstalled, package_name_array[index], version: safe_version_array[index], arch: safe_arch_array[index], options: options)
231
+ end
232
+ @magical_version[index]
233
+ end
234
+
235
+ def current_version(index)
236
+ @current_version ||= []
237
+ @current_version[index] ||= if new_resource.source
238
+ python_helper.package_query(:whatinstalled, available_version(index).name, arch: safe_arch_array[index], options: options)
239
+ else
240
+ python_helper.package_query(:whatinstalled, package_name_array[index], arch: safe_arch_array[index], options: options)
241
+ end
242
+ @current_version[index]
216
243
  end
217
244
 
218
245
  # cache flushing is accomplished by simply restarting the python helper. this produces a roughly
@@ -98,14 +98,27 @@ def query(command):
98
98
  q = q.available()
99
99
 
100
100
  if 'epoch' in command:
101
- q = q.filterm(epoch=int(command['epoch']))
101
+ # We assume that any glob is "*" so just omit the filter since the dnf libraries have no
102
+ # epoch__glob filter. That means "?" wildcards in epochs will fail. The workaround is to
103
+ # not use the version filter here but to put the version with all the globs in the package name.
104
+ if not dnf.util.is_glob_pattern(command['epoch']):
105
+ q = q.filterm(epoch=int(command['epoch']))
102
106
  if 'version' in command:
103
- q = q.filterm(version__glob=command['version'])
107
+ if dnf.util.is_glob_pattern(command['version']):
108
+ q = q.filterm(version__glob=command['version'])
109
+ else:
110
+ q = q.filterm(version=command['version'])
104
111
  if 'release' in command:
105
- q = q.filterm(release__glob=command['release'])
112
+ if dnf.util.is_glob_pattern(command['release']):
113
+ q = q.filterm(release__glob=command['release'])
114
+ else:
115
+ q = q.filterm(release=command['release'])
106
116
 
107
117
  if 'arch' in command:
108
- q = q.filterm(arch__glob=command['arch'])
118
+ if dnf.util.is_glob_pattern(command['arch']):
119
+ q = q.filterm(arch__glob=command['arch'])
120
+ else:
121
+ q = q.filterm(arch=command['arch'])
109
122
 
110
123
  # only apply the default arch query filter if it returns something
111
124
  archq = q.filter(arch=[ 'noarch', hawkey.detect_arch() ])
@@ -170,4 +183,4 @@ try:
170
183
  raise RuntimeError("bad command")
171
184
  finally:
172
185
  if base is not None:
173
- base.closeRpmDB()
186
+ base.close()
@@ -42,13 +42,13 @@ class Chef
42
42
  def dnf_command
43
43
  # platform-python is used for system tools on RHEL 8 and is installed under /usr/libexec
44
44
  @dnf_command ||= begin
45
- cmd = which("platform-python", "python", "python3", "python2", "python2.7", extra_path: "/usr/libexec") do |f|
46
- shell_out("#{f} -c 'import dnf'").exitstatus == 0
47
- end
48
- raise Chef::Exceptions::Package, "cannot find dnf libraries, you may need to use yum_package" unless cmd
45
+ cmd = which("platform-python", "python", "python3", "python2", "python2.7", extra_path: "/usr/libexec") do |f|
46
+ shell_out("#{f} -c 'import dnf'").exitstatus == 0
47
+ end
48
+ raise Chef::Exceptions::Package, "cannot find dnf libraries, you may need to use yum_package" unless cmd
49
49
 
50
- "#{cmd} #{DNF_HELPER}"
51
- end
50
+ "#{cmd} #{DNF_HELPER}"
51
+ end
52
52
  end
53
53
 
54
54
  def start
@@ -42,7 +42,9 @@ class Chef
42
42
  end
43
43
 
44
44
  def current_installed_version
45
- pkg_info = shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 70])
45
+ # pkgng up to version 1.15.99.7 returns 70 for pkg not found,
46
+ # later versions return 1
47
+ pkg_info = shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 1, 70])
46
48
  pkg_info.stdout[/^Version +: (.+)$/, 1]
47
49
  end
48
50
 
@@ -33,7 +33,7 @@ class Chef
33
33
  def load_current_resource; end
34
34
 
35
35
  action :create do
36
- declare_resource(:template, "/etc/yum.repos.d/#{new_resource.repositoryid}.repo") do
36
+ declare_resource(:template, ::File.join(new_resource.reposdir, "#{new_resource.repositoryid}.repo")) do
37
37
  if template_available?(new_resource.source)
38
38
  source new_resource.source
39
39
  else
@@ -81,7 +81,7 @@ class Chef
81
81
  only_if "yum repolist all | grep -P '^#{new_resource.repositoryid}([ \t]|$)'"
82
82
  end
83
83
 
84
- declare_resource(:file, "/etc/yum.repos.d/#{new_resource.repositoryid}.repo") do
84
+ declare_resource(:file, ::File.join(new_resource.reposdir, "#{new_resource.repositoryid}.repo")) do
85
85
  action :delete
86
86
  notifies :create, "ruby_block[package-cache-reload-#{new_resource.repositoryid}]", :immediately
87
87
  end