Fix pyyaml load call error
yaml.load(input) is deprecated in pyyaml 5.1. This causes the manifests_lookup function to append the python warning message to the look up results. The pegleg cmd fails to launch container due to extra strings after the image url. Added code to specify the loader if the pyyaml version is 5.1 or newer. Change-Id: I4765df28eedf99a8e823e192cf2f2f2b38434f2c Signed-off-by: James Gu <james.gu@att.com>
This commit is contained in:
parent
88dd435a79
commit
40a01b2c4c
@ -70,7 +70,11 @@ manifests_lookup(){
|
||||
RESULT=`python3 -c "
|
||||
|
||||
import yaml,sys
|
||||
y = yaml.load_all(open('$file'))
|
||||
from distutils.version import StrictVersion
|
||||
if StrictVersion(yaml.__version__) < StrictVersion('5.1'):
|
||||
y = yaml.load_all(open('$file'))
|
||||
else:
|
||||
y = yaml.load_all(open('$file'), Loader=yaml.FullLoader)
|
||||
for x in y:
|
||||
if x.get('schema') == '$schema':
|
||||
if x['metadata']['name'] == '$mdata_name':
|
||||
|
Loading…
x
Reference in New Issue
Block a user