Merge "Use libyaml parsing when available"

This commit is contained in:
Zuul 2022-07-25 09:34:19 +00:00 committed by Gerrit Code Review
commit 9641b719f9
2 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,10 @@ libffi6 [platform:dpkg !platform:ubuntu-focal !platform:ubuntu-jammy !platform:d
libffi-devel [compile test platform:rpm] libffi-devel [compile test platform:rpm]
libressl-dev [compile test platform:apk] libressl-dev [compile test platform:apk]
libssl-dev [compile test platform:dpkg] libssl-dev [compile test platform:dpkg]
libyaml-0-2 [platform:dpkg platform:suse]
libyaml [platform:redhat]
libyaml-dev [platform:dpkg compile test]
libyaml-devel [platform:rpm compile test]
linux-headers [compile test platform:apk] linux-headers [compile test platform:apk]
make [compile test platform:apk platform:dpkg] make [compile test platform:apk platform:dpkg]
musl-dev [compile test platform:apk] musl-dev [compile test platform:apk]

View File

@ -24,6 +24,11 @@ import yaml
from nodepool.driver import ConfigValue from nodepool.driver import ConfigValue
from nodepool.driver import Drivers from nodepool.driver import Drivers
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader
class ZooKeeperConnectionConfig(object): class ZooKeeperConnectionConfig(object):
''' '''
@ -407,7 +412,8 @@ def openConfig(path, env):
while True: while True:
try: try:
with open(path) as f: with open(path) as f:
return yaml.safe_load(substitute_env_vars(f.read(), env)) return yaml.load(
substitute_env_vars(f.read(), env), SafeLoader)
except IOError as e: except IOError as e:
if e.errno == 2: if e.errno == 2:
retry = retry - 1 retry = retry - 1