summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-02-07 17:45:19 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-02-08 05:51:26 -0800
commit23ffb3d64f016476da8861201fb7e5177df6a7d5 (patch)
tree151aaef86fcb227d9f4aa0090873b1feb83df63f
parent05b5f4ae2b27bfd759c960ad1378a61e9895b606 (diff)
downloadchef-23ffb3d64f016476da8861201fb7e5177df6a7d5.tar.gz
do not support dnf_package on dnf 0.xlcg/ban-dnf-0.6
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package/dnf.rb6
-rw-r--r--lib/chef/resource/dnf_package.rb9
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb
index bf6aa2438f..6eb495df30 100644
--- a/lib/chef/provider/package/dnf.rb
+++ b/lib/chef/provider/package/dnf.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2016, Chef Software, Inc.
+# Copyright:: Copyright 2016-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,6 +18,7 @@
require "chef/provider/package"
require "chef/resource/dnf_package"
require "chef/mixin/which"
+require "chef/mixin/shell_out"
require "chef/mixin/get_source_from_package"
require "chef/provider/package/dnf/python_helper"
require "chef/provider/package/dnf/version"
@@ -27,6 +28,7 @@ class Chef
class Package
class Dnf < Chef::Provider::Package
extend Chef::Mixin::Which
+ extend Chef::Mixin::ShellOut
include Chef::Mixin::GetSourceFromPackage
allow_nils
@@ -34,7 +36,7 @@ class Chef
use_package_name_for_source
provides :package, platform_family: %w{rhel fedora} do
- which("dnf")
+ which("dnf") && shell_out("rpm -q dnf").stdout =~ /^dnf-[1-9]/
end
provides :dnf_package, os: "linux"
diff --git a/lib/chef/resource/dnf_package.rb b/lib/chef/resource/dnf_package.rb
index 92f7532fc2..f10c282f19 100644
--- a/lib/chef/resource/dnf_package.rb
+++ b/lib/chef/resource/dnf_package.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2016, Chef Software, Inc.
+# Copyright:: Copyright 2016-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,18 +16,21 @@
#
require "chef/resource/package"
+require "chef/mixin/which"
+require "chef/mixin/shell_out"
class Chef
class Resource
class DnfPackage < Chef::Resource::Package
extend Chef::Mixin::Which
+ extend Chef::Mixin::ShellOut
resource_name :dnf_package
allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache
- provides :package, os: "linux", platform_family: %w{rhel fedora} do
- which("dnf")
+ provides :package, platform_family: %w{rhel fedora} do
+ which("dnf") && shell_out("rpm -q dnf").stdout =~ /^dnf-[1-9]/
end
provides :dnf_package