summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKapil chouhan <kapil.chouhan@msystechnologies.com>2019-08-06 17:06:19 +0530
committerTim Smith <tsmith84@gmail.com>2019-10-02 11:00:13 -0700
commit2aacc4b2cc563d3b24268e78f625984e552abb69 (patch)
tree22eb698eff0cf522202e894865a9353f57006d7f
parent33aebdc920876120e53f246a0aeb17e7d3d6181c (diff)
downloadchef-2aacc4b2cc563d3b24268e78f625984e552abb69.tar.gz
Fix for rhsm_repo disable does not support wildcard
Signed-off-by: Kapil chouhan <kapil.chouhan@msystechnologies.com>
-rw-r--r--lib/chef/resource/rhsm_repo.rb2
-rw-r--r--spec/unit/resource/rhsm_repo_spec.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/resource/rhsm_repo.rb b/lib/chef/resource/rhsm_repo.rb
index 943abc3331..88cea4a024 100644
--- a/lib/chef/resource/rhsm_repo.rb
+++ b/lib/chef/resource/rhsm_repo.rb
@@ -57,7 +57,7 @@ class Chef
def repo_enabled?(repo)
cmd = Mixlib::ShellOut.new("subscription-manager repos --list-enabled", env: { LANG: "en_US" })
cmd.run_command
- !cmd.stdout.match(/Repo ID:\s+#{repo}$/).nil?
+ repo == "*" || !cmd.stdout.match(/Repo ID:\s+#{repo}$/).nil?
end
end
end
diff --git a/spec/unit/resource/rhsm_repo_spec.rb b/spec/unit/resource/rhsm_repo_spec.rb
index 36eb235798..dda2882c75 100644
--- a/spec/unit/resource/rhsm_repo_spec.rb
+++ b/spec/unit/resource/rhsm_repo_spec.rb
@@ -60,5 +60,11 @@ describe Chef::Resource::RhsmRepo do
expect(provider.repo_enabled?("differentrepo")).to eq(false)
end
end
+
+ context "when user pass wildcard" do
+ it "returns true" do
+ expect(provider.repo_enabled?("*")).to eq(true)
+ end
+ end
end
end