From 74ab9401d2e9cf33b8e1f2d2205a3c19103daf1e Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Wed, 19 Aug 2020 13:55:48 -0600 Subject: [PATCH] Fix config parser warning /usr/lib/python3.6/site-packages/tripleo_common/actions/ansible.py:154: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead. config.readfp(sio_cfg) Note: this backport has been adjusted to work on python2 as well; which is still very well supported in stable/train. Change-Id: Ibd33a26feae03e4f0d46370346b7a950d1f6b02c (cherry picked from commit 781233af1a164b96d32f9eb987c4341f29f51ef2) --- tripleo_common/actions/ansible.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tripleo_common/actions/ansible.py b/tripleo_common/actions/ansible.py index 441e7afd4..1dd7d3d35 100644 --- a/tripleo_common/actions/ansible.py +++ b/tripleo_common/actions/ansible.py @@ -148,7 +148,10 @@ def write_default_ansible_cfg(work_dir, sio_cfg = StringIO() sio_cfg.write(override_ansible_cfg) sio_cfg.seek(0) - config.readfp(sio_cfg) + if sys.version_info[0] < 3: + config.readfp(sio_cfg) + else: + config.read_file(sio_cfg) sio_cfg.close() with open(ansible_config_path, 'w') as configfile: