This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
netbox-docker/startup_scripts/startup_script_utils/load_yaml.py
2021-02-08 18:24:29 +01:00

13 lines
256 B
Python

from pathlib import Path
from ruamel.yaml import YAML
def load_yaml(yaml_file: str):
yf = Path(yaml_file)
if not yf.is_file():
return None
with yf.open("r") as stream:
yaml = YAML(typ="safe")
return yaml.load(stream)