diff options
author | linyows <linyows@gmail.com> | 2018-01-25 16:04:22 +0900 |
---|---|---|
committer | linyows <linyows@gmail.com> | 2018-01-25 16:04:22 +0900 |
commit | 7219d80a59571e99f4b78104b5a3b6b6011afa27 (patch) | |
tree | ee3cf998ba2112adf663cb693d22449dafe54d0d /lib/chef/knife | |
parent | a4a50d5937efc3f06cc9d5f4a0c302d6fc84e2ef (diff) | |
download | chef-7219d80a59571e99f4b78104b5a3b6b6011afa27.tar.gz |
use skip_on_duplicated_fqdns as command option
Signed-off-by: linyows <linyows@gmail.com>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/ssh.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 01af582ee4..b824f5262a 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -123,6 +123,11 @@ class Chef :boolean => true, :proc => Proc.new { :raise } + option :skip_on_duplicated_fqdns, + :long => "--skip-on-duplicated-fqdns", + :description => "Skip exits even if FQDNs are duplicated", + :boolean => true + option :tmux_split, :long => "--tmux-split", :description => "Split tmux window.", @@ -177,11 +182,14 @@ class Chef end exit 10 end - fqdns = list.map { |v| v[0] } - if fqdns.count != fqdns.uniq.count - duplicated_fqdns = fqdns.uniq - ui.warn("SSH #{duplicated_fqdns.count > 1 ? 'nodes are' : 'node is'} " + - "duplicated: #{duplicated_fqdns.join(',')}") + unless config[:skip_on_duplicated_fqdns] + fqdns = list.map { |v| v[0] } + if fqdns.count != fqdns.uniq.count + duplicated_fqdns = fqdns.uniq + ui.warn("SSH #{duplicated_fqdns.count > 1 ? 'nodes are' : 'node is'} " + + "duplicated: #{duplicated_fqdns.join(',')}") + exit 10 + end end session_from_list(list) end |