summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ohai/mixin/network_helper.rb2
-rw-r--r--spec/unit/plugins/hostname_spec.rb6
-rw-r--r--spec/unit/plugins/linux/hostname_spec.rb2
3 files changed, 4 insertions, 6 deletions
diff --git a/lib/ohai/mixin/network_helper.rb b/lib/ohai/mixin/network_helper.rb
index 134d274b..71ea0bdd 100644
--- a/lib/ohai/mixin/network_helper.rb
+++ b/lib/ohai/mixin/network_helper.rb
@@ -47,7 +47,7 @@ module Ohai
rescue
retries -= 1
retry if retries > 0
- hostname
+ nil
end
end
end
diff --git a/spec/unit/plugins/hostname_spec.rb b/spec/unit/plugins/hostname_spec.rb
index 0390ddac..bf37ef1a 100644
--- a/spec/unit/plugins/hostname_spec.rb
+++ b/spec/unit/plugins/hostname_spec.rb
@@ -72,7 +72,7 @@ describe Ohai::System, "hostname plugin" do
it "is called twice" do
@plugin.run
- expect(@plugin[:fqdn]).to eq("katie.local")
+ expect(@plugin[:fqdn]).to eq(nil)
end
end
@@ -82,9 +82,7 @@ describe Ohai::System, "hostname plugin" do
allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(
mock_shell_out(0, "katie", "")
)
- allow(@plugin).to receive(:shell_out).with("hostname --fqdn").and_return(
- mock_shell_out(0, "katie.local", "")
- )
+ expect(@plugin).to receive(:canonicalize_hostname).with("katie.local").and_return("katie.local")
end
it "is not be called twice" do
diff --git a/spec/unit/plugins/linux/hostname_spec.rb b/spec/unit/plugins/linux/hostname_spec.rb
index 400a48d1..72ec6139 100644
--- a/spec/unit/plugins/linux/hostname_spec.rb
+++ b/spec/unit/plugins/linux/hostname_spec.rb
@@ -44,7 +44,7 @@ describe Ohai::System, "Linux hostname plugin" do
it "does not set fqdn" do
@plugin.run
- expect(@plugin.fqdn).to eq("katie.local")
+ expect(@plugin.fqdn).to eq(nil)
end
end