summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyows <linyows@gmail.com>2018-01-25 10:33:25 +0900
committerlinyows <linyows@gmail.com>2018-01-25 10:33:25 +0900
commita4a50d5937efc3f06cc9d5f4a0c302d6fc84e2ef (patch)
tree81a441a992904d89f6c10190f17fc44b1eb44135
parentdb797fac6999dbb0b4da0bbfeab88a297e29c2c0 (diff)
downloadchef-a4a50d5937efc3f06cc9d5f4a0c302d6fc84e2ef.tar.gz
to warning instead of fatal error
Signed-off-by: linyows <linyows@gmail.com>
-rw-r--r--lib/chef/knife/ssh.rb5
-rw-r--r--spec/unit/knife/ssh_spec.rb5
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 78000aa273..01af582ee4 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -180,9 +180,8 @@ class Chef
fqdns = list.map { |v| v[0] }
if fqdns.count != fqdns.uniq.count
duplicated_fqdns = fqdns.uniq
- ui.fatal("SSH #{duplicated_fqdns.count > 1 ? 'nodes are' : 'node is'} " +
- "duplicated: #{duplicated_fqdns.join(',')}")
- exit 10
+ ui.warn("SSH #{duplicated_fqdns.count > 1 ? 'nodes are' : 'node is'} " +
+ "duplicated: #{duplicated_fqdns.join(',')}")
end
session_from_list(list)
end
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index ecfca88924..c0ef9e4116 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -144,9 +144,8 @@ describe Chef::Knife::Ssh do
@node_bar["fqdn"] = "foo.example.org"
end
- it "should raise a specific error" do
- expect(@knife.ui).to receive(:fatal).with(/^SSH node is duplicated: foo\.example\.org/)
- expect(@knife).to receive(:exit).with(10)
+ it "should be warned" do
+ expect(@knife.ui).to receive(:warn).with(/^SSH node is duplicated: foo\.example\.org/)
expect(@knife).to receive(:session_from_list).with([
["foo.example.org", nil, nil],
["foo.example.org", nil, nil],