Method: Specinfra::Command::Solaris::Base::Inventory.get_domain

Defined in:
lib/specinfra/command/solaris/base/inventory.rb

.get_domainObject

[View source]

13
14
15
16
17
18
19
20
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 13

def get_domain
  # There is no sure way to get the hostname like on linux 
  # This code is somewhat resembiling the functionality 
  # of the dnsdomainname command. 
  # Assumes either /etc/hosts or DNS is properly configured. 
  %Q{getent hosts `uname -n` | } +
  %Q{nawk -v h=`uname -n` '{sub(h".", "", $2); if ($2 != h){ print $2 } else { exit 1 } }'}
end