diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-04-23 10:54:43 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-04-23 10:54:43 -0700 |
commit | 09349d0c02b6a76b11db20e7f4b4608ec3c801d9 (patch) | |
tree | 6f658266eb705300d3ceeba0afe8b0d57de1785f /spec/functional/knife | |
parent | c045931b3f3ca872df8b4479c0a62d6c45ac472f (diff) | |
download | chef-09349d0c02b6a76b11db20e7f4b4608ec3c801d9.tar.gz |
CHEF-5211: fix configure hostname guessing
ohai[:fqdn] depends on DNS and may be nil. change the algorithm to use
the hostnaome of the machine as a fallback using the same algorithm
that Chef::Client uses for guessing the node_name of a host.
Diffstat (limited to 'spec/functional/knife')
-rw-r--r-- | spec/functional/knife/configure_spec.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/functional/knife/configure_spec.rb b/spec/functional/knife/configure_spec.rb index ac60cb3e00..3bef18a0aa 100644 --- a/spec/functional/knife/configure_spec.rb +++ b/spec/functional/knife/configure_spec.rb @@ -32,6 +32,7 @@ describe "knife configure" do it "loads the fqdn from Ohai" do knife_configure = Chef::Knife::Configure.new - expect(knife_configure.guess_servername).to eql(ohai[:fqdn]) + hostname_guess = ohai[:fqdn] || ohai[:machinename] || ohai[:hostname] || 'localhost' + expect(knife_configure.guess_servername).to eql(hostname_guess) end end |