summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-11-12 17:23:08 -0800
committerGitHub <noreply@github.com>2019-11-12 17:23:08 -0800
commitea32f142157119c7fd5c675ed0fe9e0a1078398a (patch)
tree6e672e1d99629ecc7ac5c05a01f492d88b1d1579
parent3f02a71e782d98305aad7e7bbb3c7c9f3dec0d9c (diff)
parentb752f09a96f8f685c08ecdde9fb25965f150cd17 (diff)
downloadchef-ea32f142157119c7fd5c675ed0fe9e0a1078398a.tar.gz
Merge pull request #9090 from chef/revert_knife_list
Revert "Validate name argument for knife list"
-rw-r--r--lib/chef/knife/list.rb9
-rw-r--r--spec/integration/knife/list_spec.rb18
2 files changed, 9 insertions, 18 deletions
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 03e8cf199c..e5e196ecea 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -62,15 +62,10 @@ class Chef
attr_accessor :exit_code
def run
-
- if name_args.length == 0
- show_usage
- ui.fatal("You must specify at least one argument. If you want to list everything in this directory, run \"knife list .\"")
- exit 1
- end
+ patterns = name_args.length == 0 ? [""] : name_args
# Get the top-level matches
- all_results = parallelize(pattern_args_from(name_args)) do |pattern|
+ all_results = parallelize(pattern_args_from(patterns)) do |pattern|
pattern_results = Chef::ChefFS::FileSystem.list(config[:local] ? local_fs : chef_fs, pattern).to_a
if pattern_results.first && !pattern_results.first.exists? && pattern.exact_path
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index 145464d6d1..9689c9e6c8 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -316,12 +316,8 @@ describe "knife list", :workstation do
context "when cwd is at the top of the repository" do
before { cwd "." }
- it "knife list with no parameters reports an error" do
- knife("list").should_fail "FATAL: You must specify at least one argument. If you want to list everything in this directory, run \"knife list .\"\n", stdout: /USAGE/
- end
-
it "knife list -Rfp returns everything" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
clients/
clients/chef-validator.json
clients/chef-webui.json
@@ -442,7 +438,7 @@ describe "knife list", :workstation do
end
it "knife list -Rfp returns cookbooks" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -461,7 +457,7 @@ describe "knife list", :workstation do
before { cwd "cookbooks/cookbook2" }
it "knife list -Rfp returns cookbooks" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
metadata.rb
recipes/
recipes/default.rb
@@ -480,7 +476,7 @@ describe "knife list", :workstation do
before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -495,7 +491,7 @@ describe "knife list", :workstation do
before { cwd "symlinked" }
it "knife list -Rfp returns cookbooks" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -517,7 +513,7 @@ describe "knife list", :workstation do
before { cwd "real_cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -532,7 +528,7 @@ describe "knife list", :workstation do
before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife("list -Rfp .").should_succeed <<~EOM
+ knife("list -Rfp").should_succeed <<~EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/