diff options
author | linyows <linyows@gmail.com> | 2018-01-23 18:34:57 +0900 |
---|---|---|
committer | linyows <linyows@gmail.com> | 2018-01-23 18:34:57 +0900 |
commit | f5cd3f34f0f7383d76e3a3601d8306eb13f5daf1 (patch) | |
tree | 39f6ad75831b0f2417464fbf589ce287cae2f8fb | |
parent | bc98db2fd24d75443d048a83ae1844eec7499507 (diff) | |
download | chef-f5cd3f34f0f7383d76e3a3601d8306eb13f5daf1.tar.gz |
ui.fatal if ssh nodes are duplicated
Signed-off-by: linyows <linyows@gmail.com>
-rw-r--r-- | lib/chef/knife/ssh.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 6d79cd10fd..4695d4d149 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -177,6 +177,13 @@ class Chef end exit 10 end + ips = list.map { |v| v.first } + if ips.count != ips.uniq.count + duplicated_ips = ips.uniq + ui.fatal("SSH #{duplicated_ips.count > 1 ? 'nodes are' : 'node is'} " + + "duplicated: #{duplicated_ips.join(',')}") + exit 10 + end session_from_list(list) end |