Fix loading invalid metadata YAML #4
PeterSurda
commented 2021-11-19 08:52:25 +01:00
Owner
```
diff --git a/main.py b/main.py
index 929b0a1..3629e2b 100644
--- a/main.py
+++ b/main.py
@@ -147,7 +147,10 @@ class CloudInitApp:
filepath = os.path.join(PATH, "data", data['local-hostname'], META_DATA_FILENAME)
if os.path.exists(filepath):
with open(filepath, "r") as metadata:
- data.update(yaml.safe_load(metadata))
+ try:
+ data.update(yaml.safe_load(metadata))
+ except ValueError:
+ pass
cherrypy.response.headers['Content-Type'] = \
'text/yaml'
```
PeterSurda
self-assigned this 2023-01-28 03:57:38 +01:00
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Sysdeploy/cloud-init-cherrypy#4
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?