parameters: (tgt)
docstring: Salt API得到资产信息，进行格式化输出
docstring_summary: Salt API得到资产信息，进行格式化输出
docstring_tokens: Salt API得到资产信息，进行格式化输出
function: def get_server_asset_info(tgt):
      '''
      Salt API得到资产信息，进行格式化输出
      '''
      global asset_info
      info = []
      sapi = SaltAPI(url=settings.SALT_API['url'],username=settings.SALT_API['user'],password=settings.SALT_API['password'])
      ret = sapi.remote_noarg_execution(tgt,'grains.items')
      manufacturer = ret['manufacturer']
      info.append(manufacturer)
      productname = ret['productname']
      info.append(productname)
      serialnumber = ret['serialnumber'] 
      info.append(serialnumber)
      cpu_model = ret['cpu_model']
      info.append(cpu_model)
      num_cpus = int(ret['num_cpus'])
      info.append(num_cpus)
      num_gpus = int(ret['num_gpus'])
      info.append(num_gpus)
      mem_total = str(round(int(ret['mem_total'])/1000.0,))[:-2] + 'G'
      info.append(mem_total)
      disk_size = ret['disk_size']
      info.append(disk_size)
      raidlevel = ret['raidlevel']
      info.append(raidlevel)
      id = ret['id']
      info.append(id)
      lan_ip = ret['lan_ip'][0]
      info.append(lan_ip)
      lan_mac = ret['hwaddr_interfaces']['eth0']
      info.append(lan_mac)
      sys_ver = ret['os'] + ret['osrelease'] + '-' + ret['osarch']
      info.append(sys_ver)
      virtual = ret['virtual']
      info.append(virtual)
      idc_name = ret['idc_name']
      info.append(idc_name)
      asset_info.append(info)
function_tokens: def get_server_asset_info ( tgt ) : global asset_info info = [ ] sapi = SaltAPI ( url = settings . SALT_API [ 'url' ] , username = settings . SALT_API [ 'user' ] , password = settings . SALT_API [ 'password' ] ) ret = sapi . remote_noarg_execution ( tgt , 'grains.items' ) manufacturer = ret [ 'manufacturer' ] info . append ( manufacturer ) productname = ret [ 'productname' ] info . append ( productname ) serialnumber = ret [ 'serialnumber' ] info . append ( serialnumber ) cpu_model = ret [ 'cpu_model' ] info . append ( cpu_model ) num_cpus = int ( ret [ 'num_cpus' ] ) info . append ( num_cpus ) num_gpus = int ( ret [ 'num_gpus' ] ) info . append ( num_gpus ) mem_total = str ( round ( int ( ret [ 'mem_total' ] ) / 1000.0 , ) ) [ : - 2 ] + 'G' info . append ( mem_total ) disk_size = ret [ 'disk_size' ] info . append ( disk_size ) raidlevel = ret [ 'raidlevel' ] info . append ( raidlevel ) id = ret [ 'id' ] info . append ( id ) lan_ip = ret [ 'lan_ip' ] [ 0 ] info . append ( lan_ip ) lan_mac = ret [ 'hwaddr_interfaces' ] [ 'eth0' ] info . append ( lan_mac ) sys_ver = ret [ 'os' ] + ret [ 'osrelease' ] + '-' + ret [ 'osarch' ] info . append ( sys_ver ) virtual = ret [ 'virtual' ] info . append ( virtual ) idc_name = ret [ 'idc_name' ] info . append ( idc_name ) asset_info . append ( info )