diff --git a/lib/dogapi/common.rb b/lib/dogapi/common.rb index f35ec65b..544fdcb0 100644 --- a/lib/dogapi/common.rb +++ b/lib/dogapi/common.rb @@ -202,10 +202,10 @@ def Dogapi.find_datadog_host def Dogapi.find_localhost unless @@hostname - out, status = Open3.capture2("hostname", "-f", :err=>File::NULL) + out, status = Open3.capture2('hostname', '-f', :err => File::NULL) @@hostname = out.strip # Get status to check if the call was successful - raise SystemCallError, 'Could not get hostname with `hostname -f`' unless status.exitstatus == 0 + raise SystemCallError, 'Could not get hostname with `hostname -f`' unless status.exitstatus.zero? end rescue SystemCallError @@hostname = Addrinfo.getaddrinfo(Socket.gethostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname