fix: "Flow" object has no field "last_tested_version" when loading flows from dir (#2221)

This commit is contained in:
Nicolò Boschi 2024-06-19 18:15:50 +02:00 committed by GitHub
commit e3656a6a43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 7 deletions

View file

@ -341,9 +341,9 @@ def load_flows_from_directory():
if existing:
logger.info(f"Updating existing flow: {flow_id} with endpoint name {flow_endpoint_name}")
for key, value in flow.items():
if key == "last_tested_version":
continue
setattr(existing, key, value)
if hasattr(existing, key):
# flow dict from json and db representation are not 100% the same
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
existing.user_id = user_id
session.add(existing)