Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

fix YAMLLoadWarning #1257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Atomic/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import selinux
from .client import AtomicDocker
from yaml import load as yaml_load
import yaml
from yaml import safe_load
from yaml import YAMLError
from yaml.scanner import ScannerError
Expand Down Expand Up @@ -41,11 +41,19 @@
KPOD_PATH = os.environ.get("KPOD_PATH", "/usr/bin/kpod")
CAPSH_PATH = os.environ.get("CAPSH_PATH", "/usr/sbin/capsh")

try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader

try:
from subprocess import DEVNULL # pylint: disable=no-name-in-module
except ImportError:
DEVNULL = open(os.devnull, 'wb')

def yaml_load(stream):
return yaml.load(stream, Loader=Loader)

def gomtree_available():
return os.path.exists(GOMTREE_PATH)

Expand Down