(host, salt_data)
return info
salt更新资产添加历史记录
salt更新资产添加历史记录
salt更新资产添加历史记录
def salt_record(host, salt_data):
    """ salt更新资产添加历史记录 """
    info = {}
    field_list = ['eth1', 'mac', 'system', 'system_cpuarch', 'server_sn',
                  'system_version', 'cpu', 'core_num', 'hard_disk', 'memory', 'brand']
    host_dic = host.__dict__
    for field in field_list:
        old = host_dic.get(field)
        new = salt_data.get(field)
        if old != new:
            info[field] = [old, new]
    return info
def salt_record ( host , salt_data ) : info = { } field_list = [ 'eth1' , 'mac' , 'system' , 'system_cpuarch' , 'server_sn' , 'system_version' , 'cpu' , 'core_num' , 'hard_disk' , 'memory' , 'brand' ] host_dic = host . __dict__ for field in field_list : old = host_dic . get ( field ) new = salt_data . get ( field ) if old != new : info [ field ] = [ old , new ] return info