From 2ae5c824cbd75bd7915f12d68eb00a4cb3c2b6f6 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Wed, 17 Jul 2024 11:17:33 +0200 Subject: [PATCH] Use yaml.safe_load() to fix deprecation and crash The `yaml.load()` function without a `Loader` keyword is deprecated since `pyyaml 5.1` and removed with `pyyaml 6.0`. Ubuntu 24.04 noble ships with `pyyaml 6.0.1` breaking `python-aptly` and `aptly-publisher`. Fix it by using the recommended `yaml.safe_load()` function. Fixes: https://github.com/tcpcloud/python-aptly/issues/32 --- aptly/publisher/__init__.py | 2 +- aptly/publisher/__main__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aptly/publisher/__init__.py b/aptly/publisher/__init__.py index 6b4984b..3b3aa41 100644 --- a/aptly/publisher/__init__.py +++ b/aptly/publisher/__init__.py @@ -13,7 +13,7 @@ def load_publish(publish): with open(publish, 'r') as publish_file: - return yaml.load(publish_file) + return yaml.safe_load(publish_file) class PublishManager(object): diff --git a/aptly/publisher/__main__.py b/aptly/publisher/__main__.py index cc5099e..8715142 100644 --- a/aptly/publisher/__main__.py +++ b/aptly/publisher/__main__.py @@ -20,7 +20,7 @@ def load_config(config): with open(config, 'r') as fh: - return yaml.load(fh) + return yaml.safe_load(fh) def get_latest_snapshot(snapshots, name):