From cf59ebf1aa73a62290665e2352648ebb9031e143 Mon Sep 17 00:00:00 2001 From: wangyong <864072399@qq.com> Date: Sat, 19 Dec 2015 22:49:39 +0800 Subject: [PATCH] fix asset add batch bug --- jasset/asset_api.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jasset/asset_api.py b/jasset/asset_api.py index 7edb391da..ca733cad0 100644 --- a/jasset/asset_api.py +++ b/jasset/asset_api.py @@ -278,14 +278,13 @@ def excel_to_db(excel_file): data = xlrd.open_workbook(filename=None, file_contents=excel_file.read()) except Exception, e: return False - else: table = data.sheets()[0] rows = table.nrows - group_instance = [] for row_num in range(1, rows): row = table.row_values(row_num) if row: + group_instance = [] ip, port, hostname, use_default_auth, username, password, group = row if get_object(Asset, hostname=hostname): continue @@ -306,7 +305,6 @@ def excel_to_db(excel_file): if group: group_instance.append(group) if group_instance: - print group_instance asset.group = group_instance asset.save() return True