diff options
| author | Thom May <thom@may.lt> | 2015-09-02 13:37:01 +0100 |
|---|---|---|
| committer | Thom May <thom@may.lt> | 2015-09-02 13:37:01 +0100 |
| commit | 3a410e9d10ad673f4aafa46ee46f2c8f8d66f7ca (patch) | |
| tree | 570fb1bfa8c0efdc4fc51a552e76b7f4c3603670 /lib | |
| parent | 1ef5f566480ba84091a12f2b6c5e85f44af54a5b (diff) | |
| parent | f246fe546c965720eadadc01c7318569d2795aba (diff) | |
| download | chef-3a410e9d10ad673f4aafa46ee46f2c8f8d66f7ca.tar.gz | |
Merge pull request #3027 from Nordstrom/warn_on_knife_node_runlist_remove_nochange
Add warnings to 'knife node run list remove ...'
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/chef/knife/node_run_list_remove.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb index 4b8953a264..ef03c176b8 100644 --- a/lib/chef/knife/node_run_list_remove.rb +++ b/lib/chef/knife/node_run_list_remove.rb @@ -42,7 +42,18 @@ class Chef entries = @name_args[1].split(',').map { |e| e.strip } end - entries.each { |e| node.run_list.remove(e) } + # iterate over the list of things to remove, + # warning if one of them was not found + entries.each do |e| + if node.run_list.find { |rli| e == rli.to_s } + node.run_list.remove(e) + else + ui.warn "#{e} is not in the run list" + unless e =~ /^(recipe|role)\[/ + ui.warn '(did you forget recipe[] or role[] around it?)' + end + end + end node.save |
