summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKapil chouhan <kapil.chouhan@msystechnologies.com>2019-08-06 17:06:19 +0530
committerKapil chouhan <kapil.chouhan@msystechnologies.com>2019-08-06 17:06:19 +0530
commit33674f9ce1f1a72cf06540d105bdba56cd2cd429 (patch)
treea307037e0550c3ac0667e00e0c09bd832d7eeff4
parentfc07ead366d5ef3acd9f7fe3dd36503e5a3ed1c5 (diff)
downloadchef-33674f9ce1f1a72cf06540d105bdba56cd2cd429.tar.gz
Fix for rhsm_repo disable does not support wildcardKapil/MSYS-1065_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 feb2aa0802..c593bd900f 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