diff options
author | Tim Smith <tsmith@chef.io> | 2019-10-14 11:54:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-14 11:54:34 -0700 |
commit | 39900a9c51eec1b9a438da54eae63f57029544c5 (patch) | |
tree | 04b8eda0f52732d38e5e322b0c204947ed9596a1 | |
parent | b7c868a3b805f57fb3025a71a6f4fcb5ef40620c (diff) | |
parent | 286e6a29330adb650eaec48d65d42dc8bde271f4 (diff) | |
download | chef-39900a9c51eec1b9a438da54eae63f57029544c5.tar.gz |
Merge pull request #8987 from MsysTechnologiesllc/VSingh/fix-knife-exec-script-path
Fix undefined method `each' for String
-rw-r--r-- | lib/chef/knife/exec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/knife/exec.rb b/lib/chef/knife/exec.rb index 4b7f570aec..6fb1d00c45 100644 --- a/lib/chef/knife/exec.rb +++ b/lib/chef/knife/exec.rb @@ -40,7 +40,7 @@ class Chef::Knife::Exec < Chef::Knife end def run - config[:script_path] ||= Array(Chef::Config[:script_path]) + config[:script_path] = Array(config[:script_path] || Chef::Config[:script_path]) # Default script paths are chef-repo/.chef/scripts and ~/.chef/scripts config[:script_path] << File.join(Chef::Knife.chef_config_dir, "scripts") if Chef::Knife.chef_config_dir @@ -57,6 +57,14 @@ class Chef::Knife::Exec < Chef::Knife context.instance_eval(IO.read(file), file, 0) end else + puts "An interactive shell is opened" + puts + puts "Type your script and do:" + puts + puts "1. To run the script, use 'Ctrl D'" + puts "2. To exit, use 'Ctrl/Shift C'" + puts + puts "Type here a script..." script = STDIN.read context.instance_eval(script, "STDIN", 0) end |