fix: #14 now correctly handles 'other' transactions
This commit is contained in:
parent
42880bb334
commit
8384d714f9
6
inex.py
6
inex.py
@ -10,6 +10,7 @@ import json
|
||||
import requests
|
||||
import inexEncoder
|
||||
import inexSqlquery
|
||||
|
||||
class Inex:
|
||||
def __init__(self):
|
||||
"""Initilize config, calls functions from inex-connect.py and inex-logging.py"""
|
||||
@ -30,6 +31,8 @@ class Inex:
|
||||
self.config = self.tl.load(c)
|
||||
|
||||
# set config
|
||||
try:
|
||||
if self.config:
|
||||
self.dbDriver = self.config["database"]["driver"]
|
||||
self.dbServer = self.config["database"]["server"]
|
||||
self.dbDatabase = self.config["database"]["database"]
|
||||
@ -49,6 +52,9 @@ class Inex:
|
||||
self.writeJsonfile = self.config["output"]["dumpTojson"]
|
||||
self.pushToplatform = self.config["output"]["pushToplatform"]
|
||||
self.queryOverride = self.config["database"]["overrideEmbeddedquery"]
|
||||
except:
|
||||
print("No config.toml. Please use example file and configure appropriately")
|
||||
exit(1)
|
||||
|
||||
if "dev" in self.selectedPlatform.lower():
|
||||
self.platformConfig = self.config["fortraPlatform"]["dev"]
|
||||
|
@ -123,5 +123,7 @@ def dataTemplate(transactionType,**kwargs):
|
||||
template = fileDeleted
|
||||
if transactionType == "user_logged_on":
|
||||
template = logon
|
||||
if transactionType == "other":
|
||||
template = {}
|
||||
|
||||
return template
|
@ -7,7 +7,7 @@ def processData(data, template, **kwargs):
|
||||
# print(f'Row: {row}')
|
||||
if row.get('Command') == None:
|
||||
continue
|
||||
|
||||
try:
|
||||
processedData.append(template(identifyUtype(row.get('Command')),\
|
||||
prd_ext_tenant_id='',\
|
||||
status_code=row.get('ResultID'),\
|
||||
@ -38,8 +38,13 @@ def processData(data, template, **kwargs):
|
||||
user_home_directory=row.get('VirtualFolderName'),\
|
||||
description=row.get('Description'),\
|
||||
utype=identifyUtype(row.get('Command'))))
|
||||
except UnboundLocalError:
|
||||
print(f'Problem row GUID:{row.get("TransactionGUID")} ::: TransactionObject:{row.get("TransactionObject")} Command: {row.get("Command")}')
|
||||
|
||||
continue
|
||||
|
||||
if row.get('TransactionGUID') not in transactionLoginid:
|
||||
try:
|
||||
processedData.append(template(identifyUtype(row.get('TransactionObject')),\
|
||||
guid=row.get('TransactionGUID'),\
|
||||
prd_instance_id=kwargs.get('prd_instance_id'),\
|
||||
@ -63,6 +68,9 @@ def processData(data, template, **kwargs):
|
||||
utype=identifyUtype(row.get('TransactionObject'))\
|
||||
))
|
||||
transactionLoginid.append(row.get('TransactionGUID'))
|
||||
except UnboundLocalError:
|
||||
print(f'Problem row GUID:{row.get("TransactionGUID")} ::: TransactionObject:{row.get("TransactionObject")} Command: {row.get("Command")}')
|
||||
continue
|
||||
|
||||
return processedData
|
||||
|
||||
@ -89,4 +97,4 @@ def identifyUtype(obj):
|
||||
if obj in file_downloaded:
|
||||
return "file_downloaded"
|
||||
else:
|
||||
return None
|
||||
return "other"
|
Loading…
x
Reference in New Issue
Block a user