Method: Inspec::Resources::System#mac_hostname

Defined in:
lib/inspec/resources/sys_info.rb

#mac_hostname(opt = nil) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/inspec/resources/sys_info.rb', line 69

def mac_hostname(opt = nil)
  if opt
    opt = case opt
          when "f", "long", "fqdn", "full"
            " -f"
          when "s", "short"
            " -s"
          else
            "ERROR"
          end
  end
  if opt == "ERROR"
    skip_resource "The `sys_info.hostname` resource is not supported with that option on your OS."
  else
    inspec.command("hostname#{opt}").stdout.chomp
  end
end