Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 65494bef authored by Frederico SEQUEIRA's avatar Frederico SEQUEIRA
Browse files

:bug: Fix bug when uploading files

parent a8e720b1
No related branches found
No related tags found
1 merge request!140V3 custom script distribution
Pipeline #281556 passed
......@@ -65,5 +65,3 @@ else
## Launch regular netbox entrypoint
/opt/netbox/docker-entrypoint.sh /opt/netbox/launch-netbox.sh
fi
......@@ -42,14 +42,15 @@ class InitializeJsonDataScript(Script):
elif not(file_path) and json_file:
print("json_file",json_file)
json_data= json_file.read().decode("utf-8")
objects = json_data
try:
objects = json.loads(json_data)
except json.JSONDecodeError as e:
self.log_failure(f"Failed to parse file: {e}")
else:
self.log_failure("Please specify the path to the data file the data file itself")
return
# Process Data
for obj_data in objects:
self.create_object(obj_data)
......@@ -186,4 +187,4 @@ class InitializeJsonDataScript(Script):
self.log_info(f"Updated {object_type}: {obj} (Skipping re-assignment)")
except Exception as e:
self.log_failure(f"Error processing {object_type}: {e}")
\ No newline at end of file
self.log_failure(f"Error processing {object_type}: {e}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment