def get_computer_desc():
 desc = None
 hostname_cmd = salt.utils.which('hostnamectl')
 if hostname_cmd:
  desc = __salt__['cmd.run']('{0} status --pretty'.format(hostname_cmd))
 else:
  pattern = re.compile('^\\s*PRETTY_HOSTNAME=(.*)$')
  try:
   with salt.utils.fopen('/etc/machine-info', 'r') as mach_info:
    for line in mach_info.readlines():
     match = pattern.match(line)
     if match:
      desc = _strip_quotes(match.group(1).strip()).replace('\\"', '"')
  except IOError:
   return False
 return desc

def get_computer_desc ( ) : desc = None hostname_cmd = salt . utils . which ( 'hostnamectl' ) if hostname_cmd : desc = __salt__ [ 'cmd.run' ] ( '{0} status --pretty' . format ( hostname_cmd ) ) else : pattern = re . compile ( '^\\s*PRETTY_HOSTNAME=(.*)$' ) try : with salt . utils . fopen ( '/etc/machine-info' , 'r' ) as mach_info : for line in mach_info . readlines ( ) : match = pattern . match ( line ) if match : desc = _strip_quotes ( match . group ( 1 ) . strip ( ) ) . replace ( '\\"' , '"' ) except IOError : return False return desc
get the windows computer description :return: returns the computer description if found .