Skip to content

Commit

Permalink
Use yaml.safe_load() to fix deprecation and crash
Browse files Browse the repository at this point in the history
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: tcpcloud#32
  • Loading branch information
riegl-gc committed Jul 17, 2024
1 parent d9f07ca commit 0601239
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aptly/publisher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion aptly/publisher/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 0601239

Please sign in to comment.